I believe it belongs widget's style.
Please compile this example:
#include <QApplication>
#include <QToolButton>
#include <QMotifStyle>
int main(int argc, char *argv[])
{
mainWin->setLayout(mainLayout);
tb->setText("Testing");
mainLayout->addWidget(tb);
mainWin.show();
return app.exec();
}
#include <QApplication>
#include <QToolButton>
#include <QMotifStyle>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget mainWin;
QHBoxLayout *mainLayout = new QHBoxLayout;
mainWin->setLayout(mainLayout);
QToolButton tb;
tb->setText("Testing");
tb->setStyle(new QMotifStyle); // it is important
mainLayout->addWidget(tb);
mainWin.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Compile and run it, you will see a small rectangle (cover the text) when it has focus.
If you replace another style:
tb->setStyle(new QWindowsXPStyle);
-> don't draw anything when it has focus.
tb->setStyle(new QCommonStyle);
-> draw a big rectangle (cover the control) when it has focus.
Please tell me how to create any shapes (or fill with a gradient) when it has focus.
Thanks.
Bookmarks