QT Custom Widget Problem
-
Hi, ich hoffe der eine oder andere hat sich schonmal mit der QT beschäftigt und kann mir helfen:
Ich habe mir ein custom widget gebaut, das die Funktionalität einer Listbox erbt und zusätliche Sachen hinzufügt.
Meine Klasse sieht also wie folgt aus:class BookView : public QListView { Q_OBJECT public: BookView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ); public slots: void SlotContextMenuRequested ( QListViewItem * item, const QPoint & pos, int col ); };
Jetzt möchte ich gerne das Signal
void contextMenuRequested ( QListViewItem * item, const QPoint & pos, int col )
abfangen und mit einem eigenen Slot verbinden, das habe ich wie folgt versucht:
BookView::BookView( QWidget * parent, const char * name, WFlags f) : QListView(parent, name, f) { connect( this, SIGNAL( contextMenuRequested ( QListViewItem * item, const QPoint & pos, int col ) ), this, SLOT( SlotContextMenuRequested ( QListViewItem * item, const QPoint & pos, int col ) ) ); } void BookView::SlotContextMenuRequested ( QListViewItem * item, const QPoint & pos, int col ) { QMessageBox::information(this, "hallo", "hallo"); }
Das klappt aber nicht, denn ich kriege die Laufzeitmeldung:
QObject::connect: No such signal BookView::contextMenuRequested(QListViewItem*item,const QPoint&pos,int col)
QObject::connect: (sender name: 'bookView2')
QObject::connect: (receiver name: 'bookView2')Vielleicht kann mir ja jemand helfen, danke im voraus
KaPtain Cugel}
[ Dieser Beitrag wurde am 01.07.2003 um 16:43 Uhr von KPC editiert. ]