[Interest] Change widget type of Qt Creator Form Class
John Weeks
john at wavemetrics.com
Fri Apr 11 20:57:54 CEST 2014
We often just edit the .ui file. It's XML and not too hard to comprehend. You probably have to change it in a couple places.
-John Weeks
On Apr 11, 2014, at 11:38 AM, Murphy, Sean <smurphy at walbro.com> wrote:
> Is there a way to easily change the base class of a Qt Designer Form Class?
>
> I created a new custom widget using Qt Creator’s “Add New…->Qt->Qt Designer Form Class” wizard. At the time, I chose “Widget” as my form template. So at the end of that sequence I ended up with myWidget.h, myWidget.cpp, and myWidget.ui. I then added some code. Then I realized that I should have had the custom widget inherit from QFrame, not QWidget. Is there an easy way to make that switch now that code is already written?
>
> In the .h and .cpp file, it’d be trivial to do a find & replace of QWidget -> QFrame, but I’m not seeing an easy way to change the base widget type in the designer UI using the UI controls. I’m assuming I could hack the raw XML in the .ui file and change the line:
> <widget class="QWidget" name="myWidget">
> To:
> <widget class="QFrame" name="myWidget">
>
> But that seems like a bit of a hack, and maybe that’s not even sufficient?
> Sean
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list