summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-06 03:12:37 +0200
committerTreeki <treeki@gmail.com>2012-09-06 03:12:37 +0200
commit5db787d8b88e214c89b8e02eaf619d18914e8571 (patch)
tree5d119ab6ad2a082d00d1b11b18890ff1f7a7b6f4
parent2e52bea24a65cf70380c4e13c2f9f1238f023e91 (diff)
downloadLayoutStudio-5db787d8b88e214c89b8e02eaf619d18914e8571.tar.gz
LayoutStudio-5db787d8b88e214c89b8e02eaf619d18914e8571.zip
got the crazy LSSetEditor class working
-rw-r--r--lsseteditor.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/lsseteditor.h b/lsseteditor.h
index a89131d..747f07d 100644
--- a/lsseteditor.h
+++ b/lsseteditor.h
@@ -15,17 +15,23 @@ signals:
void dataEdited();
};
+// class prototype
+template <typename TData, typename TWidget>
+class LSSetEditor;
+
template <typename TData>
class LSSetEntryEditorBase : public _LSSetEntryEditorBaseBase {
protected:
explicit LSSetEntryEditorBase(QWidget *parent = 0) :
_LSSetEntryEditorBaseBase(parent) { }
-private:
- void setCurrentEntry(TData &entry);
- // what??
- //friend class LSSetEditor<TData, LSSetEntryEditorBase<TData> >;
+public:
+ void setCurrentEntry(TData &entry) {
+ m_currentEntry = &entry;
+ loadEntryFrom(entry);
+ }
+private:
TData *m_currentEntry;
protected:
@@ -74,6 +80,9 @@ public:
TWidget *w = new TWidget(this);
setup(w);
+ m_setEditorWidget = w;
+ m_typedSetEditorWidget = w;
+
LSSetEntryEditorBase<TData> *checkMe = w;
connect(checkMe, SIGNAL(dataEdited()), SIGNAL(dataEdited()));
}
@@ -93,6 +102,7 @@ public:
protected:
QList<TData> *m_data;
+ TWidget *m_typedSetEditorWidget;
void changeEntryCountTo(int count) {
m_loadingThings++;
@@ -137,7 +147,8 @@ protected:
if (index == -1) {
m_setEditorWidget->setEnabled(false);
} else {
- const TData &entry = m_data->at(index);
+ TData &entry = (*m_data)[index];
+ m_typedSetEditorWidget->setCurrentEntry(entry);
}
}
};