From 93c044d399e138b05e3c9b0119e638413e81b620 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 24 Feb 2009 12:23:39 -0500 Subject: MOre cleanups to runtime ui loading --- sigmodr/widgets/MapWildListUI.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'sigmodr/widgets/MapWildListUI.cpp') 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 +// KDE includes +#include + +// Qt includes +#include +#include + 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("varName"); + connect(ui_name, SIGNAL(textChanged(QString)), this, SLOT(nameChanged(QString))); } void Sigmodr::Widgets::MapWildListUI::setGui() { - varName->setText(qobject_cast(modified())->name()); + ui_name->setText(qobject_cast(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(modified())->setName(name); + ui_name->setCursorPosition(cursor); } -- cgit