Results 1 to 4 of 4

Thread: Access objects inside QStackedWidget widgets.

  1. #1
    Join Date
    May 2010
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Access objects inside QStackedWidget widgets.

    Hi guys, I need your help.

    I have 2 QWidget Forms (form1, Form2) within a QStackedWidget (formstack); the attached project has two problems:

    1) within Form1, I can’t access objects inside QStackedWidget father (formstack).
    2) within Form2, I can’t access objects inside Form1.

    Thank you in advance for your help.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Access objects inside QStackedWidget widgets.

    Please only post in one forum. We read all! You have two possibilities: pass pointers around, which is the worst solution, or better use the signal slot mechanism to "transfer" informations between widgets.

  3. #3
    Join Date
    May 2010
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Access objects inside QStackedWidget widgets.

    Lykurg, can you show me a code sample? (or edit my code). Tks.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Access objects inside QStackedWidget widgets.

    Quote Originally Posted by Trader View Post
    Lykurg, can you show me a code sample? (or edit my code). Tks.
    No, try yourself first. And for this
    Qt Code:
    1. stackedWidget->setCurrentIndex(stackedWidget->indexOf(form1));
    To copy to clipboard, switch view to plain text mode 
    better use QStackedWidget::setCurrentWidget().

Similar Threads

  1. Access objects inside QStackedWidget widgets.
    By Trader in forum Qt Programming
    Replies: 0
    Last Post: 25th July 2010, 17:10
  2. Replies: 4
    Last Post: 11th July 2007, 04:21
  3. All widgets are visible in QStackedWidget
    By YuriyRusinov in forum Qt Programming
    Replies: 14
    Last Post: 22nd March 2007, 12:02
  4. How to access MainWindow objects.
    By Doug Broadwell in forum Newbie
    Replies: 1
    Last Post: 3rd November 2006, 10:03
  5. declaring objects inside Designer
    By mickey in forum Qt Tools
    Replies: 8
    Last Post: 14th March 2006, 17:25

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.