Delay restoring state of database header

This commit is contained in:
2026-04-13 13:30:54 +02:00
parent 468862ad35
commit 8b8759facb
2 changed files with 21 additions and 11 deletions
+4 -1
View File
@@ -319,9 +319,12 @@ DataBaseView::DataBaseView(Database *database, QWidget *parent) : QWidget(parent
m_model = new FITSFileModel(m_database, this); m_model = new FITSFileModel(m_database, this);
QSettings settings; QSettings settings;
m_tableView->setModel(m_model);
m_model->setColumns(settings.value("databaseview/selectedColumns", DEFAULT_COLUMNS).toStringList()); m_model->setColumns(settings.value("databaseview/selectedColumns", DEFAULT_COLUMNS).toStringList());
m_tableView->setModel(m_model);
QTimer::singleShot(200, [this](){
QSettings settings;
m_tableView->horizontalHeader()->restoreState(settings.value("databaseview/header").toByteArray()); m_tableView->horizontalHeader()->restoreState(settings.value("databaseview/header").toByteArray());
});
QHBoxLayout *hlayout = new QHBoxLayout(); QHBoxLayout *hlayout = new QHBoxLayout();
layout->addLayout(hlayout); layout->addLayout(hlayout);
+7
View File
@@ -576,6 +576,8 @@ void MainWindow::loadFile(const QString &path)
if(!path.isEmpty()) if(!path.isEmpty())
{ {
QFileInfo info(path); QFileInfo info(path);
if(info.exists() && info.isReadable())
{
m_ringList->setFile(info.canonicalFilePath()); m_ringList->setFile(info.canonicalFilePath());
updateWindowTitle(); updateWindowTitle();
if(info.isDir()) if(info.isDir())
@@ -587,6 +589,11 @@ void MainWindow::loadFile(const QString &path)
if(settings.value("settings/bestfit", false).toBool()) if(settings.value("settings/bestfit", false).toBool())
m_image->bestFit(); m_image->bestFit();
} }
else
{
qWarning() << "File doesn't exist or is not readable";
}
}
} }
void MainWindow::loadFiles(const QStringList &paths) void MainWindow::loadFiles(const QStringList &paths)