QT4 Designer - Implement Widget

Posted by MOnsDaR on Stack Overflow See other posts from Stack Overflow or by MOnsDaR
Published on 2010-06-02T10:06:27Z Indexed on 2010/06/02 10:54 UTC
Read the original article Hit count: 284

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about c++

Related posts about beginner