0

アクティブな QTabWidget タブのカスタム背景色を設定したいと思います。残念ながら、目的のセレクターがわかりません。Linux では、次のハックが機能します。

QTabWidget::tab > QWidget > QWidget {
        background: #fff;
}

しかし、Windows では、もう 1 つ QWidget を使用する必要があります。

QTabWidget::tab > QWidget > QWidget > QWidget {
        background: #fff;
}

「本当の」解決策はありますか?

4

1 に答える 1

0

QTabWidget ではなく、QTabBar を使用する必要があります。使用するセレクターは次のとおりです。

// Control the tab-bar with respect to the QTabWidget
QTabWidget::tab-bar {
        left: 5px;
}

// Control the look of the tab in general
QTabBar::tab {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

// Control the look of the tab when it is selected
QTabBar::tab:selected
{
        // Add css parameters
}
// Control the look of the tab when hovering over it
QTabBar::tab:hover 
{
        // Add css parameters
}

// Control the look of the tab when it is not selected
QTabBar::tab:!selected
{
        // Add css parameters
}
于 2011-11-02T10:29:00.400 に答える