Hello everybody,
QT:4.1.1
I am trying to popup a menu inside my QTableView. I get a error on compiling this code:
{
Q3PopupMenu* contextMenu = new Q3PopupMenu( this );
Q_CHECK_PTR( contextMenu );
"ListView options</b></u></font>", this );
caption->setAlignment( Qt::AlignCenter );
contextMenu->insertItem( caption );
contextMenu->insertItem( "&einfügen", this, SLOT(selectTable()) );
contextMenu
->exec
( QCursor::pos() );
delete contextMenu;
}
void MainWindow::contextMenuEvent( QContextMenuEvent * )
{
Q3PopupMenu* contextMenu = new Q3PopupMenu( this );
Q_CHECK_PTR( contextMenu );
QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
"ListView options</b></u></font>", this );
caption->setAlignment( Qt::AlignCenter );
contextMenu->insertItem( caption );
contextMenu->insertItem( "&einfügen", this, SLOT(selectTable()) );
contextMenu->exec( QCursor::pos() );
delete contextMenu;
}
To copy to clipboard, switch view to plain text mode
private:
private:
void contextMenuEvent ( QContextMenuEvent * );
To copy to clipboard, switch view to plain text mode
ERROR:
test.cpp:21:23: Q3PopupMenu: No such file or directory
test.cpp: In member function `virtual void MainWindow::contextMenuEvent(QContext
MenuEvent*)':
test.cpp:217: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:222: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:223: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:224: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:225: warning: possible problem detected in invocation of delete operato
r:
test.cpp:217: warning: `contextMenu' has incomplete type
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: warning: forwa
rd declaration of `struct Q3PopupMenu'
test.cpp:225: note: neither the destructor nor the class-specific operator delet
e will be called, even if they are declared when the class is defined.
mingw32-make[1]: *** [release\test.o] Error 1
mingw32-make[1]: Leaving directory `D:/rapha/qtprojekte/qt4/mainwindowTableModel
/ver3'
mingw32-make: *** [release] Error 2
test.cpp:21:23: Q3PopupMenu: No such file or directory
test.cpp: In member function `virtual void MainWindow::contextMenuEvent(QContext
MenuEvent*)':
test.cpp:217: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:222: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:223: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:224: error: invalid use of undefined type `struct Q3PopupMenu'
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: error: forward
declaration of `struct Q3PopupMenu'
test.cpp:225: warning: possible problem detected in invocation of delete operato
r:
test.cpp:217: warning: `contextMenu' has incomplete type
D:/apps/Qt/4.1.1/include/QtGui/../../src/gui/widgets/qmenu.h:359: warning: forwa
rd declaration of `struct Q3PopupMenu'
test.cpp:225: note: neither the destructor nor the class-specific operator delet
e will be called, even if they are declared when the class is defined.
mingw32-make[1]: *** [release\test.o] Error 1
mingw32-make[1]: Leaving directory `D:/rapha/qtprojekte/qt4/mainwindowTableModel
/ver3'
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
Bookmarks