Hi all,

In the small example below I am inserting a small pixmap into a QAction in a
QMainWindow's menubar. I'm using a pixmap ("key.png") that is 19 by 9 pixels,
but QT resizes it to 16x7.

A 19x9 pixels image would easily fit on the menubar, so why does QT feel a need to resize? Is there a way to have it shown in its original size?

(QT4.2, X-Windows)

/Joakim

Qt Code:
  1. #include <QApplication>
  2. #include <QMainWindow>
  3. #include <QMenu>
  4. #include <QMenuBar>
  5.  
  6.  
  7. int main( int argc, char **argv )
  8. {
  9. QApplication app( argc, argv );
  10.  
  11. QMainWindow *mw = new QMainWindow();
  12. mw->show();
  13.  
  14. QMenuBar *mb = mw->menuBar();
  15. QMenu *menu = new QMenu("File");
  16. mb->addMenu(menu);
  17. menu->addAction("About", &app, SLOT(aboutQt()));
  18.  
  19. QAction *act = mb->addAction("");
  20. act->setIcon(QPixmap("key.png"));
  21.  
  22. app.exec();
  23. return 0;
  24. }
To copy to clipboard, switch view to plain text mode