Results 1 to 7 of 7

Thread: Promoted widget doesn't show when application is launched

  1. #1
    Join Date
    Nov 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Promoted widget doesn't show when application is launched

    Hi everyone,

    This is the first time i use the promotion functionality in QtDesigner. I designed the main window in QtDesigner, and reserved the right side of it for a custom subclass of QWidget. I tested this custom subclass of QWidget by show it from the main, everything was fine.
    After promoting a QWidget to this custom subclass in QtDesigner, the custom widget doesn't show at launch time. Any clue why this could happen?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Promoted widget doesn't show when application is launched

    How did you test from main? Does the main (parent) widget show up?

  3. #3
    Join Date
    Nov 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Promoted widget doesn't show when application is launched

    Hi!

    Thks for your reply!
    I tested from main by constructing the custom widget and showing it directly from main.cpp, bypassing the parent widget (MainWindow).
    Instead, what i would like to do is to construct my MainWindow from main.cpp and then MainWindow takes charge of the custom widget, not mentionned in main.cpp. But when i do like this, only the parent widget shows up (MainWindow), and the custom widget doesn't appear in MainWindow.
    I didn't solve it yet, so any hints more welcome than welcome!

  4. #4
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Platforms
    Unix/X11 Windows

    Default Re: Promoted widget doesn't show when application is launched

    make sure you embedded your custom widget into a layout (in designer)

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Promoted widget doesn't show when application is launched

    And did you call QMainWindow::setCentralWidget() with a pointer to your custom widget instance?

  6. #6
    Join Date
    Nov 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Promoted widget doesn't show when application is launched

    Hi!

    First thks guys for your hints.

    1) Unfortunately my main window already has a layout. See the screen capture attached from QtDesigner. I don't see any errors here, otherwise you can tell me.
    ScreenCapture.jpg

    2) Also, MainWindow->setCentralWidget(centralWidget); is done from the automatically generated ui_mainwindow.h. Central Widget is shown on the screen at execution time, but only part of it is not shown (last line of the top right corner of the screenshot : widget, which was promoted as SampleWidget from QWidget).

    i hope to find the solution to this mystery to me!
    Last edited by cel; 16th November 2011 at 12:51.

  7. #7
    Join Date
    Nov 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Promoted widget doesn't show when application is launched

    Hi everyone!

    I figured out my mistake : the custom widget, in its own .ui file, had a broken layout icon. I chose a layout for it, and now the widget shows up in main window.

    Thank you for your help!
    Last edited by cel; 24th November 2011 at 11:03.

Similar Threads

  1. Why dont see a Custom Widget Promoted ?
    By tonnot in forum Newbie
    Replies: 1
    Last Post: 27th October 2010, 14:24
  2. Application running but doesn't show up!!!
    By joandelason in forum Newbie
    Replies: 4
    Last Post: 21st March 2010, 10:37
  3. Custom Widget doesn t show.
    By Frej in forum Qt Tools
    Replies: 12
    Last Post: 11th March 2010, 11:48
  4. QMainWindow and custom widget doesn't show
    By Peppy in forum Qt Programming
    Replies: 9
    Last Post: 26th December 2009, 16:09
  5. Corner widget in QTabWidget doesn't show up
    By ePharaoh in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2006, 18:02

Tags for this Thread

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.