Bug 162033

Summary: KMessageBox is not large enough thus displaying scrollbars
Product: [Frameworks and Libraries] kdelibs Reporter: Gaël de Chalendar (aka Kleag) <kleagg>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: uwolfer
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: screenshot with the faulty dialog

Description Gaël de Chalendar (aka Kleag) 2008-05-13 12:25:21 UTC
Version:            (using Devel)
Installed from:    Compiled sources
OS:                Linux

When using KMessageBox, for example with the static methods information or warningYesNoCancel, sometimes the dialog is not large enough and a scrollbar is displayed.
It should not be the case.

I'm not sure, but it could be only with localized messages using placeholders (%1, etc).

Is the dialog size computed before the full string ?
Comment 1 Andreas Pakulat 2008-05-13 14:03:22 UTC
Thats actually by purpose, because we can't control the length of the messages that are displayed. However there seems to be a bug right now somewhere that adds scrollbars even if the message would fit into the message box maximum size (1/4th of the screen size).
Comment 2 Gaël de Chalendar (aka Kleag) 2008-05-13 15:33:44 UTC
Created attachment 24750 [details]
screenshot with the faulty dialog

Here is the code producing this screenshot
      KMessageBox::information(
	  game(),
	  i18n("%1, your goal will be displayed. Please make sure that no other
player can see it !",(*it)->name()),
	  i18n("KsirK - Displaying Goal"));

Placing the text on one line would be larger than 1/4 of the screen, but here,
it is splitted in a few line while putting the scrollbar.

Note that if I put a "<br>" between the words "Please" and "make", there is no
more a scrollbar, but the text is anyway displayed on 4 lines instead of 2.
Comment 3 Urs Wolfer 2008-05-17 22:29:19 UTC
I have played around with it for quite some time, but not really found a solution.

The following line fixes the issue in all cases I have tested, but it's a rather ugly workaround:
messageScrollArea->setMinimumHeight(messageScrollArea->sizeHint().height() * 1.15);
Comment 4 Gaël de Chalendar (aka Kleag) 2008-06-16 16:32:55 UTC
This seems to be solved at revision 821062