summaryrefslogtreecommitdiffstats
path: root/sigmodr/widgets/MapWildListUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/widgets/MapWildListUI.cpp')
-rw-r--r--sigmodr/widgets/MapWildListUI.cpp22
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);
}