PDA

View Full Version : Qt 4.1.3 - XP - TrayIcon



incapacitant
31st May 2006, 16:11
I have a successfull prototype for the TrayIcon code that I try to integrate to my main application. I get the following strange compile errors :



C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.text+0x100) In function `ZNK17ApplicationWindow10metaObjectEv':
46 C:\root\dev\Qt\sms data\sms\moc_mainwindow.cpp multiple definition of `ApplicationWindow::metaObject() const'
59 C:\root\dev\Qt\sms data\sms\moc_menu.o(.text+0x100):C:\root\dev\Qt\sm s data\sms\moc_menu.cpp first defined here
C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.text+0x10a) In function `ZN17ApplicationWindow11qt_metacastEPKc':
51 C:\root\dev\Qt\sms data\sms\moc_mainwindow.cpp multiple definition of `ApplicationWindow::qt_metacast(char const*)'
64 C:\root\dev\Qt\sms data\sms\moc_menu.o(.text+0x10a):C:\root\dev\Qt\sm s data\sms\moc_menu.cpp first defined here
C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.text+0x158) In function `ZN17ApplicationWindow11qt_metacallEN11QMetaObject 4CallEiPPv':
59 C:\root\dev\Qt\sms data\sms\moc_mainwindow.cpp multiple definition of `ApplicationWindow::qt_metacall(QMetaObject::Call, int, void**)'
72 C:\root\dev\Qt\sms data\sms\moc_menu.o(.text+0x158):C:\root\dev\Qt\sm s data\sms\moc_menu.cpp first defined here
C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.text$_ZN17ApplicationWi ndowD0Ev[ApplicationWindow::~ApplicationWindow()]+0x0) In function `ZThn8_N17ApplicationWindowD1Ev':
72 C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.text$_ZN17ApplicationWi ndowD0Ev[ApplicationWindow::~ApplicationWindow()]+0x0) multiple definition of `ApplicationWindow::~ApplicationWindow()'
136 C:\root\dev\Qt\sms data\sms\menu.o(.text+0x44e4):C:\root\dev\Qt\sms data\sms\menu.cpp first defined here
C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.text$_ZN17ApplicationWi ndowD1Ev[ApplicationWindow::~ApplicationWindow()]+0x0) In function `ZThn8_N17ApplicationWindowD1Ev':
136 C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.text$_ZN17ApplicationWi ndowD1Ev[ApplicationWindow::~ApplicationWindow()]+0x0) multiple definition of `ApplicationWindow::~ApplicationWindow()'
136 C:\root\dev\Qt\sms data\sms\menu.o(.text+0x3eb8):C:\root\dev\Qt\sms data\sms\menu.cpp first defined here
C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.data+0x0) In function `ZThn8_N17ApplicationWindowD1Ev':
136 C:\root\dev\Qt\sms data\sms\moc_mainwindow.o(.data+0x0) multiple definition of `ApplicationWindow::staticMetaObject'
2493 C:\root\dev\Qt\sms data\sms\moc_menu.o(.data+0x0):C:\Dev-Cpp\include\c++\3.4.2\bits\locale_facets.tcc first defined here
2493 C:\root\dev\Qt\sms data\sms\moc_menu.o(.data+0x0):C:\Dev-Cpp\include\c++\3.4.2\bits\locale_facets.tcc ld returned 1 exit status
C:\root\dev\Qt\sms data\sms\Makefile [Build Error] [sms.exe] Error 1


I don't where to start looking for the problem.
Do you ?
Do you want me to sow some of my code ?

jacek
31st May 2006, 16:28
Check whether HEADERS and SOURCES variables in your .pro file don't contain duplicate entries.

incapacitant
31st May 2006, 16:37
They do, but I did not find right away. Thanks

incapacitant
31st May 2006, 18:52
Strange behaviour

If I code :


connect(pbClose, SIGNAL(clicked()), SLOT(showMinimized()));


The application is minimized as any other application, but if I double-click on the icon it is restored. It is displayed both as minimized application and iconfied.

If I code


connect(pbClose, SIGNAL(clicked()), SLOT(toggleVisibility()));


The application is correctly iconfied only but when I double-click on the icon it is reminimized without me doing anything. It won't stay restored.

I am lost.

incapacitant
13th June 2006, 17:54
Hello

Here is the connect code for the trayicon :


connect(mTray, SIGNAL(clicked(const QPoint &, int)), SLOT(toggleVisibility()));
connect(pbClose, SIGNAL(clicked()), SLOT(showMinimized()));
connect(mTray, SIGNAL(closed()), SLOT(slotTrayClosed()));
connect(aQuitAction, SIGNAL(triggered()), SLOT(close()));



All works well but there are two problems :
- the application is both minimized in the task bar and iconfied
- then when I click on the icon to close, it closes the application but the icon remains until you hover about it, then it goes.