Use uic.loadUi and get mouseMoveEvent
-
@Mikeeeeee There are enough examples in Qt documentation.
https://doc.qt.io/qt-5/qtwidgets-widgets-scribble-example.html -
@jsulm said in Use uic.loadUi and get mouseMoveEvent:
There are enough examples in Qt documentation.
https://doc.qt.io/qt-5/qtwidgets-widgets-scribble-example.htmlThere is no installEventFilter in this example
-
@Mikeeeeee There is example for mouseMoveEvent
But I again did the search for you (no idea why you can't): https://doc.qt.io/qt-5/qobject.html#installEventFilter -
@jsulm said in Use uic.loadUi and get mouseMoveEvent:
There is example for mouseMoveEvent
But I again did the search for you (no idea why you can't): https://doc.qt.io/qt-5/qobject.html#installEventFilterI saw it.
It is not work:self.installEventFilter(self.ui)
def eventFilter(self, object, event): print(111111111111111)
-
-
@Mikeeeeee Install event filter there, probably like (I don't use Qt with Python):
self.ui.installEventFilter(myEventFilter)
where myEventFilter is your event filter object (like keyPressEater in the example).
-
@jsulm said in Use uic.loadUi and get mouseMoveEvent:
lf.ui.installEventFilter(myEventFilter)
Documentation:
void QObject::installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object. For example:monitoredObj->installEventFilter(filterObj);
Your code will not work, you need to put an object in the function argument. I still need an example.
-
@Mikeeeeee said in Use uic.loadUi and get mouseMoveEvent:
our code will not work, you need to put an object in the function argument.
That's exactly what I'm doing:
self.ui.installEventFilter(myEventFilter)
I even wrote: "where myEventFilter is your event filter object"!
So, why do you think it will not work? Did you try? I have no idea what other example you need, I'm out of this thread... -
@Mikeeeeee said in Use uic.loadUi and get mouseMoveEvent:
Please give a full-fledged example.
I will not.
class MyEventFilter(QObject): def eventFilter(QObject obj, QEvent event): print("HERE") return QObject::eventFilter(obj, event) ... myEventFilter = MyEventFilter() self.ui.installEventFilter(myEventFilter)