Results 1 to 8 of 8

Thread: QAction ToolButton in toolbar triggered should open a TabWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Qt products
    Qt4 Qt5
    Platforms
    Windows
    Thanks
    92
    Thanked 16 Times in 16 Posts

    Default Re: QAction ToolButton in toolbar triggered should open a TabWidget

    If you want QTabWidget to be part of QMainWindow, then in mainwindow, do this
    Qt Code:
    1. setCentralWidget(tabWidget);
    To copy to clipboard, switch view to plain text mode 

    And if you have multiple tabs, then create a connection to open the particular tab index based on the button click signal.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: QAction ToolButton in toolbar triggered should open a TabWidget

    Since you have an action that is plugged into the toolbar, connect to the action's triggered() signal instead and let the action/toolbar internals handle the button representation,

    Cheers,
    _

  3. #3
    Join Date
    May 2013
    Location
    Schweiz
    Posts
    21
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows
    Thanked 1 Time in 1 Post

    Default Re: QAction ToolButton in toolbar triggered should open a TabWidget

    hi,

    still wondering how this issue should be approached. i'm back with more details.
    let say that my internet browser is my mainWindow.

    i have a button/link on my actual page if clicked is opening a new page in a new Tab.

    the same I would like to do with my ToolBotton. as soon as i trigger it, the Ui form constructed in a separate .ui file should open in my MainWindow, but in a new Tab.

    rawfool wrote
    create a connection to open the particular tab index based on the button click signal.
    how to do this?

  4. #4
    Join Date
    May 2013
    Location
    Schweiz
    Posts
    21
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows
    Thanked 1 Time in 1 Post

    Default Re: QAction ToolButton in toolbar triggered should open a TabWidget

    hi,

    I saw my last reply was not published in the forum list. no idea why? still hoping to receive an answer.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: QAction ToolButton in toolbar triggered should open a TabWidget

    What do you have so far?

    Do you have a tab widget as your window's central widget?
    Do you have the action in the toolbar?
    Do you have a slot connected to the action's triggered() signal?
    Do you have the import for the widget you want to show on the new tab?
    Does your slot create an instance of that widget?
    Does your slot then add the widget to the tab widget?

    Cheers,
    _

Similar Threads

  1. Replies: 3
    Last Post: 10th April 2013, 17:01
  2. QAction, triggered signal dont call a slot
    By kaszewczyk in forum Newbie
    Replies: 6
    Last Post: 5th October 2010, 21:30
  3. Replies: 8
    Last Post: 10th December 2009, 10:06
  4. how exclusive toolbutton in toolbar
    By irmakci in forum Qt Programming
    Replies: 2
    Last Post: 30th July 2008, 22:33
  5. Replies: 2
    Last Post: 27th February 2007, 21:06

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.