Nicolas Charvoz
Nicolas Charvoz

Reputation: 1509

Tab highlighted in Qt window on Ubuntu

I'm creating an application in C++, using QT and stylesheets to design my app. It's working just fine. But I have a quick question, I'm wondering if there's any way I can throw away the highlighting of a tab when it's selected. I'm building a Qt application and the result is gross :

Button selected

My qss looks like this :

QTabWidget::tab-bar {
    alignment: center;
}

QTabBar::tab {
    background-color: #F5FCFE;
    border-bottom-color: #C2C7CB;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    min-width: 8ex;
    padding: 2px;
    height: 60px;
    width: 200px;
    margin: 10px;
}

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: #CFEFFC;
}

Thanks for you help

Upvotes: 0

Views: 322

Answers (1)

SingerOfTheFall
SingerOfTheFall

Reputation: 29966

This is a focus frame. To remove it, you should set the tab bar's focus policy to "NoFocus":

tabWidget.tabBar()->setFocusPolicy(Qt::NoFocus);

Upvotes: 1

Related Questions