Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qtabwidget stylsheet with tabbar cornerwidget
Forum Updated to NodeBB v4.3 + New Features

qtabwidget stylsheet with tabbar cornerwidget

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saber
    wrote on last edited by
    #1

    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);
        maximize->setIcon(QIcon(":/icons/maximize.svg"));
    //    m_exit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
        maximize->setFixedSize(30,30);
        maximize->setAutoRaise(true);
        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

    0_1514091633215_gg.png

    tab opened

    0_1514091357462_kk.png

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        saber
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          saber
          wrote on last edited by
          #4

          it is a bug of qt or it will work by that way.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            abiabi
            wrote on last edited by
            #5

            i facing same issue. cornerwidget is overlapping/misaligned if resized widget using set size method.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved