[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Newbie-Questions: Solving Basic Layout Issues
From:       "David Jarvie" <djarvie () kde ! org>
Date:       2011-07-14 16:10:24
Message-ID: 139d942e13079935226a2a9f4cfd6e90.squirrel () www ! sensical ! net
[Download RAW message or body]

On Thu, July 14, 2011 2:06 pm, Torbjoern Klatt wrote:
> On Wednesday 13 July 2011 (12:47:23) Christopher Reichert wrote:
>> > In the first tab I see two issues:
>> > The first is, that the LineEdit for the directory is a little to
>> short.
>> > I
>> > think, it would be nicer to be as long as the surrounding GroupBox.
>> > The second is, that the space before and after the QLabel "Additional
>> > options passed to tar:" is huge. That should be a lot smaller and the
>> > big gab should be below the subsequent LineEdit at the bottom.
>> > The same issue is on the second tab with the QLabel named "Output".
>> >
>> > My question now: What is the best way of solving these issues?
>> >
>> > I guess, I do not have to mention, that hard coding width and height
>> of
>> > the objects is not an option.
>>
>> As far as I can tell you need to set the size policy for the widgets
>> that you wish to be longer (or shorter).
>> http://doc.qt.nokia.com/latest/qwidget.html#sizePolicy-prop
>
> Thank you for this hint.
>
> Applying it as follows to a QLabel works fine:
>
>     initRunOutputLabel = new QLabel(i18nc("", "Output:"), initRun);
>     QSizePolicy *vexp = new QSizePolicy(QSizePolicy::Preferred,
> QSizePolicy::Fixed);
>     initRunOutputLabel->setSizePolicy(vexp->horizontalPolicy(), vexp-
>>verticalPolicy());
>
> However, applying it to the KUrlRequester, does not work:
>
>     selectDestinationDir = new KUrlRequester(destinationDirGroup);
>     selectDestinationDir->setMode(KFile::Directory);
>     QSizePolicy *hexp = new QSizePolicy(QSizePolicy::Expanding,
> QSizePolicy::Preferred);
>     hexp->setHorizontalStretch(1);
>     hexp->setVerticalStretch(1);
>     selectDestinationDir->setSizePolicy(hexp->horizontalPolicy(), hexp-
>>verticalPolicy());
>     selectDestinationDir->sizePolicy().setHorizontalStretch(hexp-
>>horizontalStretch());
>
> It is still not as wide as I wish.

You could try using a QHBoxLayout covering the entire row in the
QGridLayout, and add the KUrlRequester to that, setting the 'stretch'
parameter to 1. Not sure if that will be any better than what you've
already tried.

-- 
David Jarvie.
KDE developer.
KAlarm author - http://www.astrojar.org.uk/kalarm

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic