PDA

View Full Version : QwtPlot - promote to custom widget



MrGarbage
20th April 2007, 18:32
Hi,
I am using qwt and have successfully integrated this into my QT designer such that
I can choose and use a QwtPlot widget from the QT toolbox.

I want to be able use my own class derived from QwtPlot. Ideally I would
move a QwtPlot from the toolbox onto my form, right click and choose Promote to Custom widget.

This option is not available when I right click on a QwtPlot object.
I don't want to do a plug-in, at least not at this stage of the game.

How can I use both QT Designer and my own class derived from QwtPlot?

Thank you!

marcel
20th April 2007, 22:03
In the dialog class add a member of your QwtPlot subclass and cast the Ui QwtPlot widget from the dialog to your custom widget. Use this custom widget throughout the app, instead of the Ui member.

This is almost identical to promoting to custom widget ,except that ui_xxx.cpp will know nothing about your custom class. Nothing wrong with that, in my opinion...

Regards

codebehind
27th April 2007, 16:47
I am using qwt and have successfully integrated this into my QT designer such that
I can choose and use a QwtPlot widget from the QT toolbox.
Excuse my small knowledge about Qt Designer.
How can i add qwt widgets to Tools in QtDesigner?

jiapei100
24th October 2009, 07:18
Yup
Exactly the same question here.

QWT is installed correctly.

But, in Designer, there is nothing to promote for QWT ....


Cheers
JIA Pei

jord
25th October 2009, 01:50
I had the same problem. I just use a QWidget item in Qt Designer instead of a QwtPlot item. I then promote the QWidget item to my custom QwtPlot item. Works great.

Carlton
15th September 2010, 22:43
I had the same problem. I just use a QWidget item in Qt Designer instead of a QwtPlot item. I then promote the QWidget item to my custom QwtPlot item. Works great.
Apologies for adding to this old thread, Could someone provide an example of the correct syntax to promote the QWidget to my custom QwtPlot class?

FelixB
8th October 2010, 10:13
Apologies for adding to this old thread, Could someone provide an example of the correct syntax to promote the QWidget to my custom QwtPlot class?

thats easy:

* in the qtdesigner, put a QWidget as placeholder on your widget (can be any class derived by qwidget, I usually take a QListView)
* rightclick on this QWidget you'd like to promote
* in the contextmenu, choose "promote to..."
* fill in your custom class name (e.g. "MyCustomQwtPlot") and the header file your class is located in (e.g. "MyCustomQwtPlot.h")
* press enter and the "Promote" button gets enabled
* click this button and everything should work :)

gbruti
10th February 2011, 10:12
i have done this in following way:

-manually edit *.ui file
-find tag customwidgets
-add sub tag
<customwidget>
<class>QwtPlotEx</class>
<extends>QwtPlot</extends>
<header>qwt_plotex.h</header>
</customwidget>
-save
-open this file in "QT designer"
-promote QwtPlot to QwtPlotEx !!
-create qwt_plotex.h and qwt_plotex.cpp