![:]](wcf/images/smilies/pleased.gif)
|
|
Source code |
1 2 3 4 |
mywidget::mouseMoveEvent() {
cout << "mouseMove"
.........
}
|
![:]](wcf/images/smilies/pleased.gif)
You can try applying an event filter to the button and handling mouseMove there (which will prevent it from being forwarded to the parent of the button).
Quoted
Originally posted by mickey
Ok,
but I have a button of MainForm that call a function MainForm::load().
Within this function I call QFiledialog::open....But I think that I must
install an eventFilter on QFileDialog??
Quoted
But don't work (eventFilter is not
called).
Quoted
If I install a filter on button that calls load(), the button is blocked.
Quoted
I see that when I open fileDialog, mouseMovevent is called
only when I choose a file with double click on it and not when I click on
file and press open button of OpenDialog.
|
|
Source code |
1 2 |
//mainForm.ui.h this->load->installEventFilter(this->myWidget1); |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 |
//MyWidget.cpp
bool MyWidget::eventFilter(QObject* obj, QEvent* e) {
if ( e->type() == QEvent::MouseMove) {
cout << "mo";
return true;
}
else {
cout << "false\n";
return false;
}
|
|
|
Source code |
1 |
this->loadTexture->installEventFilter(this->myWidget1); |
|
|
Source code |
1 2 3 4 5 |
bool MyWidget::eventFilter(QObject* obj, QEvent* e) {
if (( e->type() == QEvent::MouseButtonDblClick) && (e->type() ==
QEvent::MouseButtonDblClick) && (e->type() == QEvent::
MouseButtonRelease))
}
|
Quoted
Originally posted by mickey
but I don't understand obj what is! 'load' button isn't a QObject...
|
|
Source code |
1 2 3 4 |
if (( e->type() == QEvent::MouseButtonDblClick) && (e->type() ==
QEvent::MouseButtonDblClick) && (e->type() == QEvent::
MouseButtonRelease))
}
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 |
bool MyWidget::eventFilter(QObject* obj, QEvent* e) {
if (( e->type() == QEvent::MouseButtonDblClick) {
cout << "mo";
return true;
}
else {
cout << "false\n";
return false;
}
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
bool MyWidget::eventFilter(QObject* obj, QEvent* e) {
cout << "filter\n";
if (obj == this) {
cout << "myWidget\n";
printf("%d",*obj);
cout << "loadT\n";
if (( e->type() == QEvent::MouseButtonDblClick) || ( e->type() ==
QEvent::MouseMove)) {
cout << "mo";
return true;
}
else {
cout << "false\n";
return false;
}
}
|