Hello everyone,

I use Qt5 (5.4.1) to build an application under Linux. My problem concerns the size of icons. When I create a toolbar, after compiling, I got icons too small. I know I can use QToolbar::setIconSize(). And I used it in a first time. But now I have exactly the same problem with the icons displayed by an instance of QFileDialog::getSaveFileName. Thus I decided to write my own QProxyStyle and to load it via QApplication::setStyle(). The size of icons in the toolbar are right but not in the QFileDialog. I thought that QFileDialog inherits the style from the QApplication. I'm wrong. I join my code.

Qt Code:
  1. int main(int argc, char **argv)
  2. {
  3. QApplication::setStyle(new TMProxyStyle);
  4. QApplication *application = new QApplication(argc,argv);
  5. TMWindow *mainwindow = new TMWindow();
  6. mainwindow->show();
  7. return application->exec();
  8. }
To copy to clipboard, switch view to plain text mode 

My customized proxystyle :

Qt Code:
  1. class TMProxyStyle: public QProxyStyle
  2. {
  3. public:
  4. int pixelMetric(PixelMetric, const QStyleOption * =NULL,const QWidget * =NULL) const;
  5. };
  6.  
  7. int TMProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *options,const QWidget *widget) const
  8. {
  9. if(metric==QStyle::PM_ToolBarIconSize) return ICONSIZE;
  10. if(metric==QStyle::PM_SmallIconSize) return ICONSIZE;
  11. if(metric==QStyle::PM_LargeIconSize) return ICONSIZE;
  12. return QProxyStyle::pixelMetric(metric,options,widget);
  13. }
To copy to clipboard, switch view to plain text mode 

Here is a snapshot of the concerned part of my QFileDialog
QFileDialog-Icons.png

Can you help me ? Where is my error ?

Thank you very much.