Change the icon size to a QAction
-
What icon size do you have in mind ?
What is the size of the image you are loading ? -
Then again, what size do you have in mind ?
-
One thing that passed me by: you are setting your icon on a menu. The size used for the icon in this case is decided by the style to follow the platform standard. If you want to customise that part you'll have to implement your own style.
-
Or use a QProxyStyle
-
The doc have sample :) Just after important info..
Anyway, what you are after is something like
#include <QProxyStyle> class MyProxyStyle: public QProxyStyle { Q_OBJECT public: MyProxyStyle(QStyle* style = 0) : QProxyStyle(style) { } MyProxyStyle(const QString& key) : QProxyStyle(key) { } virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption* option = 0, const QWidget* widget = 0 ) const { switch ( metric ) { case QStyle::PM_SmallIconSize: return 200; // here u want pixmaps size i assume default: return QProxyStyle::pixelMetric( metric, option, widget ); // return default values for the rest } } };
Note that you violate most user interface guidelines by this.
However, i have done it to make menus good for touch activation so it has its use cases but
it also means that you app will not play well with a platform that it self have adjusted heights.
Like for seeing impaired etc.To use
int main(int argc, char* argv[]) { QApplication a(argc, argv); a.setStyle(new MyProxyStyle() ); MainWindow w; w.show(); return a.exec(); }