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. QMousepressEvent is ignored by exec method
Forum Updated to NodeBB v4.3 + New Features

QMousepressEvent is ignored by exec method

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 474 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.
  • O Offline
    O Offline
    Oumayma
    wrote on last edited by
    #1

    hi,

    I have the following problem, I use the exec method to display the top menus of my text editor, and I also have an implementation of the mousepressEvent method. This last method is ignored when I use the exec method, what I expect my program to do is that once my menu is displayed by left clicking on my mouse, the corresponding action of my menu is activated.

    jsulmJ 1 Reply Last reply
    0
    • O Oumayma

      @jsulm yes, i said that. But I did not express myself in the correct way, what I wanted to say is that the mousepreesevent method in Android, instead of executing the action that is highlighted, such as copying a text with the first click, what it does is hide the dropdown menu. To execute the desired action, you need a double click. This only happens to me with Android.

      O Offline
      O Offline
      Oumayma
      wrote on last edited by
      #6

      @Oumayma Hello I have solved my problem in the following way:

       #ifdef Q_OS_ANDROID
              if(QEvent::MouseButtonPress){
               evento_mouse = new QMouseEvent(QEvent::MouseButtonPress, cursor.pos(),Qt::LeftButton,Qt::LeftButton, Qt::NoModifier);
              mousePressEvent(evento_mouse);
              }
          #endif
      

      I have this code just after displaying my menu.

      1 Reply Last reply
      1
      • O Oumayma

        hi,

        I have the following problem, I use the exec method to display the top menus of my text editor, and I also have an implementation of the mousepressEvent method. This last method is ignored when I use the exec method, what I expect my program to do is that once my menu is displayed by left clicking on my mouse, the corresponding action of my menu is activated.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Oumayma Please show your code. Clicking menu should work out of the box.
        "and I also have an implementation of the mousepressEvent method" - where? QMenu::exec() is a blocking call.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        O 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Oumayma Please show your code. Clicking menu should work out of the box.
          "and I also have an implementation of the mousepressEvent method" - where? QMenu::exec() is a blocking call.

          O Offline
          O Offline
          Oumayma
          wrote on last edited by
          #3

          @jsulm
          Hi, sorry for not explaining myself correctly, the problem I have is when I run my text editor on Android. It is a bit complicated to explain since my editor is designed for people with functional diversity that can only be managed with mouse clicks or a button.

          To display the submenus as I was commenting, I have a function that I pass the menu to be displayed and its global position and using menu->exec(point) my menu is displayed.

          Once the menu is displayed, the actions are highlighted one by one through a timer waiting for the user to left click on the mouse to execute the desired action, for this I need the interaction of the mousepressevent method. What I have just commented on in windows works fine, but in android when making a single click the dropdown menu closes without executing the desired action, it seems that android needs a second click to execute said action.

          I hope that with this message I have explained myself better, anyway if you need more details or something more specific to understand my problem let me know.

          Thank you very much.

          jsulmJ 1 Reply Last reply
          0
          • O Oumayma

            @jsulm
            Hi, sorry for not explaining myself correctly, the problem I have is when I run my text editor on Android. It is a bit complicated to explain since my editor is designed for people with functional diversity that can only be managed with mouse clicks or a button.

            To display the submenus as I was commenting, I have a function that I pass the menu to be displayed and its global position and using menu->exec(point) my menu is displayed.

            Once the menu is displayed, the actions are highlighted one by one through a timer waiting for the user to left click on the mouse to execute the desired action, for this I need the interaction of the mousepressevent method. What I have just commented on in windows works fine, but in android when making a single click the dropdown menu closes without executing the desired action, it seems that android needs a second click to execute said action.

            I hope that with this message I have explained myself better, anyway if you need more details or something more specific to understand my problem let me know.

            Thank you very much.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Oumayma said in QMousepressEvent is ignored by exec method:

            but in android when making a single click the dropdown menu closes without executing the desired action

            Do you mean mousePressEvent() is not executed?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            O 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Oumayma said in QMousepressEvent is ignored by exec method:

              but in android when making a single click the dropdown menu closes without executing the desired action

              Do you mean mousePressEvent() is not executed?

              O Offline
              O Offline
              Oumayma
              wrote on last edited by
              #5

              @jsulm yes, i said that. But I did not express myself in the correct way, what I wanted to say is that the mousepreesevent method in Android, instead of executing the action that is highlighted, such as copying a text with the first click, what it does is hide the dropdown menu. To execute the desired action, you need a double click. This only happens to me with Android.

              O 1 Reply Last reply
              0
              • O Oumayma

                @jsulm yes, i said that. But I did not express myself in the correct way, what I wanted to say is that the mousepreesevent method in Android, instead of executing the action that is highlighted, such as copying a text with the first click, what it does is hide the dropdown menu. To execute the desired action, you need a double click. This only happens to me with Android.

                O Offline
                O Offline
                Oumayma
                wrote on last edited by
                #6

                @Oumayma Hello I have solved my problem in the following way:

                 #ifdef Q_OS_ANDROID
                        if(QEvent::MouseButtonPress){
                         evento_mouse = new QMouseEvent(QEvent::MouseButtonPress, cursor.pos(),Qt::LeftButton,Qt::LeftButton, Qt::NoModifier);
                        mousePressEvent(evento_mouse);
                        }
                    #endif
                

                I have this code just after displaying my menu.

                1 Reply Last reply
                1

                • Login

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