2022-06-08 12:47:24 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
2024-02-23 14:41:04 +00:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
2015-11-06 08:57:30 +00:00
|
|
|
|
|
|
|
#include "touchsettings.h"
|
2021-01-11 11:13:48 +00:00
|
|
|
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
#define DEVICE QInputDevice
|
2022-01-17 10:47:28 +00:00
|
|
|
#include <QtGui/QInputDevice>
|
2021-01-11 11:13:48 +00:00
|
|
|
#else
|
|
|
|
#define DEVICE QTouchDevice
|
|
|
|
#include <QtGui/QTouchDevice>
|
|
|
|
#endif
|
|
|
|
|
2015-11-06 08:57:30 +00:00
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
TouchSettings::TouchSettings(QObject *parent)
|
|
|
|
: QObject(parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TouchSettings::isHoverEnabled() const
|
|
|
|
{
|
2016-03-30 12:51:11 +00:00
|
|
|
#if defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) || defined(Q_OS_WINRT)
|
2015-11-06 08:57:30 +00:00
|
|
|
return false;
|
|
|
|
#else
|
2021-01-11 11:13:48 +00:00
|
|
|
const auto devices = DEVICE::devices();
|
2015-11-06 08:57:30 +00:00
|
|
|
bool isTouch = false;
|
2021-01-11 11:13:48 +00:00
|
|
|
for (const DEVICE *dev : devices)
|
|
|
|
if (dev->type() == DEVICE::DeviceType::TouchScreen) {
|
2015-11-06 08:57:30 +00:00
|
|
|
isTouch = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
bool isMobile = false;
|
|
|
|
if (qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE")) {
|
|
|
|
isMobile = true;
|
|
|
|
}
|
|
|
|
return !isTouch && !isMobile;
|
|
|
|
#endif
|
|
|
|
}
|