views:

90

answers:

1

I'm currently trying to get into QT4 and figure out a workflow for myself.

While trying to create a widget which allows the user to connect to a hostname:port some questions appeared. The widget itself contains a LineEdit for entering the hostname, a SpinBox for entering the port and a PushButton which should emit a connect(QString hostname, unsigned int port) signal.

In QTDesigner I created the necessary Form. It is saved as a .ui-File. Now the big question is how could I implement the widget? Is there a place in QTDesigner where I could add my signal to the Widget? Where could I add custom Properties?

I've learned in another tutorial, which showed how to create a Widget in C++, how signals, slots, Q_PROPERTIES etc are defined and added to the widget. But there is no sourcecode in QTDesigner.

Another option would be to generate sourcecode using uic. But the header says, that another generate would overwrite any changes to the sourcefiles.

So how can I create a QT-widget completely with my own signals, slots and properties by using the QTDesigner for creating the UI and not having to recode everything whenever the UI is changing. Is there some kind of Roundtrip-Engineering?

If thats not possible: Whats the sense of creating a Widget with QTDesigner then?

+1  A: 

I think I've found the answer myself. (Why does it need 2-3h of reading through tutorials etc until I give up and ask the question at Stackoverflow and then 5min after continuing to search, I find the solution myself? -.-)

I think the chapter of the QT-Documentation is describing how to use uic-generated files in an own widget in a usable way. http://doc.qt.nokia.com/4.0/porting4-designer.html#uic-output

My next step will be to use the second approach to create a Widget with my needed signal and properties.

MOnsDaR
"and then 5min after continuing to search, I find the solution myself?" Happens to me *all the time*. I guess it is because writting down the question forces you to think differently, and often helps.
ereOn