PDA

View Full Version : Problem with TabBar und StyleSheet



QtNoob
23rd July 2009, 00:06
hi,

i have a problem with using a stylesheet and a tabbar (QTabWidget).

I need a tab bar or tab widget which should be without the standard scrollbutton. The tab bar should show several tabs, e.g. four visible and the rest shall be not shown

When i switch to the tabs from left to right, everything is shown as i expect.
But if i change the direction, and a not visible tab "get into the visible area" the tabs are displaced for a few pixel. Look at the added picture.

Maybe someone has the same problem and can help me?!

Here the used stylesheet, which is from the given style sheet reference example with only a few changes...


QTabWidget::pane { /* The tab widget frame */
border-top: 2px solid #C2C7CB;
position: absolute;
}

QTabWidget::tab-bar {
width: 416px;
left:0px;
}

/* Style the tab using the tab sub-control. Note that
it reads QTabBar _not_ QTabWidget */
QTabBar::tab {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
border: 2px solid #C4C4C3;
border-bottom-color: #C2C7CB; /* same as the pane color */
border-top-left-radius: 4px;
border-top-right-radius: 4px;
width: 100px;
}

QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #fafafa, stop: 0.4 #f4f4f4,
stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
}

QTabBar::tab:selected {
border-color: #9B9B9B;
border-bottom-color: #C2C7CB; /* same as pane color */
}

QTabBar::tear {
width: 0px;
}

QTabBar::scroller { /* the width of the scroll buttons */
width: 0px;
}