Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved qtabwidget stylsheet with tabbar cornerwidget

    General and Desktop
    2
    4
    873
    Loading More Posts
    • 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
      saber last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • S
          saber last edited by

          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 Reply Quote 0
          • S
            saber last edited by

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post