mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Try to get rid of unnecessary reloads of the dive list
Don't call refreshDisplay() after preferences change. This strangely somehow leads to a situation where I need to move the mouse over the dive list before changes to the units are reflected. When calling reload() do not force layout change / resort unless that is the intention. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3f7490c205
commit
6f7e13ac70
4 changed files with 11 additions and 9 deletions
|
@ -128,8 +128,10 @@ void DiveListView::headerClicked(int i)
|
||||||
|
|
||||||
void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
|
void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
|
||||||
{
|
{
|
||||||
|
if (layout == DiveTripModel::CURRENT)
|
||||||
|
layout = currentLayout;
|
||||||
|
else
|
||||||
currentLayout = layout;
|
currentLayout = layout;
|
||||||
|
|
||||||
header()->setClickable(true);
|
header()->setClickable(true);
|
||||||
connect(header(), SIGNAL(sectionPressed(int)), this, SLOT(headerClicked(int)), Qt::UniqueConnection);
|
connect(header(), SIGNAL(sectionPressed(int)), this, SLOT(headerClicked(int)), Qt::UniqueConnection);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
DiveListView(QWidget *parent = 0);
|
DiveListView(QWidget *parent = 0);
|
||||||
void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
||||||
void currentChanged(const QModelIndex& current, const QModelIndex& previous);
|
void currentChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||||
void reload(DiveTripModel::Layout layout = DiveTripModel::TREE, bool forceSort = true);
|
void reload(DiveTripModel::Layout layout, bool forceSort = true);
|
||||||
bool eventFilter(QObject* , QEvent* );
|
bool eventFilter(QObject* , QEvent* );
|
||||||
void unselectDives();
|
void unselectDives();
|
||||||
void selectDive(struct dive *, bool scrollto = false);
|
void selectDive(struct dive *, bool scrollto = false);
|
||||||
|
|
|
@ -42,11 +42,11 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()), helpView(0)
|
||||||
setWindowIcon(QIcon(":subsurface-icon"));
|
setWindowIcon(QIcon(":subsurface-icon"));
|
||||||
connect(ui->ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int)));
|
connect(ui->ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int)));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(refreshDisplay()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui->ListWidget, SLOT(update()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui->ProfileWidget, SLOT(refresh()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui->ProfileWidget, SLOT(refresh()));
|
||||||
ui->mainErrorMessage->hide();
|
ui->mainErrorMessage->hide();
|
||||||
ui->ProfileWidget->setFocusProxy(ui->ListWidget);
|
ui->ProfileWidget->setFocusProxy(ui->ListWidget);
|
||||||
ui->ListWidget->reload();
|
ui->ListWidget->reload(DiveTripModel::TREE);
|
||||||
initialUiSetup();
|
initialUiSetup();
|
||||||
readSettings();
|
readSettings();
|
||||||
ui->ListWidget->reloadHeaderActions();
|
ui->ListWidget->reloadHeaderActions();
|
||||||
|
@ -60,7 +60,7 @@ void MainWindow::refreshDisplay()
|
||||||
{
|
{
|
||||||
if (selected_dive == -1)
|
if (selected_dive == -1)
|
||||||
current_dive_changed(dive_table.nr - 1);
|
current_dive_changed(dive_table.nr - 1);
|
||||||
ui->ListWidget->reload();
|
ui->ListWidget->reload(DiveTripModel::CURRENT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::current_dive_changed(int divenr)
|
void MainWindow::current_dive_changed(int divenr)
|
||||||
|
@ -106,7 +106,7 @@ void MainWindow::on_actionOpen_triggered()
|
||||||
|
|
||||||
ui->InfoWidget->reload();
|
ui->InfoWidget->reload();
|
||||||
ui->globe->reload();
|
ui->globe->reload();
|
||||||
ui->ListWidget->reload();
|
ui->ListWidget->reload(DiveTripModel::TREE);
|
||||||
ui->ListWidget->setFocus();
|
ui->ListWidget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void MainWindow::on_actionClose_triggered()
|
||||||
ui->InfoWidget->clearEquipment();
|
ui->InfoWidget->clearEquipment();
|
||||||
ui->InfoWidget->updateDiveInfo(-1);
|
ui->InfoWidget->updateDiveInfo(-1);
|
||||||
ui->ProfileWidget->clear();
|
ui->ProfileWidget->clear();
|
||||||
ui->ListWidget->reload();
|
ui->ListWidget->reload(DiveTripModel::TREE);
|
||||||
ui->globe->reload();
|
ui->globe->reload();
|
||||||
|
|
||||||
clear_events();
|
clear_events();
|
||||||
|
|
|
@ -144,7 +144,7 @@ class DiveTripModel : public QAbstractItemModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Layout{TREE, LIST};
|
enum Layout{TREE, LIST, CURRENT};
|
||||||
|
|
||||||
DiveTripModel(QObject *parent = 0);
|
DiveTripModel(QObject *parent = 0);
|
||||||
~DiveTripModel();
|
~DiveTripModel();
|
||||||
|
|
Loading…
Add table
Reference in a new issue