[Qt-interest] Margins in QTabWidget
Ben Swerts
benswerts at telenet.be
Sat May 2 12:13:08 CEST 2009
Hi Stan,
You can do it both in designer as in code. I assume that every item has a
layout. Then you can select one of the tabs (This is not possible by
clicking on a tab. You'll have to use the Object Inspector). At the bottom
of the Property Editor will be entries concerning the layout. Changing these
numbers will have the desired effect.
If you want to do it in code, you'll have to use QLayout::setContentsMargins
on the layout for each tab.
Hope it helps.
Greets,
Ben
> Hello all,
>
> I cannot figure out how to change the margins for the children of a
> QTabWidget. For example, in Qt Creator I have:
>
> MainWindow (QMainWindow)
> centralWidget (QWidget)
> tabWidget (QTabWidget)
> tab (QWidget)
> textEdit (QTextEdit)
> tab_2 (QWidget)
>
> I want to shrink the space around textEdit inside the tab pane. There
> appear to be no margin settings in ui designer that will do this. I
> have tried manipulating all sorts of bounding rectangles within
>
> ui->tabWidget->childrenRect()
> ui->tabWidget->childrenRegion()
> ui->tab->childrenRect()
> ui->tab->childrenRegion()
> etc., etc.
>
> with a bunch of QRect move methods, but nothing seems to have any
> effect on the margins.
>
> Thanks for any help.
>
> Stan
More information about the Qt-interest-old
mailing list