
Originally Posted by
tommy
everything is always black and the actual pixmap that the QLabel (pixmapLabel) is supposed to show is all black and the picture is not seen.Looks like the background is sitting on top of the pixmap, not the other way around. Seems like I need to specify something more?
No, it should work. Double check your code.
Just to verify it works:
// main.cpp
#include <QtGui>
int main(int argc, char *argv[])
{
label.
setPixmap(QPixmap(":/trolltech/styles/commonstyle/images/standardbutton-help-128.png"));
label.setStyleSheet("background-color: black");
label.setAlignment(Qt::AlignCenter);
label.show();
return app.exec();
}
// main.cpp
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel label;
label.setPixmap(QPixmap(":/trolltech/styles/commonstyle/images/standardbutton-help-128.png"));
label.setStyleSheet("background-color: black");
label.setAlignment(Qt::AlignCenter);
label.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks