Manual test foreignwindows: Add option to recover lost windows
Add an option that moves windows back to the top left corner, which is useful when some window (of some application saving its position) is lost after changing the monitor setup. Change-Id: If358b1ed7f481f2bb98e375e88f11049f97a4a91 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
b64ce6f6bb
commit
47dc810724
@ -195,6 +195,9 @@ static QString description(const QString &appName)
|
|||||||
"tests embedding foreign windows into Qt.\n\nUse cases:\n\n"
|
"tests embedding foreign windows into Qt.\n\nUse cases:\n\n"
|
||||||
<< appName << " -a Dump a list of all native window ids.\n"
|
<< appName << " -a Dump a list of all native window ids.\n"
|
||||||
<< appName << " <winid> Dump information on the window.\n"
|
<< appName << " <winid> Dump information on the window.\n"
|
||||||
|
<< appName << " -m <winid> Move window to top left corner\n"
|
||||||
|
<< QByteArray(appName.size(), ' ')
|
||||||
|
<< " (recover lost windows after changing monitor setups).\n"
|
||||||
<< appName << " -c <winid> Dump information on the window continuously.\n"
|
<< appName << " -c <winid> Dump information on the window continuously.\n"
|
||||||
<< appName << " -e <winid> Embed window into a Qt widget.\n"
|
<< appName << " -e <winid> Embed window into a Qt widget.\n"
|
||||||
<< "\nOn Windows, class names of well known controls (EDIT, BUTTON...) can be\n"
|
<< "\nOn Windows, class names of well known controls (EDIT, BUTTON...) can be\n"
|
||||||
@ -245,6 +248,10 @@ int main(int argc, char *argv[])
|
|||||||
parser.addOption(outputAllOption);
|
parser.addOption(outputAllOption);
|
||||||
QCommandLineOption continuousOption(QStringList() << QStringLiteral("c") << QStringLiteral("continuous"),
|
QCommandLineOption continuousOption(QStringList() << QStringLiteral("c") << QStringLiteral("continuous"),
|
||||||
QStringLiteral("Output continuously."));
|
QStringLiteral("Output continuously."));
|
||||||
|
parser.addOption(outputAllOption);
|
||||||
|
QCommandLineOption moveOption(QStringList() << QStringLiteral("m") << QStringLiteral("move"),
|
||||||
|
QStringLiteral("Move window to top left corner."));
|
||||||
|
parser.addOption(moveOption);
|
||||||
parser.addOption(continuousOption);
|
parser.addOption(continuousOption);
|
||||||
QCommandLineOption embedOption(QStringList() << QStringLiteral("e") << QStringLiteral("embed"),
|
QCommandLineOption embedOption(QStringList() << QStringLiteral("e") << QStringLiteral("embed"),
|
||||||
QStringLiteral("Embed a foreign window into a Qt widget."));
|
QStringLiteral("Embed a foreign window into a Qt widget."));
|
||||||
@ -274,8 +281,12 @@ int main(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
QWindow *foreignWindow = QWindow::fromWinId(wid);
|
QWindow *foreignWindow = QWindow::fromWinId(wid);
|
||||||
|
if (!foreignWindow)
|
||||||
|
return -1;
|
||||||
foreignWindow->setObjectName("ForeignWindow" + QString::number(wid, 16));
|
foreignWindow->setObjectName("ForeignWindow" + QString::number(wid, 16));
|
||||||
windows.append(foreignWindow);
|
windows.append(foreignWindow);
|
||||||
|
if (parser.isSet(moveOption))
|
||||||
|
foreignWindow->setFramePosition(QGuiApplication::primaryScreen()->availableGeometry().topLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windows.isEmpty())
|
if (windows.isEmpty())
|
||||||
|
Loading…
Reference in New Issue
Block a user