Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions meshroom/ui/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
import meshroom.ui.app

meshroom.ui.uiInstance = meshroom.ui.app.MeshroomApp(sys.argv)
clearFocusEventFilter = meshroom.ui.app.ClearFocusEventFilter()
meshroom.ui.uiInstance.installEventFilter(clearFocusEventFilter)
meshroom.ui.uiInstance.exec()
17 changes: 16 additions & 1 deletion meshroom/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from PySide6 import __version__ as PySideVersion
from PySide6 import QtCore
from PySide6.QtCore import QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings
from PySide6.QtCore import QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings, QObject, QEvent
from PySide6.QtGui import QIcon
from PySide6.QtQml import QQmlDebuggingEnabler
from PySide6.QtQuickControls2 import QQuickStyle
Expand Down Expand Up @@ -196,6 +196,21 @@ def createMeshroomParser(args):
return parser.parse_args(args[1:])


class ClearFocusEventFilter(QObject):
""" Clear focus each time a mouse button is pressed
"""

def eventFilter(self, watched: QObject, event: QtCore.QEvent) -> bool:

if event.type() != QEvent.MouseButtonPress:
return False

focusObject = QApplication.focusObject()
if hasattr(focusObject, "setFocus"):
focusObject.setFocus(False)

return False

class MeshroomApp(QApplication):
""" Meshroom UI Application. """
def __init__(self, inputArgs):
Expand Down
5 changes: 0 additions & 5 deletions meshroom/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,4 @@ ApplicationWindow {
replaceExit: Transition {}
}

background: MouseArea {
onPressed: {
forceActiveFocus();
}
}
}