From 5db787d8b88e214c89b8e02eaf619d18914e8571 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 6 Sep 2012 03:12:37 +0200 Subject: got the crazy LSSetEditor class working --- lsseteditor.h | 21 ++++++++++++++++----- 1 file 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 +class LSSetEditor; + template class LSSetEntryEditorBase : public _LSSetEntryEditorBaseBase { protected: explicit LSSetEntryEditorBase(QWidget *parent = 0) : _LSSetEntryEditorBaseBase(parent) { } -private: - void setCurrentEntry(TData &entry); - // what?? - //friend class LSSetEditor >; +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 *checkMe = w; connect(checkMe, SIGNAL(dataEdited()), SIGNAL(dataEdited())); } @@ -93,6 +102,7 @@ public: protected: QList *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); } } }; -- cgit v1.2.3