[rkward] /: Allow to set <select>-elements to single value mode.

Thomas Friedrichsmeier null at kde.org
Thu Oct 11 12:20:36 BST 2018


Git commit a1b6ece4ca53953e5070ba4f4e6b5de44fa02158 by Thomas Friedrichsmeier.
Committed on 11/10/2018 at 11:18.
Pushed by tfry into branch 'master'.

Allow to set <select>-elements to single value mode.

CCMAIL: meik.michalke at uni-duesseldorf.de

M  +1    -0    ChangeLog
M  +4    -0    doc/rkwardplugins/index.docbook
M  +6    -2    rkward/plugin/rkvalueselector.cpp

https://commits.kde.org/rkward/a1b6ece4ca53953e5070ba4f4e6b5de44fa02158

diff --git a/ChangeLog b/ChangeLog
index fa1f08a6..76e49b23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 --- Version 0.7.1 - UNRELEASED
+- <select> elements in plugin dialogs can be set to accept only a single selection
 - New R functions rk.capture.output() and and rk.end.capture.output()
 - Allow to reference current script file in plugins      TODO: Test this
 - Add various live-preview options for R scripts, including a preview of R markdown rendering
diff --git a/doc/rkwardplugins/index.docbook b/doc/rkwardplugins/index.docbook
index 6a96c9aa..ba0a3f4f 100644
--- a/doc/rkwardplugins/index.docbook
+++ b/doc/rkwardplugins/index.docbook
@@ -3180,6 +3180,10 @@ new Header(i18n("Test results")).print();
 	<term><parameter>label</parameter></term>
 	<listitem><para>Label for the <select> (optional, defaults to no label)</para></listitem>
 	</varlistentry>
+	<varlistentry>
+	<term><parameter>single</parameter></term>
+	<listitem><para>If set to true, only a single value will be selectable, instead of multiple values at once (boolean, defaults to false)</para></listitem>
+	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
 
diff --git a/rkward/plugin/rkvalueselector.cpp b/rkward/plugin/rkvalueselector.cpp
index 72c21a27..61d26f0e 100644
--- a/rkward/plugin/rkvalueselector.cpp
+++ b/rkward/plugin/rkvalueselector.cpp
@@ -2,7 +2,7 @@
                           rkvalueselector  -  description
                              -------------------
     begin                : Weg May 8 2013
-    copyright            : (C) 2013, 2014 by Thomas Friedrichsmeier
+    copyright            : (C) 2013-2018 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -55,7 +55,11 @@ RKValueSelector::RKValueSelector (const QDomElement &element, RKComponent *paren
 
 	list_view = new QTreeView (this);
 	list_view->setHeaderHidden (true);
-	list_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
+	if (standalone && xml->getBoolAttribute (element, "single", false, DL_INFO)) {
+		list_view->setSelectionMode (QAbstractItemView::SingleSelection);
+	} else {
+		list_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
+	}
 	list_view->setRootIsDecorated (false);
 	model = new QStringListModel (this);
 	list_view->setModel (model);



More information about the rkward-tracker mailing list