aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-11-11 17:06:28 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-11 13:07:32 -0800
commitd277d4d88e29c64e0ec29e15bf9f7b04054c356a (patch)
tree22794da7f80f012d480067c3dcbcbff1596eb766 /qt-ui/simplewidgets.cpp
parentaa44b67d6b1e708c7d38d7391cfbacb75ab2ed6e (diff)
downloadsubsurface-d277d4d88e29c64e0ec29e15bf9f7b04054c356a.tar.gz
Added buttons to control the multi filter
Buttons to close, minimize and clear were added. We need better icons. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp34
1 files changed, 28 insertions, 6 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);
}