[rkward] rkward: Add tool button to <varselector> to make it easier to find filter options

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Sun Nov 15 20:15:55 UTC 2015


Git commit 63af5e68a9be59043cbfa6e00ade32545cf331c5 by Thomas Friedrichsmeier.
Committed on 15/11/2015 at 20:15.
Pushed by tfry into branch 'master'.

Add tool button to <varselector> to make it easier to find filter options

M  +1    -1    rkward/dialogs/rkloadlibsdialog.cpp
M  +1    -1    rkward/dialogs/rkloadlibsdialog.h
M  +19   -3    rkward/plugin/rkvarselector.cpp

http://commits.kde.org/rkward/63af5e68a9be59043cbfa6e00ade32545cf331c5

diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 2c33d70..a330306 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -2,7 +2,7 @@
                           rkloadlibsdialog  -  description
                              -------------------
     begin                : Mon Sep 6 2004
-    copyright            : (C) 2004 - 2014 by Thomas Friedrichsmeier
+    copyright            : (C) 2004 - 2015 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
diff --git a/rkward/dialogs/rkloadlibsdialog.h b/rkward/dialogs/rkloadlibsdialog.h
index 9952e16..fe37480 100644
--- a/rkward/dialogs/rkloadlibsdialog.h
+++ b/rkward/dialogs/rkloadlibsdialog.h
@@ -2,7 +2,7 @@
                           rkloadlibsdialog  -  description
                              -------------------
     begin                : Mon Sep 6 2004
-    copyright            : (C) 2004 - 2014 by Thomas Friedrichsmeier
+    copyright            : (C) 2004 - 2015 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
diff --git a/rkward/plugin/rkvarselector.cpp b/rkward/plugin/rkvarselector.cpp
index e528a78..cd51f12 100644
--- a/rkward/plugin/rkvarselector.cpp
+++ b/rkward/plugin/rkvarselector.cpp
@@ -18,9 +18,11 @@
 #include "rkvarselector.h"
 
 #include <QVBoxLayout>
+#include <QHBoxLayout>
 #include <QLabel>
 #include <QAction>
 #include <QMenu>
+#include <QToolButton>
 
 #include <klocale.h>
 
@@ -47,9 +49,17 @@ RKVarSelector::RKVarSelector (const QDomElement &element, RKComponent *parent_co
 
 	QVBoxLayout *vbox = new QVBoxLayout (this);
 	vbox->setContentsMargins (0, 0, 0, 0);
-	
+
+	QHBoxLayout *hbox = new QHBoxLayout ();
+	hbox->setContentsMargins (0, 0, 0, 0);
+	vbox->addLayout (hbox);
 	QLabel *label = new QLabel (xml->i18nStringAttribute (element, "label", i18n ("Select Variable(s)"), DL_INFO), this);
-	vbox->addWidget (label);
+	hbox->addWidget (label);
+	QToolButton *advanced_button = new QToolButton (this);
+	advanced_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionConfigureGeneric));
+	advanced_button->setPopupMode (QToolButton::InstantPopup);
+	advanced_button->setAutoRaise (true);
+	hbox->addWidget (advanced_button);
 
 	// TODO: Or should these actions be moved to RKObjectListView, non-tool-window-mode?
 	show_all_envs_action = new QAction (i18n ("Show all environments"), this);
@@ -76,6 +86,7 @@ RKVarSelector::RKVarSelector (const QDomElement &element, RKComponent *parent_co
 	QAction* sep = list_view->contextMenu ()->insertSeparator (list_view->contextMenu ()->actions ().value (0));
 	list_view->contextMenu ()->insertAction (sep, show_filter_action);
 	list_view->contextMenu ()->insertAction (sep, show_all_envs_action);
+	advanced_button->setMenu (list_view->contextMenu ());
 
 	rootChanged ();
 }
@@ -91,7 +102,12 @@ void RKVarSelector::showFilterWidget () {
 		filter_widget = list_view->getSettings ()->filterWidget (this);
 		filter_widget_placeholder->addWidget (filter_widget);
 	}
-	filter_widget->setShown (show_filter_action->isChecked ());
+	if (show_filter_action->isChecked ()) {
+		filter_widget->show ();
+	} else {
+		filter_widget->hide ();
+		list_view->getSettings ()->resetFilters ();
+	}
 }
 
 void RKVarSelector::rootChanged () {



More information about the rkward-tracker mailing list