Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Query regarding aboutToShow signal of Qmenu widget.
Forum Updated to NodeBB v4.3 + New Features

Query regarding aboutToShow signal of Qmenu widget.

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ayush Gupta
    wrote on last edited by
    #3

    @Ratzz But that action will displayed as drop down of About. I don't want that I just when I click About it should display the dialog box irrespective if we click other menu items.

    RatzzR 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #4

      But that action will displayed as drop down of About.

      Not sure what you have done & indented to do. If your intent is to show the dialog when you click on about action, as @Ratzz suggested, you can add three different actions & connection to slot. Inside the slot you can show any dialog you want. If not show the image of what you are planning to achieve.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Ayush Gupta
        wrote on last edited by
        #5

        @dheerendra I mean if I add action in About it will show context menu when I click on About.
        Suppose I added Action About1 in About then when I click About it will show About1 as context Menu option. as per my understanding?

        If not please let me know how can I add action and it should be not visible in UI and just clickin on About it will show dialog...how can i do this through programming

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #6

          Add this in construction.
          connect(ui->aboutAction,&QAction::triggered, this,&MyWidget::showAbout)

          MyWidget::showAbout() {
          // Create any dialog
          // show it
          }

          You can connect signal/slot from Designer also. I'm showing you example from code.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Ayush Gupta
            wrote on last edited by
            #7

            @dheerendra I am using design view. And I do not want that action to be displayed in menu. Where and how should i create the action and attach to the about menu.

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #8

              How are you adding the about menu option ? Can you tell ?

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply
              0
              • A Ayush Gupta

                @Ratzz But that action will displayed as drop down of About. I don't want that I just when I click About it should display the dialog box irrespective if we click other menu items.

                RatzzR Offline
                RatzzR Offline
                Ratzz
                wrote on last edited by Ratzz
                #9

                @Ayush-Gupta said in Query regarding aboutToShow signal of Qmenu widget.:

                when I click About it should display the dialog box irrespective if we click other menu items.

                U can create an QAction to the menubar directly.
                Your About menu will always be the last menu . Just try to add from code and connect to aboutclick()

                --Alles ist gut.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Ayush Gupta
                  wrote on last edited by
                  #10

                  @dheerendra I am adding through design view of QT.

                  @Ratzz Can I add QAction to the About menu using progamming even I if i am using design view

                  RatzzR 1 Reply Last reply
                  0
                  • A Ayush Gupta

                    @dheerendra I am adding through design view of QT.

                    @Ratzz Can I add QAction to the About menu using progamming even I if i am using design view

                    RatzzR Offline
                    RatzzR Offline
                    Ratzz
                    wrote on last edited by Ratzz
                    #11

                    @Ayush-Gupta said in Query regarding aboutToShow signal of Qmenu widget.:

                    Can I add QAction to the About menu using progamming even I if i am using design view

                    I think u can do in two ways
                    1)Using Code

                     QMenuBar *m = this->menuBar();
                     QAction *aboutMenu = new QAction("About");
                     connect(aboutMenu, &QAction::triggered, this, &MainWindow::aboutclick);
                     m->addAction(aboutMenu);
                    
                    1. Using designer- Add an menu then connect to your slot
                    connect(ui->menuAbout,&QMenu::aboutToShow,this,&MainWindow::aboutclick);

                    --Alles ist gut.

                    1 Reply Last reply
                    1
                    • dheerendraD Offline
                      dheerendraD Offline
                      dheerendra
                      Qt Champions 2022
                      wrote on last edited by
                      #12

                      Can I add QAction to the About menu using progamming even I if i am using design view

                      You can do it. That is the code I wrote and showed you.

                      Dheerendra
                      @Community Service
                      Certified Qt Specialist
                      http://www.pthinks.com

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved