Make rect_on_screen Qt4-compatible.

Use QDesktopWidget instead of QGuiApplication + QScreen. The former
exists in the Qt 4 API.

Ping-Bug: 11568
Change-Id: Icfbe9f78659b28efbc86061f94d946f70ab6dc41
Reviewed-on: https://code.wireshark.org/review/11604
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2015-11-06 08:18:05 -08:00
parent 1799834898
commit 3b125e7aef
2 changed files with 6 additions and 5 deletions

View File

@ -36,14 +36,14 @@
#include <wsutil/str_util.h>
#include <QAction>
#include <QApplication>
#include <QDateTime>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QDir>
#include <QFileInfo>
#include <QFontDatabase>
#include <QGuiApplication>
#include <QProcess>
#include <QScreen>
#include <QUrl>
#include <QUuid>
@ -235,8 +235,9 @@ void desktop_show_in_folder(const QString file_path)
bool rect_on_screen(const QRect &rect)
{
foreach (const QScreen *screen, QGuiApplication::screens()) {
if (screen->availableGeometry().contains(rect))
QDesktopWidget *desktop = qApp->desktop();
for (int i = 0; i < desktop->screenCount(); i++) {
if (desktop->availableGeometry(i).contains(rect))
return true;
}

View File

@ -197,7 +197,7 @@ void desktop_show_in_folder(const QString file_path);
/**
* Test to see if a rect is visible on screen.
*
* @param rect
* @param rect The rect to test, typically a "recent.gui_geometry_*" setting.
* @return true if the rect is completely enclosed by one of the display
* screens, false otherwise.
*/