c++ - Set alignment of QGroupBox title -
i try programmatically set alignment of title of qgroupbox. according documentation try in following way:
mainwidget::mainwidget (qwidget * parent) : qwidget (parent) { setwindowtitle (tr ("qgropbox title alignment issue") ); qgroupbox * group = new qgroupbox ("group title", this); qvboxlayout * layouttop = new qvboxlayout (); layouttop->addwidget (group); group->setalignment (qt::alignhcenter); this->setlayout (layouttop); } but have got unexpected result , title aligned left-hand side of group box.
such behaviour have got environment:
- debian 9.0 (sid);
- qt 5.5.1 (installed repository);
- xmonad de.
the same behaviour have got next environment:
- ubuntu 15.10;
- qt 5.4 (installed manually using offline-installer);
- kde.
but! if use qt installed repository (qt 5.4.2) title aligned centre default. if change align left not changed.
i try find solution google, haven't found similar questions , bad sign , means thing wrong.
so question is: why can't manage alignment of group box title.
it seems in qt 5.5.1 there bug visual styles when qgroupbox title alignment not taken account when title's rect computed: qtbug-49068: qgroupbox title not follow alignment fusion style.
you can download recent version git repository, build , check if bug has been fixed (is has been fusion style: qt commit 139953).
if bug still occurs, think should submit issue qt bugtracker.


Comments
Post a Comment