[Solved] Qt Designer - embedded ui
-
Hello, World! :-D
well I have the following problem:
I created a Widget (the main one as QWidget) and designed the ui with Qt Designer. I have custom components in that Widget. For now, the custom components are just buttons (QPushButton) but there will be more advanced and personalized ones later, so I have to extract those components to an extra class. Using Qt Designer, I drop those custom components using the QWidget component and I use the Widget Promotion technique. The functionality works fine this way. So far so good.
Now! I want to create a custom template for the appearance and layout of the custom component (I mean I need a custom *.ui file for just that sub-component that I want later to drop into the main layout many times) and of course I want to use Qt Designer for this. So let stick with the simple "customized QPushButton" (of course I actually need this for more complicated stuff).
-
First problem: Qt Designer doesn't allow the creation of a QPushButton (because that's the element I want the *.ui for) as top level element. If I just use QWidget, I can not change it to QPushButton. As workaround I edited the *.ui file by hand and changed the type. Ok, Qt Designer recognised it afterwards. But...
-
Second (and main) problem: I can not promote the top level widget to my custom-widget-class. I need to do this, so I can drop the custom element in another widget, and the droped in element uses it's own *.ui class.
I'm not really new to Qt, but I am absolutely new to the *.ui and qt-xml-stuff. I can achieve the result I want very easily with standard C++-coding, but as the project grows, I guess It is wise to use the Qt-Designer technique.
So is there a solution to my problem. Did I miss something?
Sorry for the bad english, I'm not a native english speaker.
Pat
[edit: [solved] added in title to show how we do that, Eddy]
-
-
have a look at "this topic":http://developer.qt.nokia.com/forums/viewthread/6536.
It is similar to what you want.
-
Exactly what I was looking to achieve. It seems to work now.
Thank you very much!
How do I close the topic?
-
Well you don't have to "close" it. We are happy when you edit your title and add [solved] in front of it. There is no button at this moment to do that yet.the site is still beta ;)
In the future the Trolls can pass through all titles and add the mark programmatically using that search string.
-
Roger that! Thx again.