I am using QTabWidget class of Qt. In TabWidget i am dynamically adding new tab and setting the TextElideMode to right to display the toolbutton in tabBar.
tabWidget = new QTabWidget(this);
m_addNewTab = new QWidget(tabWidget);
m_addNewGridLayout = new QGridLayout(m_addNewTab);
m_addNewWebView = new MyWebView(m_addNewTab);
widget = new QWidget(m_addNewTab);
tb = new QToolButton(widget);
tb->setFixedHeight(20);
tb->setText("<");
tb1 = new QToolButton(widget);
tb1->setFixedHeight(20);
tb1->setText(">");
m_horizontalLayout = new QHBoxLayout(widget);
m_horizontalLayout->addWidget(tb);
m_horizontalLayout->addWidget(tb1);
Please see the below screen shot for the output of the sample application. When the current tab is selected then both the toolbutton should display and text elide mode should be right but when tab is not selected then toolbutton should not be displayed but text elide mode should be left.
Here in below screen shot i am able to hide and show the toolbutton depending on tab selection but when the tab is not selected text elide mode is setting as right so we are able to see the unnecessary space (check last tab). Setting the text elide mode left also not working because we have already set the toolbutton at left side.
Can someone guide me how to remove the space (last tab from screen shot) when there is not tab selected ?