Delay restoring state of database header
This commit is contained in:
@@ -319,9 +319,12 @@ DataBaseView::DataBaseView(Database *database, QWidget *parent) : QWidget(parent
|
||||
m_model = new FITSFileModel(m_database, this);
|
||||
|
||||
QSettings settings;
|
||||
m_tableView->setModel(m_model);
|
||||
m_model->setColumns(settings.value("databaseview/selectedColumns", DEFAULT_COLUMNS).toStringList());
|
||||
m_tableView->horizontalHeader()->restoreState(settings.value("databaseview/header").toByteArray());
|
||||
m_tableView->setModel(m_model);
|
||||
QTimer::singleShot(200, [this](){
|
||||
QSettings settings;
|
||||
m_tableView->horizontalHeader()->restoreState(settings.value("databaseview/header").toByteArray());
|
||||
});
|
||||
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
layout->addLayout(hlayout);
|
||||
|
||||
+16
-9
@@ -576,16 +576,23 @@ void MainWindow::loadFile(const QString &path)
|
||||
if(!path.isEmpty())
|
||||
{
|
||||
QFileInfo info(path);
|
||||
m_ringList->setFile(info.canonicalFilePath());
|
||||
updateWindowTitle();
|
||||
if(info.isDir())
|
||||
_lastDir = info.absolutePath();
|
||||
if(info.exists() && info.isReadable())
|
||||
{
|
||||
m_ringList->setFile(info.canonicalFilePath());
|
||||
updateWindowTitle();
|
||||
if(info.isDir())
|
||||
_lastDir = info.absolutePath();
|
||||
else
|
||||
_lastDir = info.canonicalPath();
|
||||
QSettings settings;
|
||||
settings.setValue("mainwindow/lastdir", _lastDir);
|
||||
if(settings.value("settings/bestfit", false).toBool())
|
||||
m_image->bestFit();
|
||||
}
|
||||
else
|
||||
_lastDir = info.canonicalPath();
|
||||
QSettings settings;
|
||||
settings.setValue("mainwindow/lastdir", _lastDir);
|
||||
if(settings.value("settings/bestfit", false).toBool())
|
||||
m_image->bestFit();
|
||||
{
|
||||
qWarning() << "File doesn't exist or is not readable";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user