I found this code example on http://www.codeprogress.com/cpp/libr...ntBg&index=191

It's supposed to create a QT window and have it be transparent so that the desktop will show through it.

When I run the code, the background simply shows up as black instead of transparent.

The webpage notes that if the QT GUI styling does not work as expected, check your qtconfig settings. But I'm not sure which settings I'm supposed to modify.

Has anyone run into this before?

Qt Code:
  1. #include <QtGui>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5. QApplication app(argc, argv);
  6.  
  7. QMainWindow *window = new QMainWindow();
  8. window->setAttribute( Qt::WA_TranslucentBackground );
  9. window->setWindowTitle(QString::fromUtf8("QMainWindow Transparent Background"));
  10. window->resize(800, 250);
  11.  
  12. QLCDNumber *number = new QLCDNumber();
  13. number->setFixedSize(800, 245);
  14. number->setDigitCount(12);
  15. number->display(QTime::currentTime().toString(QString("hh:mm:ss.zzz")));
  16.  
  17.  
  18. window->setCentralWidget(number);
  19. window->show();
  20.  
  21. return app.exec();
  22. }
To copy to clipboard, switch view to plain text mode