Commit c5fe5de8 authored by Calvin Buckley's avatar Calvin Buckley 🤔 Committed by Albert Astals Cid
Browse files

Fix dock menu only checking one specific item

parent 0df27b4a
...@@ -1858,13 +1858,19 @@ void QCGTopLevel::partsUnhideAllSlot() ...@@ -1858,13 +1858,19 @@ void QCGTopLevel::partsUnhideAllSlot()
void QCGTopLevel::insertWindowList(QMenu* menu) void QCGTopLevel::insertWindowList(QMenu* menu)
{ {
auto windowList = QApplication::topLevelWidgets(); auto windowList = QApplication::topLevelWidgets();
auto activeWindow = QApplication::activeWindow();
// dock menu this corresponds to (IIRC) last window that installed one,
// so using it unless we have to is a bad idea
if (activeWindow == nullptr) {
activeWindow = this;
}
for (int i = 0; i < windowList.size(); i++) { for (int i = 0; i < windowList.size(); i++) {
QWidget *topLevelRaw = windowList[i]; QWidget *topLevelRaw = windowList[i];
if (QCGTopLevel *topLevel = qobject_cast<QCGTopLevel*>(topLevelRaw)) { if (QCGTopLevel *topLevel = qobject_cast<QCGTopLevel*>(topLevelRaw)) {
QString windowTitle = topLevel->windowTitle(); QString windowTitle = topLevel->windowTitle();
QAction *windowItem = menu->addAction(windowTitle); QAction *windowItem = menu->addAction(windowTitle);
windowItem->setData(QVariant::fromValue(topLevel)); windowItem->setData(QVariant::fromValue(topLevel));
if (topLevel == this) { if (topLevel == activeWindow) {
windowItem->setCheckable(true); windowItem->setCheckable(true);
windowItem->setChecked(true); windowItem->setChecked(true);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment