Results 1 to 6 of 6

Thread: Promoting to Multiple Custom Widgets

  1. #1
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Promoting to Multiple Custom Widgets

    Hello,

    I am using QT Eclipse for my project, In my screen 75% of the screen in for opengl window and remaining is for other stuff..
    Now, for Opengl window creation, I have dragged the widget(Which is actually an QWidget) and I promoted it to my custom widget which is called "GLWidget" which is extended from QGLWidget.
    I need to switch between different screens, I mean different opengl drawing stuff depending on some notifications. I wanted to do it as same as I did it for GLWidget.

    My Question here is, Would it be possible to promote to multiple custom widgets for the same GL window(Ex: GLWidget, GLWidget2 ..)
    which I can decide at runtime to which widget to be used?

    EX:
    IF(1)
    promote to GLWidget(using the GLWidget instance for drawing)
    else
    Promote to GLWIdget2(using the GLWidget2 instance for drawing)

    A state machine kind of thing.

    Thanks in Advance!

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Promoting to Multiple Custom Widgets

    Can't you just add the widgets to layout at runtime ?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Promoting to Multiple Custom Widgets

    ... or put them both in a QStackedWidget and toggle them that way.

  4. #4
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Promoting to Multiple Custom Widgets

    Thanks for the response!

    @stampede: I am not sure about that..But I tried doing that by creating multiple widgets extended from QGLwidget, Problem was it will overwrite the other, I sometimes need 2 widgets to be active in the same portion of the window..like, I have some common display artifacts which would be combined with other display artifacts and altogether would make one feature.

    @Chrisw67: I need to understand how QStackedWidget works. Can I keep say around 5 QGLwidgets in the same portion of the window and toggle them and sometimes multiple instances?

    I think if I can avoid the overdrawing on top of another, which is currently hiding the below widgets draw functions I should be able to achieve what I want easily. I mean if all these widgets works together depending on active instance.

    Any suggestions??

    Thanks in Advance!

  5. #5
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Promoting to Multiple Custom Widgets

    I think if I can avoid the overdrawing on top of another
    Use layouts and nothing like that will happen.
    Maybe I didn't understand you correctly, can you attach a picture of how it should look like ?

  6. #6
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Promoting to Multiple Custom Widgets

    I am not able to attach the picture..wil try it later.
    basically its something like screens must be developed using opengl in the middle of the screen which takes 600*600 out of 800*600 portion of the screen.
    For doing this I need to switch between different opengl screens dynamically depending on the feature that is active or requested for. Its an Navigation app where user would set the destination and through that search and calculation status would be shown in the screen with opengl and along with that some polygons and some curves which looks like some roads and pavements would be shown..

    I hope you got what I am trying to do.

    And what layouts you are talking about? I have only one layout (same portion) where all the stuff must be drawn.

    Thanks!

Similar Threads

  1. Replies: 1
    Last Post: 23rd December 2010, 09:35
  2. Promoting to custom widget
    By cia.michele in forum Newbie
    Replies: 2
    Last Post: 26th September 2010, 11:38
  3. Replies: 3
    Last Post: 10th December 2009, 22:53
  4. Error when promoting a custom widget
    By engin in forum Qt Tools
    Replies: 1
    Last Post: 15th December 2006, 16:00
  5. Promoting a custom widget derived from QWidget Qt4
    By high_flyer in forum Qt Tools
    Replies: 1
    Last Post: 2nd March 2006, 18: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.