View Issue Details

IDProjectCategoryView StatusLast Update
0022943LazarusIDEpublic2018-07-17 00:09
ReportertcadutoAssigned ToZeljan Rikalo 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.0.0Product Build 
Target Version1.2.0Fixed in Version1.3 (SVN) 
Summary0022943: Menu Editor Issue with QT widget set on Windows
DescriptionAfter rebuilding the IDE with QT I noticed that the menu editor was acting odd.
In order to get the right click menu to delete or add items I have to right click 5 to 6 times in a row pretty fast and it's hit or miss if the popup menu appears.
Additional InformationOS windows 7
QT libs version 4.8.3.0
Qt4pas.dll version 5.2.5.0
TagsNo tags attached.
Fixed in Revision44249
LazTarget1.2
WidgetsetQT
Attached Files
  • issue22943.diff (3,052 bytes)
    Index: lcl/interfaces/qt/qtwidgets.pas
    ===================================================================
    --- lcl/interfaces/qt/qtwidgets.pas	(revision 44094)
    +++ lcl/interfaces/qt/qtwidgets.pas	(working copy)
    @@ -59,7 +59,8 @@
     
       {state is setted up only when LCL is doing changes.}
       TQtWidgetState = (qtwsColorUpdating, qtwsFontUpdating, qtwsSizeUpdating,
    -    qtwsPositionUpdating);
    +    qtwsPositionUpdating, qtwsInsideRightMouseButtonPressEvent,
    +    qtwsHiddenInsideRightMouseButtonPressEvent);
     
       TQtWidgetStates = set of TQtWidgetState;
     
    @@ -2342,6 +2343,7 @@
       QtEdit: IQtEdit;
       R: TRect;
       Pt: TQtPoint;
    +  AContextEvent: QContextMenuEventH;
     begin
       BeginEventProcessing;
       Result := False;
    @@ -2385,12 +2387,33 @@
                   QtWidgetSet.InvalidateWidgetAtCache;
               end;
             end;
    -      QEventShow: SlotShow(True);
    +      QEventShow:
    +        begin
    +          SlotShow(True);
    +          {$IFDEF MSWINDOWS}
    +          if (qtwsInsideRightMouseButtonPressEvent in FWidgetState) and
    +             (qtwsHiddenInsideRightMouseButtonPressEvent in FWidgetState) then
    +          begin
    +            Exclude(FWidgetState, qtwsHiddenInsideRightMouseButtonPressEvent);
    +            Exclude(FWidgetState, qtwsInsideRightMouseButtonPressEvent);
    +            if (LastMouse.Widget = Sender) and
    +              (QApplication_mouseButtons and QtRightButton <> 0) then
    +            begin
    +              AContextEvent := QContextMenuEvent_create(QContextMenuEventMouse, @LastMouse.MousePos);
    +              QCoreApplication_postEvent(Sender, AContextEvent);
    +            end;
    +          end;
    +          {$ENDIF}
    +        end;
           QEventHide:
             begin
               if QWidget_mouseGrabber() = Widget then
                 ReleaseCapture;
               SlotShow(False);
    +          {$IFDEF MSWINDOWS}
    +          if qtwsInsideRightMouseButtonPressEvent in FWidgetState then
    +            Include(FWidgetState, qtwsHiddenInsideRightMouseButtonPressEvent);
    +          {$ENDIF}
             end;
           QEventClose:
             if not SlotClose then
    @@ -3328,12 +3351,26 @@
             QtRightButton: Msg.Msg := CheckMouseButtonDown(1);
             QtMidButton: Msg.Msg := CheckMouseButtonDown(2);
           end;
    +
    +      {$IFDEF MSWINDOWS}
    +      if (QEvent_type(Event) = QEventMouseButtonPress) and
    +          (MButton = QtRightButton) then
    +        Include(FWidgetState, qtwsInsideRightMouseButtonPressEvent);
    +      {$ENDIF}
    +
           NotifyApplicationUserInput(LCLObject, Msg.Msg);
     
           if not CanSendLCLMessage or (Sender = nil) then
             exit(True);
     
           DeliverMessage(Msg, True);
    +
    +      {$IFDEF MSWINDOWS}
    +      if (QEvent_type(Event) = QEventMouseButtonPress) and
    +        (MButton = QtRightButton) then
    +          Exclude(FWidgetState, qtwsInsideRightMouseButtonPressEvent);
    +      {$ENDIF}
    +
           // Check if our objects exists since LCL can destroy object during
           // mouse events...
           if CanSendLCLMessage and (Sender <> nil) then
    
    issue22943.diff (3,052 bytes)

Relationships

related to 0026759 closedZeljan Rikalo Drag'n'drop is broken with QT bindings 

Activities

Zeljan Rikalo

2012-09-23 09:10

developer   ~0062581

Yes, bug exists on qt win32 with trunk lazarus too (used latest bindings + qt 4.8.3).

Andrey Zubarev

2013-09-10 19:54

reporter   ~0069896

Lazarus 1.1 r42526M FPC 2.7.1 i386-win32-qt
bug is present, all as described in the issue

Zeljan Rikalo

2014-02-16 20:11

developer  

issue22943.diff (3,052 bytes)
Index: lcl/interfaces/qt/qtwidgets.pas
===================================================================
--- lcl/interfaces/qt/qtwidgets.pas	(revision 44094)
+++ lcl/interfaces/qt/qtwidgets.pas	(working copy)
@@ -59,7 +59,8 @@
 
   {state is setted up only when LCL is doing changes.}
   TQtWidgetState = (qtwsColorUpdating, qtwsFontUpdating, qtwsSizeUpdating,
-    qtwsPositionUpdating);
+    qtwsPositionUpdating, qtwsInsideRightMouseButtonPressEvent,
+    qtwsHiddenInsideRightMouseButtonPressEvent);
 
   TQtWidgetStates = set of TQtWidgetState;
 
@@ -2342,6 +2343,7 @@
   QtEdit: IQtEdit;
   R: TRect;
   Pt: TQtPoint;
+  AContextEvent: QContextMenuEventH;
 begin
   BeginEventProcessing;
   Result := False;
@@ -2385,12 +2387,33 @@
               QtWidgetSet.InvalidateWidgetAtCache;
           end;
         end;
-      QEventShow: SlotShow(True);
+      QEventShow:
+        begin
+          SlotShow(True);
+          {$IFDEF MSWINDOWS}
+          if (qtwsInsideRightMouseButtonPressEvent in FWidgetState) and
+             (qtwsHiddenInsideRightMouseButtonPressEvent in FWidgetState) then
+          begin
+            Exclude(FWidgetState, qtwsHiddenInsideRightMouseButtonPressEvent);
+            Exclude(FWidgetState, qtwsInsideRightMouseButtonPressEvent);
+            if (LastMouse.Widget = Sender) and
+              (QApplication_mouseButtons and QtRightButton <> 0) then
+            begin
+              AContextEvent := QContextMenuEvent_create(QContextMenuEventMouse, @LastMouse.MousePos);
+              QCoreApplication_postEvent(Sender, AContextEvent);
+            end;
+          end;
+          {$ENDIF}
+        end;
       QEventHide:
         begin
           if QWidget_mouseGrabber() = Widget then
             ReleaseCapture;
           SlotShow(False);
+          {$IFDEF MSWINDOWS}
+          if qtwsInsideRightMouseButtonPressEvent in FWidgetState then
+            Include(FWidgetState, qtwsHiddenInsideRightMouseButtonPressEvent);
+          {$ENDIF}
         end;
       QEventClose:
         if not SlotClose then
@@ -3328,12 +3351,26 @@
         QtRightButton: Msg.Msg := CheckMouseButtonDown(1);
         QtMidButton: Msg.Msg := CheckMouseButtonDown(2);
       end;
+
+      {$IFDEF MSWINDOWS}
+      if (QEvent_type(Event) = QEventMouseButtonPress) and
+          (MButton = QtRightButton) then
+        Include(FWidgetState, qtwsInsideRightMouseButtonPressEvent);
+      {$ENDIF}
+
       NotifyApplicationUserInput(LCLObject, Msg.Msg);
 
       if not CanSendLCLMessage or (Sender = nil) then
         exit(True);
 
       DeliverMessage(Msg, True);
+
+      {$IFDEF MSWINDOWS}
+      if (QEvent_type(Event) = QEventMouseButtonPress) and
+        (MButton = QtRightButton) then
+          Exclude(FWidgetState, qtwsInsideRightMouseButtonPressEvent);
+      {$ENDIF}
+
       // Check if our objects exists since LCL can destroy object during
       // mouse events...
       if CanSendLCLMessage and (Sender <> nil) then
issue22943.diff (3,052 bytes)

Zeljan Rikalo

2014-02-16 20:12

developer   ~0073098

Please test under windows with attached patch. It's workaround for qt misbehaviour in this case (contextMenuEvent isn't send).

Zeljan Rikalo

2014-02-26 17:26

developer   ~0073330

Please test and close if ok.

Issue History

Date Modified Username Field Change
2012-09-21 22:35 tcaduto New Issue
2012-09-21 22:35 tcaduto Widgetset => QT
2012-09-22 15:26 Zeljan Rikalo Status new => assigned
2012-09-22 15:26 Zeljan Rikalo Assigned To => Zeljan Rikalo
2012-09-23 09:10 Zeljan Rikalo LazTarget => -
2012-09-23 09:10 Zeljan Rikalo Note Added: 0062581
2012-09-23 09:10 Zeljan Rikalo Status assigned => confirmed
2012-09-27 18:12 Zeljan Rikalo LazTarget - => 1.2
2013-09-10 19:54 Andrey Zubarev Note Added: 0069896
2014-01-14 15:22 Martin Friebe Target Version => 1.2.0
2014-02-16 20:11 Zeljan Rikalo File Added: issue22943.diff
2014-02-16 20:12 Zeljan Rikalo Note Added: 0073098
2014-02-16 20:12 Zeljan Rikalo Status confirmed => feedback
2014-02-26 17:26 Zeljan Rikalo Fixed in Revision => 44249
2014-02-26 17:26 Zeljan Rikalo Note Added: 0073330
2014-02-26 17:26 Zeljan Rikalo Status feedback => resolved
2014-02-26 17:26 Zeljan Rikalo Fixed in Version => 1.3 (SVN)
2014-02-26 17:26 Zeljan Rikalo Resolution open => fixed
2014-09-22 08:12 Zeljan Rikalo Relationship added related to 0026759