View Issue Details

IDProjectCategoryView StatusLast Update
0038328LazarusLCLpublic2021-05-07 17:51
Reporterfunlw65 Assigned Towp  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.1 (SVN) 
Summary0038328: Qt5 TLabel in vertical rotation, text gets clipped on resize in the designer
DescriptionWhen you set the Font of the TLabel in vertical rotation (900 or 2600 rotation value) and then try to resize the rectangle of the label in Designer, the text (caption) gets clipped. I've made a little movie on youtube where you can see the behavior.
https://youtu.be/v-a7QVfvuKU

The compiled form will show just the first two letters of the text/caption in Qt5 case, and if you use the gtk2 widget set, the label text will not be shown at all.
Steps To Reproduce1. Select the TLabel and place it in the form;
2. Set the Autosize attribute to False;
3. Re-dimension the label's frame to form a square to see where the text goes when you rotate it;
4. Set the rotation of the font to 900 or 2600 - now the text goes to a vertical position;
5. Align it Top or Bottom (BTW, only Top works correctly);
6. Now, because our frame is in a square form, try to resize it to enclose the label. You will see that approaching the text, it will get clipped by "an invisible rectangle - you really have to see the video, the animation there is funny".
TagsNo tags attached.
Fixed in Revision64361
LazTarget-
WidgetsetQT5
Attached Files

Activities

wp

2021-01-07 18:56

developer   ~0128151

Not only QT5, all widgetsets. The rectangle in which the text is enclosed does not follow the rotation of the text.

wp

2021-01-07 19:15

developer   ~0128152

Here is a demo which shows that clipping is an issue, too.
- Run the demo
- Turn off AutoSize, set Alignment to taCenter and Layout to tlCenter
- Slightly shift the scrollbar to the right in order to rotate the label. Although the label bounds are "far" away the text is clipped approximately at the bounds of the autosized label. riginal

When I add DT_NOCLIP to the flags passed to the DrawText call at the end of TCustomLabel.DoDrawText (in customlabel.inc) the clipping goes away.

However, there is still the issue that during rotation the bounds of the AutoSized label do not change such that the label text is always enclosed.

Trevor Roydhouse

2021-01-07 21:44

reporter   ~0128158

Confirmed an issue with Cocoa widgetset in Lazarus 2.1.0. Rotating the text of the label causes the label text to disappear. Increasing the angle degree by degree heading to 900 (90 degrees), the text moves in the right direction but out of bounds at the top until it is no longer visible within the label bounds at all.

wp

2021-01-07 21:53

developer   ~0128159

This is a regression caused by r64173, "TCustomLabel: DoDrawText for Delphi compatibility and for unifying size calculation and painting" by Ondrej.

wp

2021-01-09 12:14

developer   ~0128196

Supports rotation about any angle now. No support yet for multiline text (Delphi XE10.3 does not have this either).

Please test and close if ok.

Trevor Roydhouse

2021-01-09 21:09

reporter   ~0128222

Confirmed fixed in Cocoa widgetset

Ondrej Pokorny

2021-05-07 17:01

developer   ~0130789

@wp: are you sure it is a regression? AFAIK it didn't work before either. (It doesn't change anything, I am just trying to understand what is going on :) ).

wp

2021-05-07 17:39

developer   ~0130790

Hmmm... Normally, when I "blame" a particular revision for causing an issue this is based on bisection of the svn commits in history. But here, when I update to r64172 - the one before yours - I still see the error. So - I am sorry, I have no idea how the sentence in note 0128159 came to my mind. (It is scaring that I tend to forget what I did four months ago...)

Ondrej Pokorny

2021-05-07 17:51

developer   ~0130791

No problem :)

Issue History

Date Modified Username Field Change
2021-01-07 18:51 funlw65 New Issue
2021-01-07 18:56 wp Note Added: 0128151
2021-01-07 19:15 wp Note Added: 0128152
2021-01-07 19:15 wp File Added: 38328 - RotatedLabels.zip
2021-01-07 21:44 Trevor Roydhouse Note Added: 0128158
2021-01-07 21:49 wp Assigned To => Ondrej Pokorny
2021-01-07 21:49 wp Status new => assigned
2021-01-07 21:53 wp Note Added: 0128159
2021-01-09 12:13 wp Assigned To Ondrej Pokorny => wp
2021-01-09 12:14 wp Status assigned => resolved
2021-01-09 12:14 wp Resolution open => fixed
2021-01-09 12:14 wp Fixed in Revision => 64361
2021-01-09 12:14 wp LazTarget => -
2021-01-09 12:14 wp Widgetset QT5 => QT5
2021-01-09 12:14 wp Note Added: 0128196
2021-01-09 21:09 Trevor Roydhouse Note Added: 0128222
2021-05-07 17:01 Ondrej Pokorny Note Added: 0130789
2021-05-07 17:39 wp Note Added: 0130790
2021-05-07 17:51 Ondrej Pokorny Note Added: 0130791