On Wednesday 30 July 2014 08:26:23 Montel Laurent wrote:
> -    KHBox *hb = new KHBox( this );
> +    QWidget *hb = new QWidget( this );
> +    QHBoxLayout *hbHBoxLayout = new QHBoxLayout(hb);
> +    hbHBoxLayout->setMargin(0);

Note that when porting from K*Box to Q*BoxLayout, that the old KDE 
class defaulted to margin=0 and spacing=0, so in this case, you 
introduced spacing.

> -            hbox->setSpacing( KDialog::spacingHint() );
> +            QWidget *hbox = new QWidget( mDateDisplay );
> +            QHBoxLayout *hboxHBoxLayout = new QHBoxLayout(hbox);
> +            hboxHBoxLayout->setMargin(0);
> +            hboxHBoxLayout->setSpacing( KDialog::spacingHint() );

In this case, the K*Box needed a setSpacing() call to get rid of the 
zero spacing. Since old Qt versions did not offer default layout 
spacing values, we used KDialog::spacingHint() so that we do not need 
to hardcode a value.

When porting to Q*BoxLayout, it is probably best to let the platform 
style decide about the actual spacing between elements, so simply 
remove the setSpacing() call in this case.

> -    KHBox *hb = new KHBox( this );
> -    hb->setSpacing( 4 );
> +    QWidget *hb = new QWidget( this );
> +    QHBoxLayout *hbHBoxLayout = new QHBoxLayout(hb);
> +    hbHBoxLayout->setMargin(0);
> +    hbHBoxLayout->setSpacing( 4 );

Please do not use hard coded spacings. If you feel the default spacing 
provided by the Qt layouts is too big, use some fraction of the font 
height as a reference.

Christoph Feck (kdepepo)

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to