Get the color of a tab in a tab widget



  • Hello,

    I have developed a GUI in which there is a tab area (QTabWidget). This area is the one with one tab in the image with the title "Graphic". There will be more tabs added while the GUI is beeing used. In this tab, I add a QCustomPlot and I want the backround of this widget to be the same as the color of the tab when it is acctive (the current problem does not come from setting the backround of the QCustomPlot but from getting the appropiate color from the tab widget). I have tried this different options:

    customPlot->setBackground(ui->tabWidget->currentWidget()->palette().color(QPalette::Background));
    customPlot->setBackground(ui->tabWidget->palette().color(QPalette::Background));
    

    but none of them paints the backround of the customPlot with the color of the tab when it is active. If somebody can tell me how to propperly get the color of the tab when it is selected I will apreciate vey much.

    alt text


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.