There is a Qt::FramelessWindowHint window. How can I make the background on the tab bar (see highlighted in yellow on the screen) transparent so that it is beautiful? That is, to keep everything as it was, only the area highlighted in yellow became transparent.

enter image description here

1 answer 1

try setAttribute(Qt::WA_TranslucentBackground);

 #include <QTableWidget> class Widget : public QTabWidget{ public: Widget(QWidget *parent = 0): QTabWidget(parent) { setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_TranslucentBackground); addTab(new QWidget(this), "Tab"); } }; 

Screenshot

  • And how can you return everything as it was after setting these flags? I tried to write setAttribute(Qt::WA_TranslucentBackground, false); setWindowFlags(Qt::Widget); setAttribute(Qt::WA_TranslucentBackground, false); setWindowFlags(Qt::Widget); but the background turns black. - LNK
  • one
    @LNK, it is written in the help: Setting this flag causes WA_NoSystemBackground to be set . On Windows, the widget also has the window flag to be set. This flag is set or cleared by the widget's author. Try setAttribute(Qt::WA_NoSystemBackground, false); - yrHeTaTeJlb
  • Yes, if you turn it off everything works. thank. - LNK