From 4d7f4762a1af2bbe4d2051bd86e45c35361f0cfc Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 15 Mar 2020 10:46:35 +0100 Subject: [PATCH] Outliner: Add filter combo for non-output items Addresses #11442, #10786 --- src/frontends/qt/TocWidget.cpp | 12 +- src/frontends/qt/ui/TocUi.ui | 299 ++++++++++++++++++++------------- 2 files changed, 190 insertions(+), 121 deletions(-) diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp index 4c69aa3ba5..3f5928368d 100644 --- a/src/frontends/qt/TocWidget.cpp +++ b/src/frontends/qt/TocWidget.cpp @@ -92,6 +92,8 @@ TocWidget::TocWidget(GuiView & gui_view, QWidget * parent) this, SLOT(showContextMenu(const QPoint &))); connect(filterLE, SIGNAL(textEdited(QString)), this, SLOT(filterContents())); + connect(activeFilterCO, SIGNAL(activated(int)), + this, SLOT(filterContents())); // setting the update timer timer_->setSingleShot(true); @@ -507,12 +509,20 @@ void TocWidget::filterContents() Qt::DisplayRole, "*", -1, Qt::MatchFlags(Qt::MatchWildcard|Qt::MatchRecursive)); + bool const show_active = + activeFilterCO->currentIndex() != 2; + bool const show_inactive = + activeFilterCO->currentIndex() != 1; + int size = indices.size(); for (int i = 0; i < size; i++) { QModelIndex index = indices[i]; - bool const matches = + bool matches = index.data().toString().contains( filterLE->text(), Qt::CaseInsensitive); + TocItem const & item = + gui_view_.tocModels().currentItem(current_type_, index); + matches &= (show_active && item.isOutput()) || (show_inactive && !item.isOutput()); tocTV->setRowHidden(index.row(), index.parent(), !matches); } // recursively unhide parents of unhidden children diff --git a/src/frontends/qt/ui/TocUi.ui b/src/frontends/qt/ui/TocUi.ui index c95716a5ae..a76df2397c 100644 --- a/src/frontends/qt/ui/TocUi.ui +++ b/src/frontends/qt/ui/TocUi.ui @@ -1,101 +1,88 @@ - + + TocUi - - + + Qt::NonModal - + 0 0 - 202 - 355 + 231 + 437 - + - - - 9 - - - 6 - - - - + + + + + 6 + + 0 - - 6 + + 0 + + + 0 + + + 0 - - + + Filter: - + filterLE - - + + Enter string to filter contents - - - - - 13 - 0 - 0 - 0 - + + + + 6 - - Switch between available lists (table of contents, list of figures, list of tables, and others) + + 0 - - - - - - - 13 - 7 - 0 - 0 - + + 0 - - - - - + 0 - - 6 + + 0 - - + + Update navigation tree - + ... - - ../../../../lib/images/reload.png + + + ../../../../lib/images/reload.png../../../../lib/images/reload.png - + 20 20 @@ -105,10 +92,10 @@ - + Qt::Horizontal - + 16 20 @@ -117,17 +104,18 @@ - - + + Decrease nesting depth of selected item - + ... - - ../../../../lib/images/outline-out.png + + + ../../../../lib/images/outline-out.png../../../../lib/images/outline-out.png - + 20 20 @@ -136,17 +124,18 @@ - - + + Increase nesting depth of selected item - + ... - - ../../../../lib/images/outline-in.png + + + ../../../../lib/images/outline-in.png../../../../lib/images/outline-in.png - + 20 20 @@ -155,17 +144,18 @@ - - + + Move selected item down by one - + ... - - ../../../../lib/images/outline-down.png + + + ../../../../lib/images/outline-down.png../../../../lib/images/outline-down.png - + 20 20 @@ -174,17 +164,18 @@ - - + + Move selected item up by one - + ... - - ../../../../lib/images/outline-up.png + + + ../../../../lib/images/outline-up.png../../../../lib/images/outline-up.png - + 20 20 @@ -194,94 +185,162 @@ - - - - 4 - - + + + 0 - + QLayout::SetMinimumSize + + 4 + + + 4 + + + 4 + + + 4 + - - - - 0 - 0 + + + 0 0 - + 0 21 - + Sort - - - - 0 - 1 + + + 0 0 - + 0 21 - + Try to keep persistent view of the uncollapsed nodes - + Keep - - - - - 13 - 0 + + + + + 0 + 0 + + + + Switch between available lists (table of contents, list of figures, list of tables, and others) + + + + + + + 0 0 - + Adjust the depth of the navigation tree - + 5 - + 1 - + 2 - + Qt::Horizontal - + QSlider::TicksBothSides + + + + + 0 + 0 + + + + + + + + + + Sho&w: + + + activeFilterCO + + + + + + + + 0 + 0 + + + + Filter items that are not output (in notes, inactive branches, deleted in chagte tracking, etc.) + + + + All items + + + + + Only output items + + + + + Only non-output items + + + + + + @@ -289,7 +348,7 @@ tocTV - qt_i18n.h + qt_i18n.h -- 2.39.2