Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    How to see all posted events for an object

    General and Desktop
    3
    4
    1344
    Loading More Posts
    • 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.
    • Q
      qtProgrammer last edited by qtProgrammer

      Hello All,

      is there a way to see all posted events of an object in QT..? or is it private to QT.?

      I could see them when the object processes those posted events but i'm wondering if there's a way to see all posted events that are yet to be processed.

      Also, Please give any references to understand how posted events work & how these are different than sending events directly.

      Thanks in advance,

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi
        You can install a eventfilter and see what is sent to each control.
        http://www.informit.com/articles/article.aspx?p=1405544&seqNum=2

        For info, please see
        http://doc.qt.io/qt-5/eventsandfilters.html

        Also for more fun with EventFilters you can use my ID to string function
        so it can directly list what is is :)

        const char* DesignArea::EventDesc(int EType) {
        
          if ( EType == QEvent::Timer /*== 1*/  )                              return "timer event";
          if ( EType == QEvent::MouseButtonPress /*== 2*/  )                   return " mouse button pressed";
          if ( EType == QEvent::MouseButtonRelease /*== 3*/  )                 return " mouse button released";
          if ( EType == QEvent::MouseButtonDblClick /*== 4*/  )                return " mouse button double click";
          if ( EType == QEvent::MouseMove /*== 5*/  )                          return " mouse move";
          if ( EType == QEvent::KeyPress /*== 6*/  )                           return " key pressed";
          if ( EType == QEvent::KeyRelease /*== 7*/  )                         return " key released";
          if ( EType == QEvent::FocusIn /*== 8*/  )                            return " keyboard focus received";
          if ( EType == QEvent::FocusOut /*== 9*/  )                           return " keyboard focus lost";
          if ( EType == QEvent::FocusAboutToChange /*== 23*/  )                return " keyboard focus is about to be lost";
          if ( EType == QEvent::Enter /*== 10*/  )                             return " mouse enters widget";
          if ( EType == QEvent::Leave /*== 11*/  )                             return " mouse leaves widget";
          if ( EType == QEvent::Paint /*== 12*/  )                             return " paint widget";
          if ( EType == QEvent::Move /*== 13*/  )                              return " move widget";
          if ( EType == QEvent::Resize /*== 14*/  )                            return " resize widget";
          if ( EType == QEvent::Create /*== 15*/  )                            return " after widget creation";
          if ( EType == QEvent::Destroy /*== 16*/  )                           return " during widget destruction";
          if ( EType == QEvent::Show /*== 17*/  )                              return " widget is shown";
          if ( EType == QEvent::Hide /*== 18*/  )                              return " widget is hidden";
          if ( EType == QEvent::Close /*== 19*/  )                             return " request to close widget";
          if ( EType == QEvent::Quit /*== 20*/  )                              return " request to quit application";
          if ( EType == QEvent::ParentChange /*== 21*/  )                      return " widget has been reparented";
          if ( EType == QEvent::ParentAboutToChange /*== 131*/  )              return " sent just before the parent change is done";
          if ( EType == QEvent::ThreadChange /*== 22*/  )                      return " object has changed threads";
          if ( EType == QEvent:: WindowActivate /*== 24*/  )                    return " window was activated";
          if ( EType == QEvent::WindowDeactivate /*== 25*/  )                  return " window was deactivated";
          if ( EType == QEvent::ShowToParent /*== 26*/  )                      return " widget is shown to parent";
          if ( EType == QEvent::HideToParent /*== 27*/  )                      return " widget is hidden to parent";
          if ( EType == QEvent::Wheel /*== 31*/  )                             return " wheel event";
          if ( EType == QEvent::WindowTitleChange /*== 33*/  )                 return " window title changed";
          if ( EType == QEvent::WindowIconChange /*== 34*/  )                  return " icon changed";
          if ( EType == QEvent::ApplicationWindowIconChange /*== 35*/  )       return " application icon changed";
          if ( EType == QEvent::ApplicationFontChange /*== 36*/  )             return " application font changed";
          if ( EType == QEvent::ApplicationLayoutDirectionChange /*== 37*/  )  return " application layout direction changed";
          if ( EType == QEvent::ApplicationPaletteChange /*== 38*/  )          return " application palette changed";
          if ( EType == QEvent::PaletteChange /*== 39*/  )                     return " widget palette changed";
          if ( EType == QEvent::Clipboard /*== 40*/  )                         return " internal clipboard event";
          if ( EType == QEvent::Speech /*== 42*/  )                            return " reserved for speech input";
          if ( EType == QEvent::MetaCall  /* ==  43*/)                         return " meta call event";
          if ( EType == QEvent::SockAct /*== 50*/  )                           return " socket activation";
          if ( EType == QEvent::WinEventAct /*== 132*/  )                      return " win event activation";
          if ( EType == QEvent::DeferredDelete /*== 52*/  )                    return " deferred delete event";
          if ( EType == QEvent::DragEnter /*== 60*/  )                         return " drag moves into widget";
          if ( EType == QEvent::DragMove /*== 61*/  )                          return " drag moves in widget";
          if ( EType == QEvent::DragLeave /*== 62*/  )                         return " drag leaves or is cancelled";
          if ( EType == QEvent::Drop /*== 63*/  )                              return " actual drop";
          if ( EType == QEvent::DragResponse /*== 64*/  )                      return " drag accepted / rejected";
          if ( EType == QEvent::ChildAdded /*== 68*/  )                        return " new child widget";
          if ( EType == QEvent::ChildPolished /*== 69*/  )                     return " polished child widget";
          if ( EType == QEvent::ChildRemoved /*== 71*/  )                      return " deleted child widget";
          if ( EType == QEvent::ShowWindowRequest /*== 73*/  )                 return " widget's window should be mapped";
          if ( EType == QEvent::PolishRequest /*== 74*/  )                     return " widget should be polished";
          if ( EType == QEvent::Polish /* 75*/)                            return " widget is polished";
          if ( EType == QEvent::LayoutRequest /*== 76*/  )                     return " widget should be relayouted";
          if ( EType == QEvent::UpdateRequest /*== 77*/  )                     return " widget should be repainted";
          if ( EType == QEvent::UpdateLater /*== 78*/  )                       return " request update() later";
          if ( EType == QEvent::EmbeddingControl /*== 79*/  )                  return " ActiveX embedding";
          if ( EType == QEvent::ActivateControl /*== 80*/  )                   return " ActiveX activation";
          if ( EType == QEvent::DeactivateControl /*== 81*/  )                 return " ActiveX deactivation";
          if ( EType == QEvent::ContextMenu /*== 82*/  )                       return " context popup menu";
          if ( EType == QEvent::InputMethod /*== 83*/  )                       return " input method";
          if ( EType == QEvent::TabletMove /*== 87*/  )                        return " Wacom tablet event";
          if ( EType == QEvent::LocaleChange /*== 88*/  )                      return " the system locale changed";
          if ( EType == QEvent::LanguageChange /*== 89*/  )                    return " the application language changed";
          if ( EType == QEvent::LayoutDirectionChange /*== 90*/  )             return " the layout direction changed";
          if ( EType == QEvent::Style /*== 91*/  )                             return " internal style event";
          if ( EType == QEvent::TabletPress /*== 92*/  )                       return " tablet press";
          if ( EType == QEvent::TabletRelease /*== 93*/  )                     return " tablet release";
          if ( EType == QEvent::OkRequest /*== 94*/  )                         return " CE (Ok) button pressed";
          if ( EType == QEvent::HelpRequest /*== 95*/  )                       return " CE (?)  button pressed";
          if ( EType == QEvent::IconDrag /*== 96*/  )                          return " proxy icon dragged";
          if ( EType == QEvent::FontChange /*== 97*/  )                        return " font has changed";
          if ( EType == QEvent::EnabledChange /*== 98*/  )                     return " enabled state has changed";
          if ( EType == QEvent::ActivationChange /*== 99*/  )                  return " window activation has changed";
          if ( EType == QEvent::StyleChange /*== 100*/  )                      return " style has changed";
          if ( EType == QEvent::IconTextChange /*== 101*/  )                   return " icon text has changed";
          if ( EType == QEvent::ModifiedChange /*== 102*/  )                   return " modified state has changed";
          if ( EType == QEvent::MouseTrackingChange /*== 109*/  )              return " mouse tracking state has changed";
          if ( EType == QEvent::WindowBlocked /*== 103*/  )                    return " window is about to be blocked modally";
          if ( EType == QEvent::WindowUnblocked /*== 104*/  )                  return " windows modal blocking has ended";
          if ( EType == QEvent::WindowStateChange /*== 105*/  )                return "WindowStateChange";
          if ( EType == QEvent::ReadOnlyChange /*== 106*/  )                   return " readonly state has changed";
          if ( EType == QEvent::ToolTip /*== 110*/  )                          return "Tooltip";
          if ( EType == QEvent::WhatsThis /*== 111*/  )                        return "----------------------";
          if ( EType == QEvent::StatusTip /*== 112*/  )                        return "----------------------";
          if ( EType == QEvent::ActionChanged /*== 113*/  )                    return "----------------------";
          if ( EType == QEvent::ActionAdded /*== 114*/  )                      return "----------------------";
          if ( EType == QEvent::ActionRemoved /*== 115*/  )                    return "----------------------";
          if ( EType == QEvent::FileOpen /*== 116*/  )                         return " file open request";
          if ( EType == QEvent::Shortcut /*== 117*/  )                         return " shortcut triggered";
          if ( EType == QEvent::ShortcutOverride /*== 51*/  )                  return " shortcut override request";
          if ( EType == QEvent::WhatsThisClicked /*== 118*/  )                 return "----------------------";
          if ( EType == QEvent::ToolBarChange /*== 120*/  )                    return " toolbar visibility toggled";
          if ( EType == QEvent::ApplicationActivate /*== 121*/  )              return " deprecated. Use ApplicationStateChange instead.";
          if ( EType == QEvent::ApplicationActivated ) return " deprecated";
          if ( EType == QEvent::ApplicationDeactivate /*== 122*/  )            return " deprecated. Use ApplicationStateChange instead.";
          if ( EType == QEvent::ApplicationDeactivated) return " deprecated";
          if ( EType == QEvent::QueryWhatsThis /*== 123*/  )                   return " query what's this widget help";
          if ( EType == QEvent::EnterWhatsThisMode /*== 124*/  )               return "----------------------";
          if ( EType == QEvent::LeaveWhatsThisMode /*== 125*/  )               return "----------------------";
          if ( EType == QEvent::ZOrderChange /*== 126*/  )                     return " child widget has had its z - order changed";
          if ( EType == QEvent::HoverEnter /*== 127*/  )                       return " mouse cursor enters a hover widget";
          if ( EType == QEvent::HoverLeave /*== 128*/  )                       return " mouse cursor leaves a hover widget";
          if ( EType == QEvent::HoverMove /*== 129*/  )                        return " mouse cursor move inside a hover widget";
          //if ( EType == QEvent::EnterEditFocus /*== 150*/  )                   return " enter edit mode in keypad navigation";
          //if ( EType == QEvent::LeaveEditFocus /*== 151*/  )                   return " enter edit mode in keypad navigation";
          if ( EType == QEvent::AcceptDropsChange /*== 152*/  )        return "----------------------";
          if ( EType == QEvent::ZeroTimerEvent /*== 154*/  )                   return " Used for Windows Zero timer events";
          if ( EType == QEvent::GraphicsSceneMouseMove /*== 155*/  )           return " GraphicsView";
          if ( EType == QEvent::GraphicsSceneMousePress /*== 156*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneMouseRelease /*== 157*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneMouseDoubleClick /*== 158*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneContextMenu /*== 159*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneHoverEnter /*== 160*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneHoverMove /*== 161*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneHoverLeave /*== 162*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneHelp /*== 163*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneDragEnter /*== 164*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneDragMove /*== 165*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneDragLeave /*== 166*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneDrop /*== 167*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneWheel /*== 168*/  )        return "----------------------";
          if ( EType == QEvent::KeyboardLayoutChange /*== 169*/  )             return " keyboard layout changed";
          if ( EType == QEvent::DynamicPropertyChange /*== 170*/  )            return " A dynamic property was changed through setProperty / property";
          if ( EType == QEvent::TabletEnterProximity /*== 171*/  )        return "----------------------";
          if ( EType == QEvent::TabletLeaveProximity /*== 172*/  )        return "----------------------";
          if ( EType == QEvent::NonClientAreaMouseMove /*== 173*/  )        return "----------------------";
          if ( EType == QEvent::NonClientAreaMouseButtonPress /*== 174*/  )        return "----------------------";
          if ( EType == QEvent::NonClientAreaMouseButtonRelease /*== 175*/  )        return "----------------------";
          if ( EType == QEvent::NonClientAreaMouseButtonDblClick /*== 176*/  )        return "----------------------";
          if ( EType == QEvent::MacSizeChange /*== 177*/  )                    return " when the Qt::WA_Mac {Normal)Small)Mini} Size changes";
          if ( EType == QEvent::ContentsRectChange /*== 178*/  )               return " sent by QWidget::setContentsMargins (internal)";
          if ( EType == QEvent::MacGLWindowChange /*== 179*/  )                return " Internal! the window of the GLWidget has changed";
          if ( EType == QEvent::FutureCallOut /*== 180*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneResize  /*== 181*/  )        return "----------------------";
          if ( EType == QEvent::GraphicsSceneMove  /*== 182*/  )        return "----------------------";
          if ( EType == QEvent::CursorChange /*== 183*/  )        return "----------------------";
          if ( EType == QEvent::ToolTipChange /*== 184*/  )        return "----------------------";
          if ( EType == QEvent::NetworkReplyUpdated /*== 185*/  )              return " Internal for QNetworkReply";
          if ( EType == QEvent::GrabMouse /*== 186*/  )        return "----------------------";
          if ( EType == QEvent::UngrabMouse /*== 187*/  )        return "----------------------";
          if ( EType == QEvent::GrabKeyboard /*== 188*/  )        return "----------------------";
          if ( EType == QEvent::UngrabKeyboard /*== 189*/  )        return "----------------------";
          if ( EType == QEvent::MacGLClearDrawable /*== 191*/  )               return " Internal Cocoa) the window has changed) so we must clear";
          if ( EType == QEvent::StateMachineSignal /*== 192*/  )        return "----------------------";
          if ( EType == QEvent::StateMachineWrapped /*== 193*/  )        return "----------------------";
          if ( EType == QEvent::TouchBegin /*== 194*/  )        return "----------------------";
          if ( EType == QEvent::TouchUpdate /*== 195*/  )        return "----------------------";
          if ( EType == QEvent::TouchEnd /*== 196*/  )        return "----------------------";
          if ( EType == QEvent::NativeGesture /*== 197*/  )                    return " QtGui native gesture";
          if ( EType == QEvent::RequestSoftwareInputPanel /*== 199*/  )        return "----------------------";
          if ( EType == QEvent::CloseSoftwareInputPanel /*== 200*/  )        return "----------------------";
          if ( EType == QEvent::WinIdChange /*== 203*/  )        return "----------------------";
          if ( EType == QEvent::Gesture /*== 198*/  )        return "----------------------";
          if ( EType == QEvent::GestureOverride /*== 202*/  )        return "----------------------";
          if ( EType == QEvent::ScrollPrepare /*== 204*/  )        return "----------------------";
          if ( EType == QEvent::Scroll /*== 205*/  )        return "----------------------";
          if ( EType == QEvent::Expose /*== 206*/  )        return "----------------------";
          if ( EType == QEvent::InputMethodQuery /*== 207*/  )        return "----------------------";
          if ( EType == QEvent::OrientationChange /*== 208*/  )                return " Screen orientation has changed";
          if ( EType == QEvent::TouchCancel /*== 209*/  )        return "----------------------";
          if ( EType == QEvent::ThemeChange /*== 210*/  )        return "----------------------";
          if ( EType == QEvent::SockClose /*== 211*/  )                        return " socket closed";
          if ( EType == QEvent::PlatformPanel /*== 212*/  )        return "----------------------";
          if ( EType == QEvent::StyleAnimationUpdate /*== 213*/  )             return " style animation target should be updated";
          if ( EType == QEvent::ApplicationStateChange /*== 214*/  )        return "----------------------";
          return "?";
        }
        
        
        1 Reply Last reply Reply Quote 1
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          You might also be interested by KDAB's GammaRay to take a look at the internals of your application.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Q 1 Reply Last reply Reply Quote 0
          • Q
            qtProgrammer @SGaist last edited by

            Thank you @SGaist & @mrjj

            1 Reply Last reply Reply Quote 0
            • First post
              Last post