[Qt-interest] How to Make a TabWidget a `CentralWidget' ?

Diego Iastrubni diegoiast at gmail.com
Tue Apr 6 13:28:53 CEST 2010


You are missing the point.

Lets assume the UI is a QWidget, and contains a QTabWidget:
QWidget *babla(this);
ui.setupUi(blabla);
setCentralWidget(blabla);
ui.tabWidget->...


Lets assume the UI is a QMainWindow and contains a QTabWidget:
ui.setupUi(this);
ui.tabWidget->...

You don't need to make the tab widget the central widget. At least not
directly... A third option might be:

class fooWindow: public QMainWindow{
  QTabWidget *tb;
  fooWindow(QWidget *parent): QMainWindow(parent)
  {
    tb = new QTabWidget(this);
    setCentralWidget(tb);
  }
};

Either you use the designer - or not. Decide how do you want to work.


On Tue, Apr 6, 2010 at 11:38 AM, Aaron Lewis <aaron.lewis1989 at gmail.com>wrote:

> Hi,
>        I've got a MainWindow , which has a QTabWidget inside. ( 2 tabs )
>
>        What i want is to make this TabWidget Central.
>
>        Normally i will use setCentralWidget(ui->tabWidget) in contruct
> function , but this ain't going to work this time.
>
>        Does anyone has any ideas ?
>
>        Thanks in advance !
>
>
> --
> Best Regards,
> Aaron Lewis - PGP: 0x4A6D32A0
> FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
> irc: A4r0n on freenode
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100406/f3efb23e/attachment.html 


More information about the Qt-interest-old mailing list