Results 1 to 8 of 8

Thread: QwtPlot - promote to custom widget

  1. #1
    Join Date
    Mar 2007
    Posts
    74
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtPlot - promote to custom widget

    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!

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot - promote to custom widget

    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

  3. #3
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QwtPlot - promote to custom widget

    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?

  4. #4
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot - promote to custom widget

    Yup
    Exactly the same question here.

    QWT is installed correctly.

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


    Cheers
    JIA Pei
    Welcome to Vision Open
    http://www.visionopen.com

  5. #5
    Join Date
    Oct 2009
    Posts
    8
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot - promote to custom widget

    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.

  6. #6
    Join Date
    Oct 2007
    Location
    Warminster, England
    Posts
    31
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot - promote to custom widget

    Quote Originally Posted by jord View Post
    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?

  7. #7
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot - promote to custom widget

    Quote Originally Posted by Carlton View Post
    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

  8. The following 2 users say thank you to FelixB for this useful post:

    Carlton (15th February 2011), Rufone (28th February 2011)

  9. #8
    Join Date
    Feb 2011
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot - promote to custom widget

    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

  10. The following user says thank you to gbruti for this useful post:

    ken123 (20th October 2011)

Similar Threads

  1. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 07:00
  2. Replies: 1
    Last Post: 5th November 2006, 23:50
  3. Problem applying setWindowOpacity to a custom Widget
    By yellowmat in forum Qt Programming
    Replies: 8
    Last Post: 1st November 2006, 10:05
  4. Replies: 9
    Last Post: 8th May 2006, 14:21
  5. Replies: 4
    Last Post: 24th March 2006, 22:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.