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 <QDesktopWidget>
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
|
||||
extern TEnv::StringVar EnvSafeAreaName;
|
||||
|
||||
|
@ -127,7 +128,21 @@ void TPanel::enterEvent(QEvent *event) {
|
|||
// Only when Toonz application is active
|
||||
QWidget *w = qApp->activeWindow();
|
||||
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
|
||||
// activated when mouse enters. Viewer is activatable only when being
|
||||
// docked.
|
||||
|
|
|
@ -440,7 +440,21 @@ void SceneViewer::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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue