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. Newbie question, first mouse click ignored in submenu
Forum Updated to NodeBB v4.3 + New Features

Newbie question, first mouse click ignored in submenu

Scheduled Pinned Locked Moved Solved General and Desktop
groupboxsubmenu
17 Posts 2 Posters 4.9k Views 1 Watching
  • 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.
  • mrjjM mrjj

    @MikeP
    Hmm. After it been shown first time, it will work all the time then ?
    Even if u click outside app and then directly to menu ?

    MikePM Offline
    MikePM Offline
    MikeP
    wrote on last edited by
    #6

    @mrjj Sorry, not entirely sure but I think clicking outside the app doesn't affect what happens when you come back to the menu providing the menu is still displayed. After a valid click the menu is hidden anyway and whenever it is re-displayed the first click is ignored.

    1 Reply Last reply
    0
    • MikePM MikeP

      @mrjj Yup!

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #7

      @MikeP said:
      hmm. it does sounds like a focus problem on initial show.

      You could try to create it visible and then override
      showEvent for mainwindow
      and there hide it.
      ( so when mainwin shows, it is still hidden)

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #8

        oh
        so it will do the same if hidden and shown again ?

        MikePM 1 Reply Last reply
        0
        • mrjjM mrjj

          oh
          so it will do the same if hidden and shown again ?

          MikePM Offline
          MikePM Offline
          MikeP
          wrote on last edited by
          #9

          @mrjj Yes

          mrjjM 1 Reply Last reply
          0
          • MikePM MikeP

            @mrjj Yes

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @MikeP said:
            Ok, sorry cant explain.
            QGroupBox must steal first click to focus.

            What widgets do u put in this QGroupBox ?

            MikePM 1 Reply Last reply
            0
            • mrjjM mrjj

              @MikeP said:
              Ok, sorry cant explain.
              QGroupBox must steal first click to focus.

              What widgets do u put in this QGroupBox ?

              MikePM Offline
              MikePM Offline
              MikeP
              wrote on last edited by
              #11

              @mrjj They are slightly modified QFrames or QLabels, the modification being to add the 'clicked' signal to the original. But setting the focus to the QGroupBox had no effect on the problem.

              mrjjM 1 Reply Last reply
              0
              • MikePM MikeP

                @mrjj They are slightly modified QFrames or QLabels, the modification being to add the 'clicked' signal to the original. But setting the focus to the QGroupBox had no effect on the problem.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @MikeP
                Hmm I tried with
                https://wiki.qt.io/Clickable_QLabel
                Which sounds like what you have but
                show/hiding the QGroupBox did not eat first click.

                I think we need a fellow Python user to find this :)
                seems not to happen in c++- well not in my sample anyway.

                MikePM 1 Reply Last reply
                0
                • mrjjM mrjj

                  @MikeP
                  Hmm I tried with
                  https://wiki.qt.io/Clickable_QLabel
                  Which sounds like what you have but
                  show/hiding the QGroupBox did not eat first click.

                  I think we need a fellow Python user to find this :)
                  seems not to happen in c++- well not in my sample anyway.

                  MikePM Offline
                  MikePM Offline
                  MikeP
                  wrote on last edited by
                  #13

                  @mrjj I have found that, once the menu is displayed, if I click in the main window before clicking in the menu then the click on the menu is accepted. Unfortunately I don't have enough experience of Python to know where to go next, I'll keep trying odds and sods in the meantime.

                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #14

                    It really sounds like it just dont have
                    focus. but it should.
                    Well im even bigger python noob :)

                    MikePM 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      It really sounds like it just dont have
                      focus. but it should.
                      Well im even bigger python noob :)

                      MikePM Offline
                      MikePM Offline
                      MikeP
                      wrote on last edited by
                      #15

                      @mrjj Using focusChanged I have determined that, when the mouse clicks on the menubar the focus is given to the menubar object, as expected and the QGroupBox is displayed. If I do not deliberately setFocus to the QGroupBox then the first click in the QGroupBox removes the focus from the menubar to None. Subsequent clicks in the QGroupBox set the focus to the menubar, the click is processed and the focus goes back to None. If I deliberately setFocus to the QGroupBox then focus transfers to the QGroupBox, then the first click in the QGroupBox removes the focus from the QGroupBox but is not processed. Subsequent clicks in the QGroupBox set the focus to the QGroupBox, the click is processed and the focus goes back to None!

                      1 Reply Last reply
                      0
                      • MikePM Offline
                        MikePM Offline
                        MikeP
                        wrote on last edited by
                        #16

                        Sidestepped the problem by substituting a toolbar for the menubar!

                        mrjjM 1 Reply Last reply
                        1
                        • MikePM MikeP

                          Sidestepped the problem by substituting a toolbar for the menubar!

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #17

                          @MikeP
                          good workaround.

                          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