How to set backround image for QTableWidget?

  • Hi,

    Can Anybody help me to set the background image for QTableWidget.
    I had tried with following code but its not working....

    QPalette palette = ui->tableWidget->palette();
    QPixmap jpgImage( "/home/rcdtcpu26/Desktop/aero1.jpg");
    palette.setBrush(QPalette::Base, QBrush(jpgImage));

    Thank you.

  • Hi you can try this

    QPalette* palette = new QPalette();	

  • Lifetime Qt Champion

    @Ratzz Why all these heap allocated objects ?

    QPalette tablePalette = table->palette();
    palette.setBrush(QPaletter::Base, QPixmap("aero1"));

    is enough and cleaner.

Log in to reply

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