From d277d4d88e29c64e0ec29e15bf9f7b04054c356a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 11 Nov 2014 17:06:28 -0200 Subject: Added buttons to control the multi filter Buttons to close, minimize and clear were added. We need better icons. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 34 ++++++++++++++++++++++++++++------ qt-ui/simplewidgets.h | 2 ++ 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'qt-ui') 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 #include #include +#include +#include #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 { -- cgit v1.2.3-70-g09d2