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
#include <QApplication>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
int main( int argc, char **argv )
{
mw->show();
mb->addMenu(menu);
menu->addAction("About", &app, SLOT(aboutQt()));
app.exec();
return 0;
}
#include <QApplication>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
int main( int argc, char **argv )
{
QApplication app( argc, argv );
QMainWindow *mw = new QMainWindow();
mw->show();
QMenuBar *mb = mw->menuBar();
QMenu *menu = new QMenu("File");
mb->addMenu(menu);
menu->addAction("About", &app, SLOT(aboutQt()));
QAction *act = mb->addAction("");
act->setIcon(QPixmap("key.png"));
app.exec();
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks