[rkward-cvs] SF.net SVN: rkward: [1658] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Mar 20 14:13:14 UTC 2007
Revision: 1658
http://svn.sourceforge.net/rkward/?rev=1658&view=rev
Author: tfry
Date: 2007-03-20 07:13:13 -0700 (Tue, 20 Mar 2007)
Log Message:
-----------
Make dropdown list items show whether they are enabled or not
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/plugin/rkdropdown.cpp
trunk/rkward/rkward/plugin/rkdropdown.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2007-03-20 12:29:29 UTC (rev 1657)
+++ trunk/rkward/ChangeLog 2007-03-20 14:13:13 UTC (rev 1658)
@@ -19,8 +19,8 @@
- new plugin: Phillips-Perron test
- new plugin: Mood test
- new plugins: variance tests (F test (aka var.test), Bartlett test, Flingner test)
-- new plugin: plugin pareto chart
-- new plugin: plugin stem-and-leaf plot
+- new plugin: pareto chart
+- new plugin: stem-and-leaf plot
- make readline dialog store last size and position
- new plugins: outlier tests (chisq.out.test, dixon.test, grubbs.test, outlier)
- support R's mechanism for checking the C stack limits (only with R 2.3.x or greater, and not on all platforms)
Modified: trunk/rkward/rkward/plugin/rkdropdown.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkdropdown.cpp 2007-03-20 12:29:29 UTC (rev 1657)
+++ trunk/rkward/rkward/plugin/rkdropdown.cpp 2007-03-20 14:13:13 UTC (rev 1658)
@@ -73,10 +73,35 @@
void RKDropDown::setItemEnabledInGUI (int id, bool enabled) {
RK_TRACE (PLUGIN);
- QListBoxItem *item = box->listBox ()->item (id);
+ QListBox *list = box->listBox ();
+ RK_ASSERT (list);
+ QListBoxItem *item = list->item (id);
RK_ASSERT (item);
+ if (item->rtti () != ID_RKDROPDOWNLISTITEM) {
+ // this item won't show whether it is enabled or not. We need to replace it.
+ item = new RKDropDownListItem (0, list->text (id));
+ list->changeItem (item, id);
+ }
+
item->setSelectable (enabled);
}
+////////////////// RKDropDownListItem ////////////////////////
+
+#include <qpainter.h>
+
+RKDropDownListItem::RKDropDownListItem (QListBox *listbox, const QString &text) : QListBoxText (listbox, text) {
+ RK_TRACE (PLUGIN);
+}
+
+void RKDropDownListItem::paint (QPainter *painter) {
+ // no trace!
+ if (!isSelectable ()) {
+ painter->setPen (QColor (150, 150, 150));
+ }
+
+ QListBoxText::paint (painter);
+}
+
#include "rkdropdown.moc"
Modified: trunk/rkward/rkward/plugin/rkdropdown.h
===================================================================
--- trunk/rkward/rkward/plugin/rkdropdown.h 2007-03-20 12:29:29 UTC (rev 1657)
+++ trunk/rkward/rkward/plugin/rkdropdown.h 2007-03-20 14:13:13 UTC (rev 1658)
@@ -23,9 +23,8 @@
class QComboBox;
/** This RKPluginWidget provides a group of radio-buttons.
- *@author Thomas Friedrichsmeier
- */
-
+ at author Thomas Friedrichsmeier
+*/
class RKDropDown : public RKAbstractOptionSelector {
Q_OBJECT
public:
@@ -40,4 +39,18 @@
QComboBox *box;
};
+#include <qlistbox.h>
+
+#define ID_RKDROPDOWNLISTITEM 1001
+
+/** Item used in RKDropDown. The difference to a regular QListBoxText is that the item looks different when disabled */
+class RKDropDownListItem : public QListBoxText {
+public:
+ RKDropDownListItem (QListBox *listbox, const QString &text);
+ ~RKDropDownListItem () {};
+ int rtti () const { return ID_RKDROPDOWNLISTITEM; };
+protected:
+ void paint (QPainter *painter);
+};
+
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list