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. Simulate left mouse button unclick (release button)
Forum Updated to NodeBB v4.3 + New Features

Simulate left mouse button unclick (release button)

Scheduled Pinned Locked Moved Solved General and Desktop
31 Posts 3 Posters 14.8k Views 3 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.
  • A Andrey Shmelew

    @mrjj
    Hello!

    So, the problem is not solved,
    should i use events filter?

    thanks!

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

    @Andrey-Shmelew
    well, i would dig a bit deeper into what is going on.
    I never seen combo not work like that.
    Seems something else than missing events.

    But yes, you can most likely work around using event filters but there might surface other stuff
    like broken drag and drop or something as its not a bug in combobox ( no other reports) as such so
    something else is not as expected with the touch.

    I tried at work with touch screen and could not reproduce it so Im a bit lost why
    its not just closing its dropdown.

    I think it will/might be a mess with eventfilter
    but if you only have one combobox you
    need to fix it should be ok
    but if you use combos all over program i would
    go for better solution.

    A 1 Reply Last reply
    1
    • mrjjM mrjj

      @Andrey-Shmelew
      well, i would dig a bit deeper into what is going on.
      I never seen combo not work like that.
      Seems something else than missing events.

      But yes, you can most likely work around using event filters but there might surface other stuff
      like broken drag and drop or something as its not a bug in combobox ( no other reports) as such so
      something else is not as expected with the touch.

      I tried at work with touch screen and could not reproduce it so Im a bit lost why
      its not just closing its dropdown.

      I think it will/might be a mess with eventfilter
      but if you only have one combobox you
      need to fix it should be ok
      but if you use combos all over program i would
      go for better solution.

      A Offline
      A Offline
      Andrey Shmelew
      wrote on last edited by
      #21

      @mrjj
      Unfortunately, i use combos all over program. I want to use comboboxes for configure my device. if you could not reproduce it, maybe it happens because of my touch's non-correct work. If i could make any help for you for help me ...

      mrjjM raven-worxR 2 Replies Last reply
      0
      • A Andrey Shmelew

        @mrjj
        Unfortunately, i use combos all over program. I want to use comboboxes for configure my device. if you could not reproduce it, maybe it happens because of my touch's non-correct work. If i could make any help for you for help me ...

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

        @Andrey-Shmelew

        Hmm, I asked another mod here for some input (later) as there is something
        funky here. Maybe im overlooking something.
        If your touch acts as pure touch or is faulty then other controls should also have issues.

        But since we do not have any event trace is very unclear what is happening.
        Also as far as I know, the drop down part of the combobox is already using event filter.
        So its not sure event filters are a good/easy fix.

        I think i would still dig deeper to find real reason. ( look in Qt source)

        Alternatively, make my own combo box and control the dropdown with lost focus if possible.
        Didnt check the code so not sure how it handles the dropdown.

        1 Reply Last reply
        1
        • A Andrey Shmelew

          @mrjj
          Unfortunately, i use combos all over program. I want to use comboboxes for configure my device. if you could not reproduce it, maybe it happens because of my touch's non-correct work. If i could make any help for you for help me ...

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #23

          @Andrey-Shmelew
          whats your touch screen model?
          Whats your input mode (evdev, tslib, libinput) used?
          What is your used Qt platform (X, LinuxFB, EGLFS)?

          Just to make sure: you are using QtWidgets right, not QML?

          btw. VLC also uses Qt for it's GUI. But i currently don't know which version.
          Can you also try to use Qt 5.8 RC if you encounter the same issues?

          Also you could log all events like the following. Start the application from the console and you should see the output in stdout.

          qApp->installEventFilter( this );
          ...
          bool eventFilter( QObject* watched, QEvent* event )
          {
               switch( event->type() )
               {
                         case QEvent::MousePressEvent:
                         case QEvent::MouseReleaseEvent:
                         case QEvent::TouchBegin:
                         case QEvent::TouchCancel:
                         case QEvent::TouchEnd:
                                  qDebug() << int(event->type()) << watched;
                        break;
               }
          
               return BaseClass::eventFilter(watched,event);
          }
          

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          A 2 Replies Last reply
          3
          • raven-worxR raven-worx

            @Andrey-Shmelew
            whats your touch screen model?
            Whats your input mode (evdev, tslib, libinput) used?
            What is your used Qt platform (X, LinuxFB, EGLFS)?

            Just to make sure: you are using QtWidgets right, not QML?

            btw. VLC also uses Qt for it's GUI. But i currently don't know which version.
            Can you also try to use Qt 5.8 RC if you encounter the same issues?

            Also you could log all events like the following. Start the application from the console and you should see the output in stdout.

            qApp->installEventFilter( this );
            ...
            bool eventFilter( QObject* watched, QEvent* event )
            {
                 switch( event->type() )
                 {
                           case QEvent::MousePressEvent:
                           case QEvent::MouseReleaseEvent:
                           case QEvent::TouchBegin:
                           case QEvent::TouchCancel:
                           case QEvent::TouchEnd:
                                    qDebug() << int(event->type()) << watched;
                          break;
                 }
            
                 return BaseClass::eventFilter(watched,event);
            }
            
            A Offline
            A Offline
            Andrey Shmelew
            wrote on last edited by Andrey Shmelew
            #24

            @raven-worx
            This is my display : http://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm
            i dont know inpute mode (maybe this is a reason of a bug)
            i also dont know qt platform (maybe Qt Creator 4.1.0
            Основан на Qt 5.7.0 (MSVC 2013, 32 бита) is answer), and i built qt everywere with gcc arm none eabi compiler.
            I use QtWidgets, not QML, i am sure.
            OK I think i can try QT 5.8 RC
            Ok i will log all events following your code

            here is video demonstrates how combo works https://drive.google.com/file/d/0ByPoVqOCWO2IVERuMkMzTmZsMjA/view

            raven-worxR 1 Reply Last reply
            0
            • A Andrey Shmelew

              @raven-worx
              This is my display : http://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm
              i dont know inpute mode (maybe this is a reason of a bug)
              i also dont know qt platform (maybe Qt Creator 4.1.0
              Основан на Qt 5.7.0 (MSVC 2013, 32 бита) is answer), and i built qt everywere with gcc arm none eabi compiler.
              I use QtWidgets, not QML, i am sure.
              OK I think i can try QT 5.8 RC
              Ok i will log all events following your code

              here is video demonstrates how combo works https://drive.google.com/file/d/0ByPoVqOCWO2IVERuMkMzTmZsMjA/view

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by raven-worx
              #25

              @Andrey-Shmelew
              in the video the mouse cursor changes it's shape (to Qt::IBeamCursor), from then on your widgets do not react anymore.
              You can also log the focus changes by connecting to QApplication::focusChanged() signal. It would be interesting what's the focus widget is in that case.

              Maybe you use QWidget::grabMouse() in this widget?

              Can you also please set QT_DEBUG_PLUGINS=1 environment variable and post the output from the console. Maybe before/after you try the other debug output.
              This shows what plugins are being loaded.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              A 1 Reply Last reply
              1
              • raven-worxR raven-worx

                @Andrey-Shmelew
                in the video the mouse cursor changes it's shape (to Qt::IBeamCursor), from then on your widgets do not react anymore.
                You can also log the focus changes by connecting to QApplication::focusChanged() signal. It would be interesting what's the focus widget is in that case.

                Maybe you use QWidget::grabMouse() in this widget?

                Can you also please set QT_DEBUG_PLUGINS=1 environment variable and post the output from the console. Maybe before/after you try the other debug output.
                This shows what plugins are being loaded.

                A Offline
                A Offline
                Andrey Shmelew
                wrote on last edited by Andrey Shmelew
                #26

                @raven-worx
                i added QApplication::focusChanged() signal:

                int main(int argc, char *argv[])
                {
                    QApplication a(argc, argv);
                    MainWindow w;
                    QObject::connect(&a, SIGNAL(focusChanged(QWidget*,QWidget*)), &w, SLOT(textupdate()));
                    w.show();
                    return a.exec();
                }
                

                then added a slot:

                void MainWindow::textupdate()
                {
                QWidget * fw = qApp->focusWidget();
                ui->textEdit_3->setText(ui->textEdit_3->toPlainText() + " | " + fw->objectName());
                }
                

                accordingly, i can see focused widget name, right?
                After it, i noticed strange behaviour:
                after some clicks on comboboxes, it becomes impossible to control all of widgets besides textEdit widgets (and sometimes... dial). Thats all. All other widgets (sliders, combos) are dead. And strange that when i click on textEdit, mouse cursor is always at the begin.

                And the following video : https://drive.google.com/open?id=0ByPoVqOCWO2IMmdlMk8xTEVoa0U

                PS, sometimes when bug happens, i can select text in textEdit by my finger (as if I hold down the left mouse button), so i made a conclusion that "touch mouse button" didnt released properly. And the video:
                https://drive.google.com/open?id=0ByPoVqOCWO2IS2lIQUpBSlNPWDA

                trying QT 5.8 RC did not bring good results

                case QEvent::MousePressEvent:
                case QEvent::MouseReleaseEvent:

                MousePressEvent and MouseReleaseEvent are not exsist

                PPS: After i connect regular mouse and click left button, all becomes normal.

                1 Reply Last reply
                0
                • raven-worxR raven-worx

                  @Andrey-Shmelew
                  whats your touch screen model?
                  Whats your input mode (evdev, tslib, libinput) used?
                  What is your used Qt platform (X, LinuxFB, EGLFS)?

                  Just to make sure: you are using QtWidgets right, not QML?

                  btw. VLC also uses Qt for it's GUI. But i currently don't know which version.
                  Can you also try to use Qt 5.8 RC if you encounter the same issues?

                  Also you could log all events like the following. Start the application from the console and you should see the output in stdout.

                  qApp->installEventFilter( this );
                  ...
                  bool eventFilter( QObject* watched, QEvent* event )
                  {
                       switch( event->type() )
                       {
                                 case QEvent::MousePressEvent:
                                 case QEvent::MouseReleaseEvent:
                                 case QEvent::TouchBegin:
                                 case QEvent::TouchCancel:
                                 case QEvent::TouchEnd:
                                          qDebug() << int(event->type()) << watched;
                                break;
                       }
                  
                       return BaseClass::eventFilter(watched,event);
                  }
                  
                  A Offline
                  A Offline
                  Andrey Shmelew
                  wrote on last edited by Andrey Shmelew
                  #27

                  @raven-worx said in Simulate left mouse button unclick (release button):

                  Also you could log all events like the following. Start the application from the console and you should see the output in stdout.

                  this is code to see events in event filter:

                  bool MainWindow::eventFilter(QObject *obj, QEvent *event)
                  {
                      switch( event->type() ){
                      case QEvent::MouseButtonDblClick:
                          //        qDebug() << "Mouse Button Double Clicked";
                          ui->textEdit_3->setText("Mouse Double Clicked");
                          break;
                      case QEvent::MouseButtonPress:
                          //        qDebug() << "Mouse Button Pressed";
                          ui->textEdit_3->setText("Mouse Button Pressed");
                          break;
                      case QEvent::MouseButtonRelease:
                          //        qDebug() << "Mouse Button Released";
                          ui->textEdit_3->setText("Mouse Button Released");
                          break;
                  
                      case QEvent::TouchBegin:
                          //        qDebug() << "TouchBegin";
                          ui->textEdit_3->setText("TouchBegin");
                          break;
                  
                      case QEvent::TouchEnd:
                          //        qDebug() << "TouchEnd";
                          ui->textEdit_3->setText("TouchEnd");
                          break;
                  
                      case QEvent::TouchCancel:
                          //        qDebug() << "TouchCancel";
                          ui->textEdit_3->setText("TouchCancel");
                          break;
                  
                      case QEvent::TouchUpdate:
                          //qDebug() << "TouchUpdate";
                          ui->textEdit_3->setText("TouchUpdate");
                          break;
                  
                      default:
                          break;
                      }
                      // pass the event on to the parent class
                      return QMainWindow::eventFilter(obj, event);
                  }
                  

                  So, i noticed that mouse when i touch widgets, release event is called but... not always...
                  but if i connect mouse instead of touch screen, and press left button, it becomes OK.

                  A 1 Reply Last reply
                  0
                  • A Andrey Shmelew

                    @raven-worx said in Simulate left mouse button unclick (release button):

                    Also you could log all events like the following. Start the application from the console and you should see the output in stdout.

                    this is code to see events in event filter:

                    bool MainWindow::eventFilter(QObject *obj, QEvent *event)
                    {
                        switch( event->type() ){
                        case QEvent::MouseButtonDblClick:
                            //        qDebug() << "Mouse Button Double Clicked";
                            ui->textEdit_3->setText("Mouse Double Clicked");
                            break;
                        case QEvent::MouseButtonPress:
                            //        qDebug() << "Mouse Button Pressed";
                            ui->textEdit_3->setText("Mouse Button Pressed");
                            break;
                        case QEvent::MouseButtonRelease:
                            //        qDebug() << "Mouse Button Released";
                            ui->textEdit_3->setText("Mouse Button Released");
                            break;
                    
                        case QEvent::TouchBegin:
                            //        qDebug() << "TouchBegin";
                            ui->textEdit_3->setText("TouchBegin");
                            break;
                    
                        case QEvent::TouchEnd:
                            //        qDebug() << "TouchEnd";
                            ui->textEdit_3->setText("TouchEnd");
                            break;
                    
                        case QEvent::TouchCancel:
                            //        qDebug() << "TouchCancel";
                            ui->textEdit_3->setText("TouchCancel");
                            break;
                    
                        case QEvent::TouchUpdate:
                            //qDebug() << "TouchUpdate";
                            ui->textEdit_3->setText("TouchUpdate");
                            break;
                    
                        default:
                            break;
                        }
                        // pass the event on to the parent class
                        return QMainWindow::eventFilter(obj, event);
                    }
                    

                    So, i noticed that mouse when i touch widgets, release event is called but... not always...
                    but if i connect mouse instead of touch screen, and press left button, it becomes OK.

                    A Offline
                    A Offline
                    Andrey Shmelew
                    wrote on last edited by
                    #28

                    Ok, the problem is solved,

                    i have recieved a new touch-panel, and it is working fine, mouse released lert button after i release my finger.

                    Thanks for help

                    mrjjM 1 Reply Last reply
                    1
                    • A Andrey Shmelew

                      Ok, the problem is solved,

                      i have recieved a new touch-panel, and it is working fine, mouse released lert button after i release my finger.

                      Thanks for help

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

                      @Andrey-Shmelew
                      So it was just a faulty driver or something?

                      A 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @Andrey-Shmelew
                        So it was just a faulty driver or something?

                        A Offline
                        A Offline
                        Andrey Shmelew
                        wrote on last edited by Andrey Shmelew
                        #30

                        @mrjj

                        it was faulty Touch Hardware Driver IMHO

                        mrjjM 1 Reply Last reply
                        1
                        • A Andrey Shmelew

                          @mrjj

                          it was faulty Touch Hardware Driver IMHO

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

                          @Andrey-Shmelew

                          yep I suspected that
                          But HW is hard to debug remotely :)

                          Happy programming

                          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