//MainWindow.cpp
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
//...
QToolBar * toolbar = new QToolBar(this);
this->addToolBar(Qt::BottomToolBarArea, toolbar);
toolbar->setMovable(false);
QToolButton * button = new QToolButton(this);
toolbar->addWidget(button);
//way 1: It display a picture
toolbar->setStyleSheet("background-image: url(:/images/toolbarBg)");
//way 2: It doesn't display picture
//qApp->setStyleSheet("QToolBar {background-image: url(:/images/toolbarBg)}");
}
way (1) can display toolbarBg2x picture, but way (2) display nothing. why?
My expected result is to apply the picture as background of the toolbar.
However the toolbar's size actually is in 100x30 via method 1.
Additional information : background picture's resolution is 800x60, MainWindow size is 800x600.
Qt5.1 clang 64 bit, MacOSX10.8