I managed to have the systray exampe work under qt4.1.3 but I have a problem.
For info I took the code from a previous post example.zip by jpn.
The minimize action is linked to the window's minimize button and I want to link it to a proper QPushButton.
So I modified the mainwindow :
{
pbClose
->resize
( QSize( 10,
10 ) );
qApp->setApplicationName("ExampleApp");
setupTray();
}
MainWindow::MainWindow() : QMainWindow()
{
pbClose = new QPushButton( this );
pbClose->resize( QSize( 10, 10 ) );
qApp->setApplicationName("ExampleApp");
setupTray();
}
To copy to clipboard, switch view to plain text mode
So that now a button is displayed on the mainwindow.
Then I replaced:
connect(mTray,
SIGNAL(clicked
(const QPoint &,
int)),
SLOT(toggleVisibility
()));
connect(mTray, SIGNAL(clicked(const QPoint &, int)), SLOT(toggleVisibility()));
To copy to clipboard, switch view to plain text mode
with:
connect(pbClose, SIGNAL(clicked()), SLOT(toggleVisibility()));
connect(pbClose, SIGNAL(clicked()), SLOT(toggleVisibility()));
To copy to clipboard, switch view to plain text mode
Then when I click on the button the application is minimized but when I double-click on the icon in the taskbar it won't come back maximized. It comes back when I keep the original mTray connect.
I tried:
connect(pbClose,
SIGNAL(clicked
(const QPoint &,
int)),
SLOT(toggleVisibility
()));
connect(pbClose, SIGNAL(clicked(const QPoint &, int)), SLOT(toggleVisibility()));
To copy to clipboard, switch view to plain text mode
But then it is worse the button once activated does not minimize anything.
Another weird thing is that even without the original mTray connect, the window's minimize button continues to minimize !
To finish and even with my button connection, the QMenu works always.
Bookmarks