Added DockWidget::windowActiveChanged() signal
Tracking the top-level window's 'isActiveWindow' property is difficult since the dock widget's top-level window is changing all the time when docking and undocking. So added a convenience signal
This commit is contained in:
@@ -148,6 +148,7 @@ DockWidgetBase::DockWidgetBase(const QString &name, Options options)
|
||||
qWarning() << Q_FUNC_INFO << "Name can't be null";
|
||||
|
||||
setAttribute(Qt::WA_PendingMoveEvent, false);
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
DockWidgetBase::~DockWidgetBase()
|
||||
@@ -596,6 +597,16 @@ void DockWidgetBase::updateFloatAction()
|
||||
d->updateFloatAction();
|
||||
}
|
||||
|
||||
bool DockWidgetBase::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
const bool isWindowActivate = event->type() == QEvent::WindowActivate;
|
||||
const bool isWindowDeactivate = event->type() == QEvent::WindowDeactivate;
|
||||
if (isWindowActivate || isWindowDeactivate)
|
||||
Q_EMIT windowActiveChanged(isWindowActivate);
|
||||
|
||||
return QWidgetAdapter::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
QPoint DockWidgetBase::Private::defaultCenterPosForFloating()
|
||||
{
|
||||
MainWindowBase::List mainWindows = DockRegistry::self()->mainwindows();
|
||||
|
||||
Reference in New Issue
Block a user