QUiLoader with signals and slots
My project is all based on QUiLoader, ie, all interfaces are generated dynamically.
I created a form with Qt Creator for the user to enter the parameters for the database connection. When clicked [OK] data from QLineEdit should be passed to the QSettings object. How to using signals and slots with QUiLoader?
Below, my methods of reading and writing settings. writeSettings calls the settings form.
QSettings connecsettings( QSettings::IniFormat, QSettings::SystemScope, "Freedom", "TecTracker");
QHash<QString, QVariant> *parameter = new QHash<QString, QVariant>();
parameter->insert("host", connecsettings.value("host", "127.0.0.1"));
parameter->insert("port", connecsettings.value("port", 5432);
parameter->insert("user", connecsettings.value("user", "postgres"));
parameter->insert("passw", connecsettings.value("passw", "postgres"));
void DataAccess::writeSettings(QSettings* settings)
DynamicQtWidgets* guigenerator = new DynamicQtWidgets("configconnec.ui", this);
QDialog *confconnec = guigenerator->createWidget();
Searching the forum I found a similar "topic":http://qt-project.org/forums/viewthread/31605. but the answers did not help me. There is an answer stating that signals and slots can be implemented in the ui file. How to do this with Qt Creator? Would be in the "Signals & Slots Editor" tab of the designer mode?
!http://i58.tinypic.com/2mgw3l0.png(Signals & Slots Editor)!
- Get the reference of lineEdit and Button(which you click ok)
- Write your own slot in your own class file
- Connect the either lineEdit or Button signal with your slot defined in Step#2,
- Inside your slot, do whatever the custom logic required
It is not possible to do this in the ui file? Ie I create the slot in my class, but the connection to the signal leaving in the ui file?
I wanted to avoid manipulation of the GUI in code