Results 1 to 13 of 13

Thread: TabWidget's Tab's parent

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2008
    Posts
    61
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    9

    Default Re: TabWidget's Tab's parent

    Spirit thanks for your interest.

    First I shall describe the reason for doing such a thing. I have created a custom widget and part of it hides all the windows related to the widget it is located. So I connect one of its clicked() signals to the underlying QMainWindow but the level of the QMainWindow is not known to the widget. So I traverse the parents.

    On the constructor of the widget, I traverse the parents but since during the construction, the page is not added to the tab widget, and so the parent is absent.

    So, what I have to do is I should trigger a slot of my custom widget to make the connections to the QMainWindow when setupUi is finished.

    Is it possible to achieve this? Or can I change the order of the construction of the ui_XXX.h files.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: TabWidget's Tab's parent

    Quote Originally Posted by alisami View Post
    Or can I change the order of the construction of the ui_XXX.h files.
    chaching something in ui_xxx.h it's bad idea, because this file is generated automatically by uic, so when you change you ui file, ui_xxx.h will be regenerated and all data which you added will be lost.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: TabWidget's Tab's parent

    Quote Originally Posted by alisami View Post
    Is it possible to achieve this?
    so, create method in QMainWindow which will return your tabwidget.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. #4
    Join Date
    May 2008
    Posts
    61
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    9

    Default Re: TabWidget's Tab's parent

    The problem is that the custom widget will be inserted to various places. Not only to a tabwidget. I just don't want to add some code to every widget containing my custom widget. So I decided to add a flag to my custom flag to see if the QMainWindow is successfully connected to the signal and if not, it tries to connect before firing any signals.

Similar Threads

  1. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  2. parent() heirarchy misunderstanding?
    By KShots in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2007, 18:18
  3. How to make "west" tabs horizontal?
    By plumbum in forum Qt Programming
    Replies: 2
    Last Post: 7th June 2007, 10:32
  4. Removing Tabs
    By NewGuy in forum Qt Programming
    Replies: 6
    Last Post: 22nd July 2006, 22:46
  5. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00

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.