Seite 1 von 1

Problem mit QTabWidget bzw TabBar und StyleSheet

Verfasst: 22. Juli 2009 23:43
von QtNoob2008
Hallo,

habe das folgende Problem.
Ich benötige ein Tab Widget welches keine ScrollButtons verwendet bzw. anzeigt. Ich möchte eine bestimmte Anzahl an Tab Reitern darstellen, was auch funktioniert. Das Problem was ich aber habe ist, das wenn man die Tabs von links nach rechts "durchschaltet" die Darstellung wie gewünscht ist. Wechsel ich die Richtung von rechts nach links so ist die Darstellung nachdem ein nicht sichtbares Tab dargestellt wird, so wie in der folgenden Abbildung dargestellt.

Hat jemand schon einmal das selbe Problem gehabt ?

Hier noch das Stylesheet zum Testen, gar nicht groß anders als das Example:

Code: Alles auswählen

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;
 }

Verfasst: 23. Juli 2009 13:32
von spawnb
Hi,

was ist den mit:

Code: Alles auswählen

tabWidget->setUsesScrollButtons(false);

Verfasst: 23. Juli 2009 14:40
von QtNoob2008
Hallo,
das habe ich schon probiert, das würde wunderbar funktionieren, aber wenn ich dann z.B. Tab 5 (ausserhalb des Bereichs anwähle üner setCurrentIndex ). Dann wird das Tab also das "Pane" (der Inhaltsbereich unten ) aktualisiert, aber das Tab rutscht nicht in den sichbaren Bereich in der Tabbar.
Scheint so als wäre es ausserhalb des sichtbaren tabbar bereichs aktiv