qtabwidget stylsheet with tabbar cornerwidget

  • i want to fix this cornerwidget .
    this is the cornerwidget code.it dose not position right.always it place little down the top line.My gui is in UI.not in code.

        QToolButton* maximize = new QToolButton(ui->windows);
    //    m_exit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
        ui->windows->setCornerWidget(maximize, Qt::TopRightCorner);

    Here is the qstylesheet of QTabWIdget.

     QTabWidget::pane {
        border: 1px solid black;
        background: silver;
    QTabWidget::tab-bar { 
        alignment: left;
    /* Style the tab using the tab sub-control. Note that
        it reads QTabBar _not_ QTabWidget */
    QTabBar::tab {
         background: silver;
        text-align: left;
        top: 1px;
    	border-style: none;
    	min-width: 120px;
        min-height: 30px;
    QTabBar::tab:selected {
        text-align: left;
        background: white;
    	font-weight: bold;
    QTabBar::tab:!selected {
    	font-weight: normal;

    i made the cornerwidget hight as same as Qtabwidget.When there is no tab opened cornerwidget alling right way . But when i open a tab there this a gap. it is also goes little right
    see the bottom pictures.

    no tab opened


    tab opened


  • Lifetime Qt Champion


    Can you provide a minimal compilable example that shows the complete behaviour ? Having to guess how you setup the widgets with designer is not the nicest to test what is happening to you.

    By the way, what version of Qt are you using ? On what platform ?

  • i am linux manjaro.QT 5.10 .
    I made my whole gui with qt designer excpet the tab corner widget.as it is not possible to implement with designer.
    the widget will maximize the window.

Log in to reply

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