hi
In the following code ,the mousePressEvent is not executed.does this means that the events first goes to child widgets and then to parents.
#include <QtGui>
{
public:
Widget()
{
list->setModel(model);
this->setCentralWidget(list);
}
protected:
{
qDebug()<<"press";
}
};
[CENTER][/CENTER]
int main(int argc, char *argv[])
{
Widget w;
w.show();
return a.exec();
}
#include <QtGui>
class Widget : public QMainWindow
{
public:
Widget()
{
QDirModel *model = new QDirModel;
QListView *list =new QListView(this);
list->setModel(model);
this->setCentralWidget(list);
}
protected:
void mousePressEvent(QMouseEvent *event)
{
qDebug()<<"press";
}
};
[CENTER][/CENTER]
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks