mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Desktop: show the filter information in the window title
Instead of using the filter widget itself to show the information how many dives are displayed, put it in the window title where it's visible even if the filter widget isn't shown. If the filter is not active, simply show the total number of dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
208b3bb9af
commit
3ff131b27d
3 changed files with 14 additions and 3 deletions
|
@ -229,8 +229,16 @@ void FilterWidget2::filterDataChanged(const FilterData &data)
|
|||
|
||||
void FilterWidget2::countsChanged()
|
||||
{
|
||||
ui.filterText->setText(tr("%L1/%L2 shown").arg(MultiFilterSortModel::instance()->divesDisplayed)
|
||||
.arg(dive_table.nr));
|
||||
updateWindowTitle();
|
||||
}
|
||||
|
||||
QString FilterWidget2::shownText()
|
||||
{
|
||||
if (isActive())
|
||||
return tr("%L1/%L2 shown").arg(MultiFilterSortModel::instance()->divesDisplayed)
|
||||
.arg(dive_table.nr);
|
||||
else
|
||||
return tr("%L1 dives").arg(dive_table.nr);
|
||||
}
|
||||
|
||||
bool FilterWidget2::isActive() const
|
||||
|
|
|
@ -20,6 +20,8 @@ class FilterWidget2 : public QWidget {
|
|||
public:
|
||||
explicit FilterWidget2(QWidget *parent = 0);
|
||||
void updateFilter();
|
||||
QString shownText();
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
|
|
@ -1636,7 +1636,8 @@ void MainWindow::setTitle()
|
|||
}
|
||||
|
||||
QString unsaved = (unsaved_changes() ? " *" : "");
|
||||
setWindowTitle("Subsurface: " + displayedFilename(existing_filename) + unsaved);
|
||||
QString shown = QString(" (%1)").arg(filterWidget2.shownText());
|
||||
setWindowTitle("Subsurface: " + displayedFilename(existing_filename) + unsaved + shown);
|
||||
}
|
||||
|
||||
void MainWindow::importFiles(const QStringList fileNames)
|
||||
|
|
Loading…
Add table
Reference in a new issue