Results 1 to 2 of 2

Thread: [QStackedWidget] adding widget to existing page

  1. #1
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default [QStackedWidget] adding widget to existing page

    Hello!

    I'm trying to add widget to an existing page of QStackedWidget. My code:

    Qt Code:
    1. widgetPointer = new myWidget(this);
    2. widgetPointer->setLayout(ui->widgetLayout);
    3. widgetPointer->setGeometry(QRect(0,0,430,310));
    4. ui->stackedWidget->insertWidget(0, widgetPointer);
    5. wykresStan->move(QPoint(0,0));
    To copy to clipboard, switch view to plain text mode 

    Widget adds to QStackedWidget but it also creates new page with index '0'. And my '0' page is now '1'. I've tried:

    Qt Code:
    1. widgetPointer = new myWidget(ui->widgetLayout);
    To copy to clipboard, switch view to plain text mode 

    But widget added 'on top' of QStackedWidget. Any ideas?

    thanks in advance
    best regards
    Tomasz

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


  3. #2
    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: [QStackedWidget] adding widget to existing page

    Add the widget to the page and not to the stacked widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. The following 3 users say thank you to wysota for this useful post:

    Tomasz (3rd December 2010)

Similar Threads

  1. Replies: 7
    Last Post: 15th May 2014, 20:29
  2. Multi-page application and QStackedWidget
    By Mek82 in forum Qt Programming
    Replies: 10
    Last Post: 31st October 2010, 23:06
  3. Adding custom widget to an existing layout
    By santana in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2010, 18:29
  4. adding dll to existing project...
    By aj2903 in forum Qt Programming
    Replies: 1
    Last Post: 1st December 2009, 10:35
  5. QStackedWidget page with different size
    By nina1983 in forum Qt Tools
    Replies: 1
    Last Post: 26th July 2008, 11:58

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.