Important: Please read the Qt Code of Conduct -

QWSServer : Changing background color

  • Hello,

    I'm using Qt4.8 on an embedded platform and I would like to change the background color of the QWSServer to set it as transparent.
    I tried to change the QWSServer's brush using the function qwsServer->setBackground(QBrush(Qt::transparent)); but it doesn't work.
    I also tried Qt::red, Qt::white but the background color remains unchanged.

    Does anyone have an idea ?


    Here is my initialization code...
    @int main(int argc, char *argv[])
    QApplication a(argc, argv, QApplication::GuiServer);

    CustomWindow w;
    w.setGeometry(50, 50, 500, 300);;
    return a.exec();

  • try this

    @#include <QWSServer>
    int main(int argc, char *argv[])
    QApplication app(argc, argv);

    #ifdef Q_WS_QWS
    app.setOverrideCursor( QCursor( Qt::BlankCursor ) );
    QWSServer::setCursorVisible( false );
    //QWSServer::setBackground(QBrush(Qt::transparent));  // have not tested  


  • Still doesn't work.

    Does it work on your side?

    Does your background change to black?

  • yes, setting it to white works as well

  • What Qt version do you use?

    PS : I use Direct FB display driver.

  • Sorry, I'm using 4.8. And not using Direct FB, using QWS_DISPLAY=LinuxFB.

  • I have same issue, and figured out it using /etc/directfbrc config. I added option bg-none or bg-color=000000 in config for transparent background.

  • Thanks all,

    The solution of timon works.

Log in to reply