Results 1 to 5 of 5

Thread: Popup Menu For Tool Button

  1. #1
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Popup Menu For Tool Button

    I have a groupbox with few Icon Buttons, it has to be displayed as a popup menu when clicked on the ToolButton. How can I do this in Qt?
    I have connected the Click to a Function:

    connect(ui.toolButton_29, SIGNAL(clicked()),this, SLOT(openDialog()));

    Class::class()

    ui.groupBox->hide();

    void Class:: openDialog()
    ui.groupBox->show();

    The GroupBox is displayed when the ToolButton is Clicked but it is shown Under other widgets. I ant it to be displayed at the top of other widgets. I would be really glad to seek help.

    Thank you in Advance!

  2. #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: Popup Menu For Tool Button

    Not sure what you mean but if you want the box to be displayed as a floating widget on top of some other window, set a Qt::Popup flag on it.
    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.


  3. #3
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Popup Menu For Tool Button

    Hello!! I want that as a Popup on a toolBox when the button is clicked. But, there is no setViewMode in ui.groupbox to set the widget to Popup. Could you provide a snippet?
    Last edited by Veera; 2nd June 2017 at 08:21.

  4. #4
    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: Popup Menu For Tool Button

    setWindowFlags(Qt::Popup). The widget should not have a parent and you will have to control its geometry by hand.
    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.


  5. #5
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Popup Menu For Tool Button

    Thank you very much @Wysota. It worked fine!

Similar Threads

  1. One popup menu added to few tool buttons
    By atomic in forum Qt Programming
    Replies: 9
    Last Post: 13th August 2014, 13:25
  2. Replies: 2
    Last Post: 11th May 2012, 11:38
  3. Popup Menu
    By kavinsiva in forum Newbie
    Replies: 2
    Last Post: 25th September 2009, 11:09
  4. Replies: 3
    Last Post: 17th May 2009, 21:17
  5. QPushButton PopUp menu
    By Preeteesh in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2008, 18:03

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.