fix activate window behavior

This commit is contained in:
shun-iwasawa 2020-01-21 12:21:14 +09:00
parent 93cd22f036
commit 1f6fa70a4e

View file

@ -31,6 +31,7 @@
#include <qdrawutil.h>
#include <assert.h>
#include <QDesktopWidget>
#include <QDialog>
extern TEnv::StringVar EnvSafeAreaName;
@ -124,12 +125,15 @@ void TPanel::onCloseButtonPressed() {
*/
void TPanel::enterEvent(QEvent *event) {
// Only when Toonz application is active
if (qApp->activeWindow()) {
QWidget *w = qApp->activeWindow();
if (w) {
widgetFocusOnEnter();
// Some panels (e.g. Viewer, StudioPalette, Palette, ColorModel) are
// activated when mouse enters. Viewer is activatable only when being
// docked.
if (isActivatableOnEnter()) activateWindow();
// Active windows will NOT switch when the current active window is dialog.
if (qobject_cast<QDialog *>(w) == 0 && isActivatableOnEnter())
activateWindow();
event->accept();
} else
event->accept();