Merge pull request #3217 from martinvanzijl/issue-1262-keep-textbox-focus-option
Keep focus on textboxes when moving mouse to another panel
This commit is contained in:
commit
26a71f646a
2 changed files with 31 additions and 2 deletions
|
@ -32,6 +32,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
extern TEnv::StringVar EnvSafeAreaName;
|
extern TEnv::StringVar EnvSafeAreaName;
|
||||||
|
|
||||||
|
@ -127,7 +128,21 @@ void TPanel::enterEvent(QEvent *event) {
|
||||||
// Only when Toonz application is active
|
// Only when Toonz application is active
|
||||||
QWidget *w = qApp->activeWindow();
|
QWidget *w = qApp->activeWindow();
|
||||||
if (w) {
|
if (w) {
|
||||||
widgetFocusOnEnter();
|
// grab the focus, unless a line-edit is focused currently
|
||||||
|
bool shouldSetFocus = true;
|
||||||
|
|
||||||
|
QWidget *focusWidget = qApp->focusWidget();
|
||||||
|
if (focusWidget) {
|
||||||
|
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>(focusWidget);
|
||||||
|
if (lineEdit) {
|
||||||
|
shouldSetFocus = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldSetFocus) {
|
||||||
|
widgetFocusOnEnter();
|
||||||
|
}
|
||||||
|
|
||||||
// Some panels (e.g. Viewer, StudioPalette, Palette, ColorModel) are
|
// Some panels (e.g. Viewer, StudioPalette, Palette, ColorModel) are
|
||||||
// activated when mouse enters. Viewer is activatable only when being
|
// activated when mouse enters. Viewer is activatable only when being
|
||||||
// docked.
|
// docked.
|
||||||
|
|
|
@ -440,7 +440,21 @@ void SceneViewer::onEnter() {
|
||||||
tool->onEnter();
|
tool->onEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFocus();
|
// grab the focus, unless a line-edit is focused currently
|
||||||
|
bool shouldSetFocus = true;
|
||||||
|
|
||||||
|
QWidget *focusWidget = qApp->focusWidget();
|
||||||
|
if (focusWidget) {
|
||||||
|
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>(focusWidget);
|
||||||
|
if (lineEdit) {
|
||||||
|
shouldSetFocus = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldSetFocus) {
|
||||||
|
setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue