View Issue Details

IDProjectCategoryView StatusLast Update
0034589LazarusIDEpublic2018-12-02 10:14
ReporterZeljan RikaloAssigned ToZeljan Rikalo 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0034589: OI regression: OI editor is at wrong position after selecting another control
DescriptionCreate simple form with few components. Click first one, click property "Name" in OI, now click another component, and another etc ... editor is moving up, but "Name" property is still at the bottom of OI. Note that this happens with 59613 too, so before latest OI optimizations, but unfortunatelly I don't know when issue started.

See attached screenshoot - ShowHint property should be selected, but checkbox is at the position of property Left

Lazarus 2.1.0 r59632 FPC 3.0.4 x86_64-linux-qt
TagsNo tags attached.
Fixed in Revision59637
LazTarget-
WidgetsetQT, QT5
Attached Files
  • oieditorwrongposition.png (24,747 bytes)
    oieditorwrongposition.png (24,747 bytes)
  • qt_sw_scrollchildren.diff (1,044 bytes)
    Index: lcl/interfaces/qt/qtwinapi.inc
    ===================================================================
    --- lcl/interfaces/qt/qtwinapi.inc	(revision 59632)
    +++ lcl/interfaces/qt/qtwinapi.inc	(working copy)
    @@ -5691,6 +5691,8 @@
     var
       R: TRect;
       W: TQtWidget;
    +  i: integer;
    +  AControl: TControl;
     begin
       Result := False;
       if (HWND = 0) then exit;
    @@ -5697,8 +5699,25 @@
     
       W := TQtWidget(HWND);
       if ((Flags and SW_SCROLLCHILDREN) <> 0) then
    -    W.scroll(dx, dy, nil)
    -  else
    +  begin
    +    if PrcScroll <> nil then
    +      R := PrcScroll^
    +    else
    +      R := W.getClientBounds;
    +    W.scroll(dx, dy, @R);
    +    if Assigned(W.LCLObject) then
    +    begin
    +      for i := 0 to W.LCLObject.ControlCount - 1 do
    +      begin
    +        AControl := W.LCLObject.Controls[i];
    +        if AControl is TWinControl then
    +        begin
    +          AControl.Left := AControl.Left + dx;
    +          AControl.Top := AControl.Top + dy;
    +        end;
    +      end;
    +    end;
    +  end else
       if (PrcScroll = nil) then
       begin
         R := W.getClientBounds;
    

Relationships

related to 0034539 closedMartin Friebe Painting artefacts in object inspector when scrolling 

Activities

Zeljan Rikalo

2018-11-23 10:02

developer  

oieditorwrongposition.png (24,747 bytes)
oieditorwrongposition.png (24,747 bytes)

Michael Van Canneyt

2018-11-23 10:07

administrator   ~0112117

Ah ! I recognize this bug.

Delphi has it too since several versions, it is a real pain in the tush... :)

Zeljan Rikalo

2018-11-23 11:34

developer   ~0112120

r59604 is problematic. Seem that Qt does not like SW_SCROLLCHILDREN in this case.
https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&root=lazarus&revision=59604

Juha Manninen

2018-11-23 12:09

developer   ~0112121

Zeljko was faster. I also bisected the quilty revision to be r59604.

Zeljan Rikalo

2018-11-23 12:32

developer   ~0112124

Gtk2 does not implement SW_SCROLLCHILDREN at all so that's why it works.
Qt uses it's internal scroll() which really moves all QWidget child types

Zeljan Rikalo

2018-11-23 12:44

developer  

qt_sw_scrollchildren.diff (1,044 bytes)
Index: lcl/interfaces/qt/qtwinapi.inc
===================================================================
--- lcl/interfaces/qt/qtwinapi.inc	(revision 59632)
+++ lcl/interfaces/qt/qtwinapi.inc	(working copy)
@@ -5691,6 +5691,8 @@
 var
   R: TRect;
   W: TQtWidget;
+  i: integer;
+  AControl: TControl;
 begin
   Result := False;
   if (HWND = 0) then exit;
@@ -5697,8 +5699,25 @@
 
   W := TQtWidget(HWND);
   if ((Flags and SW_SCROLLCHILDREN) <> 0) then
-    W.scroll(dx, dy, nil)
-  else
+  begin
+    if PrcScroll <> nil then
+      R := PrcScroll^
+    else
+      R := W.getClientBounds;
+    W.scroll(dx, dy, @R);
+    if Assigned(W.LCLObject) then
+    begin
+      for i := 0 to W.LCLObject.ControlCount - 1 do
+      begin
+        AControl := W.LCLObject.Controls[i];
+        if AControl is TWinControl then
+        begin
+          AControl.Left := AControl.Left + dx;
+          AControl.Top := AControl.Top + dy;
+        end;
+      end;
+    end;
+  end else
   if (PrcScroll = nil) then
   begin
     R := W.getClientBounds;

Zeljan Rikalo

2018-11-23 12:45

developer   ~0112126

I've attached possible patch for Qt. Maybe we should use same concept for gtk2 in case of SW_SCROLLCHILDREN.

Juha Manninen

2018-11-23 13:11

developer   ~0112133

> Qt uses it's internal scroll() which really moves all QWidget child types

Why exactly is that a problem? I have trouble understanding the widgetset issues.

Martin Friebe

2018-11-23 13:43

manager   ~0112135

Last edited: 2018-11-23 13:46

View 2 revisions

The Patch is close... I think.

IIRC, windows sends a WM_SizePos message, so that is how coordinates are updated.
QT, should not do that directly, but rather send a message too.

Though that is IIRC, needs to be checked that w32 really sends the message.

- Also not sure, if/how visible/invisible controls should be affected.

- It also may need to check, if a control is inside the scrolled rect (or partly inside). On each of the 3 states the control may be affected or not affected

Martin Friebe

2018-11-23 13:58

manager   ~0112136

Last edited: 2018-11-23 14:00

View 2 revisions

I can commit a 2 line workaround in OI. This would be 100% save for merging to fixes2_0. (In case the fix in qt, will be too complex for that)

Index: objectinspector.pp
===================================================================
--- objectinspector.pp (revision 59627)
+++ objectinspector.pp (working copy)
@@ -1915,6 +1915,10 @@
       ValueEdit.MaxLength:=NewRow.Editor.GetEditLimit;
       ValueEdit.Text:=NewValue;
     end;
+ {$IF defined(LCLQt) or defined(LCLQt4) or defined(LCLQt5)}
+ if FCurrentEdit <> nil then
+ FCurrentEdit.Top := -FCurrentEdit.Height-1;
+ {$ENDIF}
     AlignEditComponents;
     if FCurrentEdit<>nil then
     begin

Zeljan Rikalo

2018-11-23 14:07

developer   ~0112137

Ok, I've found what's exact problem. It's lclQt implementation in SlotMove which does not allow non spontaneous event to be sent to the LCL.

Zeljan Rikalo

2018-11-23 14:08

developer   ~0112138

@Martin, please do not touch OI part. I'll fix it in Qt.

Zeljan Rikalo

2018-11-23 14:43

developer   ~0112140

Fixed :)

Vojtech Cihak

2018-11-23 15:10

reporter   ~0112141

I met this problem too, yesterday. It's OK now, with r.59638+Qt4. Thanks.

Zeljan Rikalo

2018-12-02 10:14

developer   ~0112315

Merged to 2.0RC3

Issue History

Date Modified Username Field Change
2018-11-23 10:02 Zeljan Rikalo New Issue
2018-11-23 10:02 Zeljan Rikalo File Added: oieditorwrongposition.png
2018-11-23 10:07 Michael Van Canneyt Note Added: 0112117
2018-11-23 11:34 Zeljan Rikalo Note Added: 0112120
2018-11-23 12:08 Juha Manninen Relationship added related to 0034539
2018-11-23 12:09 Juha Manninen Note Added: 0112121
2018-11-23 12:32 Zeljan Rikalo Note Added: 0112124
2018-11-23 12:44 Zeljan Rikalo File Added: qt_sw_scrollchildren.diff
2018-11-23 12:45 Zeljan Rikalo Note Added: 0112126
2018-11-23 13:11 Juha Manninen Note Added: 0112133
2018-11-23 13:41 Martin Friebe Assigned To => Martin Friebe
2018-11-23 13:41 Martin Friebe Status new => assigned
2018-11-23 13:43 Martin Friebe Note Added: 0112135
2018-11-23 13:44 Martin Friebe Assigned To Martin Friebe =>
2018-11-23 13:44 Martin Friebe Status assigned => acknowledged
2018-11-23 13:46 Martin Friebe Note Edited: 0112135 View Revisions
2018-11-23 13:58 Martin Friebe Note Added: 0112136
2018-11-23 14:00 Martin Friebe Note Edited: 0112136 View Revisions
2018-11-23 14:07 Zeljan Rikalo Note Added: 0112137
2018-11-23 14:08 Zeljan Rikalo Note Added: 0112138
2018-11-23 14:08 Zeljan Rikalo Assigned To => Zeljan Rikalo
2018-11-23 14:08 Zeljan Rikalo Status acknowledged => assigned
2018-11-23 14:43 Zeljan Rikalo Fixed in Revision => 59637
2018-11-23 14:43 Zeljan Rikalo Note Added: 0112140
2018-11-23 14:43 Zeljan Rikalo Status assigned => resolved
2018-11-23 14:43 Zeljan Rikalo Resolution open => fixed
2018-11-23 15:10 Vojtech Cihak Note Added: 0112141
2018-12-02 10:14 Zeljan Rikalo Note Added: 0112315
2018-12-02 10:14 Zeljan Rikalo Status resolved => closed