Results 1 to 4 of 4

Thread: Do you have to use Layout management to show the QwizardPage contents?

  1. #1

    Default Do you have to use Layout management to show the QwizardPage contents?

    I create a page named TestPage, this is its constructor:
    Qt Code:
    1. TestPage::TestPage(QWidget *parent)
    2. :QWizardPage(parent)
    3. {
    4. QPushButton *button = new QPushButton("Start");
    5. QVBoxLayout *layout = new QVBoxLayout;
    6.  
    7. layout->addWidget(button);
    8. setLayout(layout);
    9. }
    To copy to clipboard, switch view to plain text mode 
    When I run it, the button appears on the page. However, if I do the following…
    Qt Code:
    1. TestPage::TestPage(QWidget *parent)
    2. :QWizardPage(parent)
    3. {
    4. QPushButton *button = new QPushButton(this);
    5. }
    To copy to clipboard, switch view to plain text mode 
    …the button is invisible. So, to show the page contents do I need to use layout management? Or is there another way to implement displaying a button or other widgets without using layout management ?

    Thanks in advance

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Do you have to use Layout management to show the QwizardPage contents?

    To put it other way around, why wouldn't you use layout management?
    J-P Nurmi

  3. #3

    Default Re: Do you have to use Layout management to show the QwizardPage contents?

    Thanks for the reply!

    I am running into some problems using layout management. I have attached a picture for reference. I display a PCB image in a Qlabel, and have added six other Qlabel objects in the foreground. I used Qlabel->setPixmap to draw the blue rectangles on top of the background, and I want the six rectangles to be able to change their properties, such as color, at a fixed rate which will inidicate the card’s status. I’ve had some trouble using layout management to arrange my widgets like this. Is it possible to arrange my widgets like that using layout management, or is there some other way to implement what I have specified?

    Any suggestions would be appreciated!
    Attached Images Attached Images

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Do you have to use Layout management to show the QwizardPage contents?

    I'd implement it as a single custom widget, but you can also create a custom layout or reimplement resizeEvent() for your widget and move the items around yourself using QWidget::setGeometry(). It should be also achievable using a grid layout with spacers.

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.