Obtain widgets of different size in QTabWidget



  • I have a QTabWidget item that implements 3 different pages. The layout of the third one is bigger which adds to my other pages some margins to achieve the same size. My question is how can I get pages with different size?

    This is how I implement the pages in the constructor:

    _pwmTabsTWg = new QTabWidget(this);
    _pwmTabsTWg->addTab(initGeneralTab(),tr("General"));
    _pwmTabsTWg->addTab(initProsthesisTab(),tr("Prosthesis"));
    _pwmTabsTWg->addTab(initInfoTab(),tr("Info"));
    

    This would be how I call my widget in e.g. initInfoTab()

    QWidget *mainWidget = new QWidget(this);
    QVBoxLayout *_layout= new QVBoxLayout(this);
    
    //define and add widgets to layout
    
    mainWidget->setLayout(_layout);
    return mainWidget;
    


  • Hi,
    I would say that you should not do this even if it were possible.
    This would make the tab widget shrink (or enlarge) depending on the tab that you press. As a user of your tabwidget, this may make a tab that represents a small widget and which I've just pressed at the right border of your tabwidget vanish from under my mouse pointer when the tabwidget shrinks, which would highly irritate me.
    -Michael.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.