Hello everybody,

QT:4.1.1

I am trying to popup a menu inside my QTableView. I get a error on compiling this code:
Qt Code:
  1. void MainWindow::contextMenuEvent( QContextMenuEvent * )
  2. {
  3. Q3PopupMenu* contextMenu = new Q3PopupMenu( this );
  4. Q_CHECK_PTR( contextMenu );
  5. QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
  6. "ListView options</b></u></font>", this );
  7. caption->setAlignment( Qt::AlignCenter );
  8. contextMenu->insertItem( caption );
  9. contextMenu->insertItem( "&einfügen", this, SLOT(selectTable()) );
  10. contextMenu->exec( QCursor::pos() );
  11. delete contextMenu;
  12. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. private:
  2. void contextMenuEvent ( QContextMenuEvent * );
To copy to clipboard, switch view to plain text mode 

ERROR:
Qt Code:
  1. test.cpp:21:23: Q3PopupMenu: No such file or directory
  2. test.cpp: In member function `virtual void MainWindow::contextMenuEvent(QContext
  3. MenuEvent*)':
  4. test.cpp:217: error: invalid use of undefined type `struct Q3PopupMenu'
  5. D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
  6. declaration of `struct Q3PopupMenu'
  7. test.cpp:222: error: invalid use of undefined type `struct Q3PopupMenu'
  8. D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
  9. declaration of `struct Q3PopupMenu'
  10. test.cpp:223: error: invalid use of undefined type `struct Q3PopupMenu'
  11. D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
  12. declaration of `struct Q3PopupMenu'
  13. test.cpp:224: error: invalid use of undefined type `struct Q3PopupMenu'
  14. D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
  15. declaration of `struct Q3PopupMenu'
  16. test.cpp:225: warning: possible problem detected in invocation of delete operato
  17. r:
  18. test.cpp:217: warning: `contextMenu' has incomplete type
  19. D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: warning: forwa
  20. rd declaration of `struct Q3PopupMenu'
  21. test.cpp:225: note: neither the destructor nor the class-specific operator delet
  22. e will be called, even if they are declared when the class is defined.
  23. mingw32-make[1]: *** [release\test.o] Error 1
  24. mingw32-make[1]: Leaving directory `D:/rapha/qtprojekte/qt4/mainwindowTableModel
  25. /ver3'
  26. mingw32-make: *** [release] Error 2
To copy to clipboard, switch view to plain text mode 

I used this code on QT3 in my app. I have not found a example for QT4. Could be that in QT4 is easier, but i found nothing.
If somebody have a example for QT4, why not