[rkward/work/optionset_experiments] rkward: Don't show add / remove buttons for driven optionsets.
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Oct 28 21:05:44 UTC 2015
Git commit bb8e48372e4d877ad44f25ca668c11ef44b2df9d by Thomas Friedrichsmeier.
Committed on 28/10/2015 at 21:05.
Pushed by tfry into branch 'work/optionset_experiments'.
Don't show add / remove buttons for driven optionsets.
M +10 -2 rkward/misc/rkaccordiontable.cpp
M +1 -3 rkward/misc/rkaccordiontable.h
M +1 -1 rkward/plugin/rkoptionset.cpp
http://commits.kde.org/rkward/bb8e48372e4d877ad44f25ca668c11ef44b2df9d
diff --git a/rkward/misc/rkaccordiontable.cpp b/rkward/misc/rkaccordiontable.cpp
index 604ed2b..71bd0f9 100644
--- a/rkward/misc/rkaccordiontable.cpp
+++ b/rkward/misc/rkaccordiontable.cpp
@@ -237,10 +237,19 @@ RKAccordionTable::~RKAccordionTable () {
delete editor_widget_container;
}
+void RKAccordionTable::setShowAddRemoveButtons (bool show) {
+ RK_TRACE (MISC);
+ show_add_remove_buttons = show;
+ pmodel->add_leading_columns = show;
+ pmodel->add_trailing_rows = show;
+}
+
QSize RKAccordionTable::sizeHintWithoutEditor () const {
RK_TRACE (MISC);
- return (QSize (minimumSizeHint ().width (), horizontalScrollBar ()->minimumSizeHint ().height () + sizeHintForRow (0) * 4));
+ // NOTE: This is not totally correct, but seems to be, roughly. indexRowSizeHint() works (of sorts), even if there is no row in the model
+ // while sizeHintForRow(0) does not.
+ return (QSize (minimumSizeHint ().width (), horizontalScrollBar ()->sizeHint ().height () + indexRowSizeHint (model ()->index (0, 0)) * 4));
}
QSize RKAccordionTable::sizeHint () const {
@@ -418,7 +427,6 @@ void RKAccordionTable::setModel (QAbstractItemModel* model) {
// TODO
-// - insertion when now row is available, yet
// - index column, and sets without manual add / remove
// - expand / collapse indicator?
// - drag-reordering?
diff --git a/rkward/misc/rkaccordiontable.h b/rkward/misc/rkaccordiontable.h
index 031579d..9f3f249 100644
--- a/rkward/misc/rkaccordiontable.h
+++ b/rkward/misc/rkaccordiontable.h
@@ -32,9 +32,7 @@ public:
QWidget *editorWidget () const { return editor_widget; };
void setModel (QAbstractItemModel *model);
- void setShowAddRemoveButtons (bool show) {
- show_add_remove_buttons = show;
- }
+ void setShowAddRemoveButtons (bool show);
QSize sizeHint () const; // reimplemented to assure a proper size for the content
public slots:
diff --git a/rkward/plugin/rkoptionset.cpp b/rkward/plugin/rkoptionset.cpp
index 056c69d..a1ffc29 100644
--- a/rkward/plugin/rkoptionset.cpp
+++ b/rkward/plugin/rkoptionset.cpp
@@ -193,8 +193,8 @@ RKOptionSet::RKOptionSet (const QDomElement &element, RKComponent *parent_compon
connect (remove_button, SIGNAL (clicked()), this, SLOT (removeRow()));
}
}
- if (!keycolumn && (exp_mode == Accordion)) accordion->setShowAddRemoveButtons (true);
if (exp_mode == Accordion) {
+ accordion->setShowAddRemoveButtons (!keycolumn);
accordion->setModel (model);
if (display) display->hide ();
}
More information about the rkward-tracker
mailing list