Hi,
I am trying to set the background image of a QTreeView to a png image via Stylesheet instructions and this works somehow, but it makes the background color of the View turn transparent. If I then set the background-color to anything other than "background-color:transparent;" the background-image disappears. Comment out the background-color instruction in the code below to get the picture ...
Is this a bug in Qt or am I doing something wrong?
Thanx in advance
Momesana
p.s. I am using Qt-4.2.2
#include <QApplication>
#include <QtGui>
int main(int argc, char ** argv)
{
view->resize(500, 350);
view->setStyleSheet
(
"QTreeView {"
// "background-color:white;"
"background-image:url(:images/toque.png);"
"background-position:bottom right;"
"background-repeat:none;"
"}"
);
view->show();
return app.exec();
}
#include <QApplication>
#include <QtGui>
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
QTreeView * view = new QTreeView;
view->resize(500, 350);
view->setStyleSheet
(
"QTreeView {"
// "background-color:white;"
"background-image:url(:images/toque.png);"
"background-position:bottom right;"
"background-repeat:none;"
"}"
);
view->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks