Results 1 to 8 of 8

Thread: signal acrorss different QStacked Widgets

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    12
    Thanks
    4
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: signal acrorss different QStacked Widgets

    Ok. I found a workaround solution, maybe not the most elegant but It works.

    Qt Code:
    1. QObject *obj = parent->findChild<QTabWidget*>("pagesTabWidget");
    2. QTabWidget *tab = qobject_cast<QTabWidget*>(obj);
    3. tab->setCurrentIndex(1);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,315
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: signal acrorss different QStacked Widgets

    I found a workaround solution, maybe not the most elegant but It works.
    No, it's guaranteed to crash if either the "obj" or "tab" pointers are NULL.

    Why is it so hard for people to understand that the way you avoid segfaults is to check pointers for NULL before using them?

  3. #3
    Join Date
    Mar 2011
    Posts
    12
    Thanks
    4
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: signal acrorss different QStacked Widgets

    Yes I did. Thanks.

    Quote Originally Posted by d_stranz View Post
    No, it's guaranteed to crash if either the "obj" or "tab" pointers are NULL.

    Why is it so hard for people to understand that the way you avoid segfaults is to check pointers for NULL before using them?

Similar Threads

  1. Replies: 0
    Last Post: 30th May 2013, 21:59
  2. Replies: 0
    Last Post: 30th April 2012, 15:17
  3. Replies: 2
    Last Post: 12th February 2009, 22:23
  4. Replies: 6
    Last Post: 3rd September 2008, 14:27
  5. QStacked Widget.
    By csvivek in forum Qt Tools
    Replies: 1
    Last Post: 21st May 2008, 13:57

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
  •  
Qt is a trademark of The Qt Company.