diff options
-rw-r--r-- | qt-ui/simplewidgets.cpp | 34 | ||||
-rw-r--r-- | qt-ui/simplewidgets.h | 2 | ||||
-rw-r--r-- | subsurface.qrc | 2 |
3 files changed, 31 insertions, 7 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 8af834d4d..1a23c31ea 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -8,6 +8,8 @@ #include <QShortcut> #include <QCalendarWidget> #include <QSortFilterProxyModel> +#include <QToolButton> +#include <QToolBar> #include "exif.h" #include "dive.h" #include "file.h" @@ -534,9 +536,8 @@ void LocationFilter::hideEvent(QHideEvent *event) MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent) { - QWidget *w = new QWidget(); + QWidget *expandedWidget = new QWidget(); QHBoxLayout *l = new QHBoxLayout(); - QVBoxLayout *v = new QVBoxLayout(); TagFilter *tagFilter = new TagFilter(); @@ -547,15 +548,36 @@ MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent) QStringListModel *dummy = new QStringListModel(QStringList() << "Dummy Text"); dummyList->setModel(dummy); + // Buttons to Clear/Minimize/Close + QToolBar *tb = new QToolBar(); + QToolButton *clearBtn = new QToolButton(); + clearBtn->setToolTip(tr("Clear the filters")); + clearBtn->setIcon(QIcon(":/trash")); + clearBtn->setAutoRaise(true); + QToolButton *closeBtn = new QToolButton(); + closeBtn->setToolTip(tr("Close this window and reset the filters")); + closeBtn->setIcon(QIcon(":/close")); + closeBtn->setAutoRaise(true); + QToolButton *minimize = new QToolButton(); + minimize->setToolTip(tr("Minimize this window")); + minimize->setIcon(QIcon(":/arrow_up")); + minimize->setAutoRaise(true); + + tb->setOrientation(Qt::Vertical); + tb->addWidget(clearBtn); + tb->addWidget(minimize); + tb->addWidget(closeBtn); + + l->addWidget(tb); l->addWidget(tagFilter); l->addWidget(new BuddyFilter()); l->addWidget(new LocationFilter()); l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); - w->setLayout(l); - setWidget(w); - w->resize(w->width(), minimumHeight + dummyList->sizeHintForRow(0) * 5 ); + expandedWidget->setLayout(l); + setWidget(expandedWidget); + expandedWidget->resize(expandedWidget->width(), minimumHeight + dummyList->sizeHintForRow(0) * 5 ); - setMinimumHeight(w->height() + 5); + setMinimumHeight(expandedWidget->height() + 5); } diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index b33dd8f9a..385ce0812 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -134,6 +134,8 @@ class MultiFilter : public QScrollArea { Q_OBJECT public: MultiFilter(QWidget *parent); + QWidget *expandedWidget; + QWidget *minimizedWidget; }; class TagFilter : public QWidget { diff --git a/subsurface.qrc b/subsurface.qrc index 13fdc3e79..76875a716 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -64,7 +64,7 @@ <file>icons/subsurface/index.theme</file> <file>icons/subsurface/32x32/actions/go-down.png</file> <file>icons/subsurface/32x32/actions/go-up.png</file> - <file>icons/subsurface/32x32/actions/window-close.png</file> + <file alias="close">icons/subsurface/32x32/actions/window-close.png</file> <file>icons/ostc2n.png</file> <file>icons/ostc3.png</file> <file>icons/suunto_vyper.png</file> |