[Qt-interest] Hidden Space between QPushButtons
Alexandre Beraud
aberaud at infflux.com
Wed Apr 8 15:41:56 CEST 2009
Hi,
setSpacing(0) on your layout.
Regards,
Alex
Donal O'Connor a écrit :
> Hi There,
>
> I want to create a series of QPushButtons across the full width of the
> screen on my embedded device with no spacing between them. (i.e. Back
> to back)
>
> For each QPushButton, I want it only to be an Icon with no text. The
> sum of the total widths of all QPushButtons is 800px, the width of my
> screen resolution.
>
> Here is an example of one of the buttons:
>
> QPushButton *monitoringButton = new
> QPushButton(QIcon(":/icons/monitoringicon.png"),"x");
>
> monitoringButton->setStyleSheet("background:none; padding:0px;
> margin:0px; border-radius:0px; border:none;");
>
> monitoringButton->setIconSize(QSize(139,56));
>
> monitoringButton->setFixedSize(QSize(139,56));
>
> monitoringButton->setSizePolicy(QSizePolicy::Expanding,
>
> QSizePolicy::Expanding);
>
> monitoringButton->setAutoDefault(false);
>
> monitoringButton->setFlat(true);
>
>
> I've 5 of these. When I draw them, they over lap. I've noticed that
> there is a spacing between each, about 5 px;
>
> These QPushButtons are contained in a Horizontal Layout in a QFrame.
> The margin of the layout is 0px; I've set the alignment of the layout
> to left alignment;
>
> When I draw the first QPushButton, it works perfectly, the the extreme
> left of the screen with no spacing.
> However when I draw the next one, it is placed about 5 pixels right to
> that. However I want them to be back to back.
> This suggests to me that there is a margin on the right of each button.
>
> I am wondering if it is the spacing between the icon and text of the
> QPushButton that's the problem. Is it possible to disable the text?
>
> Here is a screen shot of the space:
> http://automon.killarneyonline.eu/files/snapshot.png
>
> Thanks,
> Donal
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
BERAUD Alexandre
Ingénieur Développement
Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site : www.infflux.com
More information about the Qt-interest-old
mailing list