diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 12:23:39 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 12:23:39 -0500 |
| commit | 93c044d399e138b05e3c9b0119e638413e81b620 (patch) | |
| tree | b58a9916a4a4eedf0640ed9d5c03779171cbd6e9 /sigmodr/widgets/MapWildListUI.cpp | |
| parent | 4a2e1b318419361fb814581aab583f7d856b7149 (diff) | |
| download | sigen-93c044d399e138b05e3c9b0119e638413e81b620.tar.gz sigen-93c044d399e138b05e3c9b0119e638413e81b620.tar.xz sigen-93c044d399e138b05e3c9b0119e638413e81b620.zip | |
MOre cleanups to runtime ui loading
Diffstat (limited to 'sigmodr/widgets/MapWildListUI.cpp')
| -rw-r--r-- | sigmodr/widgets/MapWildListUI.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sigmodr/widgets/MapWildListUI.cpp b/sigmodr/widgets/MapWildListUI.cpp index 8e2984e0..376412b3 100644 --- a/sigmodr/widgets/MapWildListUI.cpp +++ b/sigmodr/widgets/MapWildListUI.cpp @@ -21,20 +21,32 @@ // Sigmod includes #include <sigmod/MapWildList.h> +// KDE includes +#include <KLineEdit> + +// Qt includes +#include <QtCore/QFile> +#include <QtUiTools/QUiLoader> + Sigmodr::Widgets::MapWildListUI::MapWildListUI(Sigmod::MapWildList* wildList, QWidget* parent) : ObjectUI(parent) { - setupUi(this); setObjects(wildList, new Sigmod::MapWildList(*wildList)); } -Sigmodr::Widgets::MapWildListUI::~MapWildListUI() +void Sigmodr::Widgets::MapWildListUI::initGui() { + QFile file(":/gui/mapwildlist.ui"); + file.open(QFile::ReadOnly); + QWidget *formWidget = QUiLoader().load(&file, this); + file.close(); + ui_name = formWidget->findChild<KLineEdit*>("varName"); + connect(ui_name, SIGNAL(textChanged(QString)), this, SLOT(nameChanged(QString))); } void Sigmodr::Widgets::MapWildListUI::setGui() { - varName->setText(qobject_cast<Sigmod::MapWildList*>(modified())->name()); + ui_name->setText(qobject_cast<Sigmod::MapWildList*>(modified())->name()); } void Sigmodr::Widgets::MapWildListUI::apply() @@ -50,7 +62,9 @@ void Sigmodr::Widgets::MapWildListUI::discard() emit(changed(false)); } -void Sigmodr::Widgets::MapWildListUI::on_varName_textChanged(const QString& name) +void Sigmodr::Widgets::MapWildListUI::nameChanged(const QString& name) { + const int cursor = ui_name->cursorPosition(); qobject_cast<Sigmod::MapWildList*>(modified())->setName(name); + ui_name->setCursorPosition(cursor); } |
