1
votes

I need your advices. (Sorry for my eng. I hope than you'll understand me)

1) I want to create custom TabWidget and use QSS. Now it's look like this:

enter image description here

I want fill background under tabs (I accept property called autoFillBackground). It's need look like this:

enter image description here

2) When I start drag and drop tab this tab is filled with white color. And when I drop the tab this tab set custom qss.

I want to change the style when I drag and drop the tab. Thx

(I was reading qss manual)

some code

 QTabWidget::tab-bar {
 background-color: black;
}

QTabBar::tab {
    background-color: #4094da;
    border-color:white;
    font: bold 12px 'Arial';
    color: white;
    height:60px;

}
QTabBar::tab:!selected {
    background-color: #9E9E9E;
    color: white;
 }


QTabBar::close-button {
    background-position: center;
    background-image: url(":/Appearance/close_chat_item");
}

 QTabWidget::pane { 
     position: absolute;
 }

QTabBar::tab:selected {
    border-color:#4094da;
    background-color: #4094da;
    color: white;
}
2
Could you post some code that you have tried?Arnab Datta
sure! I update questionGleb Belyaev

2 Answers

0
votes

The QTabWidget does not paint the background, you need to set the background of the parent widget of the QTabWidget.

0
votes

As I understand, you willing the background color to change in any drag & drop situation(or it is my assumption). If it's like I understand, you should define hover option on your qss. For more info on Qt documentation.

Example code:

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

Your priority should be forcing to cost on qss, logic structure consider to second plan or you can use for some kind of workaround.