Oh Great!
Thanks very much!
I'm reading.
Now i'm able to apply a style to a single menu, for example:
void ImageViewer::createMenus()
//! [19] //! [20]
{
fileMenu
= new QMenu(tr
("&File"),
this);
fileMenu->setStyleSheet("color : #ff0000; background-color : #0000ff");
fileMenu->addAction(openAct);
fileMenu->addAction(printAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);
viewMenu
= new QMenu(tr
("&View"),
this);
viewMenu->addAction(zoomInAct);
viewMenu->addAction(zoomOutAct);
viewMenu->addAction(normalSizeAct);
viewMenu->addSeparator();
}
void ImageViewer::createMenus()
//! [19] //! [20]
{
fileMenu = new QMenu(tr("&File"), this);
fileMenu->setStyleSheet("color : #ff0000; background-color : #0000ff");
fileMenu->addAction(openAct);
fileMenu->addAction(printAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);
viewMenu = new QMenu(tr("&View"), this);
viewMenu->addAction(zoomInAct);
viewMenu->addAction(zoomOutAct);
viewMenu->addAction(normalSizeAct);
viewMenu->addSeparator();
}
To copy to clipboard, switch view to plain text mode
Now i have to understand, how to apply the style to entire menu.
A question:
Why in a lot of example i read something like:
QPushButton { color: red }
To copy to clipboard, switch view to plain text mode
also in QTCreator help??
In the link that you give me, i don't understand where put code like this:
background-color: white;
background-image: url(draft.png);
background-attachment: scroll;
}
QTextEdit, QListView {
background-color: white;
background-image: url(draft.png);
background-attachment: scroll;
}
To copy to clipboard, switch view to plain text mode
in the *.cpp? Is it possible create a one file with all style (like css), so i don't need to look for style in all files?
Bookmarks