Bug 179294

Summary: popup dialog truncates messages making them unreadable
Product: [Frameworks and Libraries] kdelibs Reporter: Andrey Borzenkov <arvidjaar>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: CONFIRMED ---    
Severity: normal CC: andresbajotierra, cfeck, fhimpe, finex, ivo, kde, metellius, mpartap, ogoffart, pascal
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch for kmessagebox to make them expand up to 80% (instead of 50%)
A popup dialog totally unusable

Description Andrey Borzenkov 2009-01-01 17:02:19 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

See screenshot https://qa.mandriva.com/attachment.cgi?id=11692 (Mandriva bug https://qa.mandriva.com/show_bug.cgi?id=46070). In the middle of the message text is truncated and this makes the message absolutely meaningless.

BTW I have strong feeling that KDE computes not the display width but raw length of messages in bytes. Which for UTF-8 makes them twice as long.
Comment 1 Thomas McGuire 2009-01-04 14:30:48 UTC
That would be a general kdelibs bug, reassigning to kdelibs.
Comment 2 FiNeX 2009-01-05 00:09:38 UTC
*** Bug 179649 has been marked as a duplicate of this bug. ***
Comment 3 FiNeX 2009-01-05 00:09:56 UTC
This attachment is another example:
  http://bugs.kde.org/attachment.cgi?id=29908
Comment 4 Dario Andres 2009-01-12 22:33:14 UTC
*** Bug 180463 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2009-02-05 22:45:50 UTC
*** Bug 183300 has been marked as a duplicate of this bug. ***
Comment 6 Dario Andres 2009-02-10 14:13:21 UTC
*** Bug 183851 has been marked as a duplicate of this bug. ***
Comment 7 Harald Hvaal 2009-03-03 14:14:35 UTC
For reference, here's how andreas pakulat described the problem on the mailing lists:

Well, unfortunately Qt cannot do proper word-wrapping, especially when
url's are involved. If the url is "long enough" you'll get a message box
thats larger then the screen. Thats why at some point KMessageBox had a
scrollbar, but it seems that was removed now in favor of elided text. I
agree that this solution is not really acceptable and suggest you discuss
this on kde-core-devel.
Comment 8 Marcel Partap 2009-03-03 14:34:27 UTC
On bug #128090 i attached a fix for this problem which makes the maximum dialog size expand up to 80% of screen width, with word-wrapping enabled at >50% of screen width. For me that has fixed both problems fine.
Comment 9 Marcel Partap 2009-03-17 22:05:40 UTC
Created attachment 32215 [details]
patch for kmessagebox to make them expand up to 80% (instead of 50%)

(actually the patch belongs here not in that other bug)
Comment 10 Olivier Goffart 2009-04-02 00:38:45 UTC
label->minimumWidth() should be used instead of the sizeHint, at least at the second pass.
(And you might want to set the width manually on the messagebox in case it is too big)
Comment 11 Jaime Torres 2009-04-20 18:13:17 UTC
Created attachment 32961 [details]
A popup dialog totally unusable

Unfortunately, I've lost the ability to resize the VirtualBox X server, so it uses 640x480. There, the dialog is not placed at the center of the screen, and it cuts the text and the buttons text.
Comment 12 Dario Andres 2009-04-25 12:56:24 UTC
Should a ScrollArea be used to avoid cases like the last one ?
Comment 13 Marcel Partap 2009-04-25 13:17:48 UTC
Jaime can you please try this with my patch?
Else, if noone has any objections, i'll just commit this as i am using it since months without problems..
Comment 14 Andreas Pakulat 2009-04-25 13:37:24 UTC
(In reply to comment #12)
> Should a ScrollArea be used to avoid cases like the last one ?

Thats what I did for KDE4.0, but apparently too many people didn't like it, so it was reverted and now we again have the joy of being unable to see the important parts of message boxes.
Comment 15 Dario Andres 2009-04-25 13:40:27 UTC
May be it should be only used on "extreme" cases like the last one.
Or setup a layout properly to avoid the dialog being resized too much (when space on screen is available to use)
Comment 16 Ivo Anjo 2009-04-25 13:58:37 UTC
(In reply to comment #14)
> (In reply to comment #12)
> > Should a ScrollArea be used to avoid cases like the last one ?
> 
> Thats what I did for KDE4.0, but apparently too many people didn't like it, so
> it was reverted and now we again have the joy of being unable to see the
> important parts of message boxes.

I think the problem in 4.0 is that the scroll was used too often, even when the dialog clearly had space to show the entire message without scrolling, it didn't expand properly and instead showed the scrollbar.

I think the solution should be to try to show the message without scrolling (and of course, no ellipsing) while keeping the dialog at a reasonable size (e.g. no 640x480 dialog on a 640x480 screen), and if that isn't enough to display the message, then switch to having a scrollable message.
Comment 17 Christoph Feck 2010-09-01 02:00:56 UTC
From what I see in the code, we allow large sizes of the message text label, but only enable scroll bars when the height of the text would not fit. The eliding of long lines still is implemented, so something like that on the first screen shot is still possible.

I would suggest to use QTextOption::WrapAtWordBoundaryOrAnywhere which can hard-break URLs etc. even at non word boundaries, but we have to use a custom widget instead of QLabel.