Qt 5.13 warnings & fixes

This commit is contained in:
Brad Davis 2019-10-08 15:39:32 -07:00
parent 7aa28f29d2
commit 960cab9994
20 changed files with 91 additions and 56 deletions

View file

@ -33,7 +33,7 @@ const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor
const int WAIT_FOR_CHILD_MSECS = 1000;
#ifdef Q_OS_WIN
HANDLE PROCESS_GROUP = createProcessGroup();
void* PROCESS_GROUP = createProcessGroup();
#endif
AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks,

View file

@ -252,6 +252,7 @@
#if defined(Q_OS_WIN)
#include <VersionHelpers.h>
#include <Windows.h>
// On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
// FIXME seems to be broken.
@ -532,6 +533,11 @@ bool isDomainURL(QUrl url) {
}
#ifdef Q_OS_WIN
static const UINT UWM_IDENTIFY_INSTANCES =
RegisterWindowMessage("UWM_IDENTIFY_INSTANCES_{8AB82783-B74A-4258-955B-8188C22AA0D6}_" + qgetenv("USERNAME"));
static const UINT UWM_SHOW_APPLICATION =
RegisterWindowMessage("UWM_SHOW_APPLICATION_{71123FD6-3DA8-4DC1-9C27-8A12A6250CBA}_" + qgetenv("USERNAME"));
class MyNativeEventFilter : public QAbstractNativeEventFilter {
public:
static MyNativeEventFilter& getInstance() {
@ -4957,7 +4963,7 @@ extern "C" {
CCHAR NumberOfProcessors;
};
NTSYSCALLAPI NTSTATUS NTAPI NtQuerySystemInformation(
NTSYSCALLAPI LONG NTAPI NtQuerySystemInformation(
_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
_Out_writes_bytes_opt_(SystemInformationLength) PVOID SystemInformation,
_In_ ULONG SystemInformationLength,
@ -4966,12 +4972,12 @@ extern "C" {
}
template <typename T>
NTSTATUS NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, T& t) {
LONG NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, T& t) {
return NtQuerySystemInformation(SystemInformationClass, &t, (ULONG)sizeof(T), nullptr);
}
template <typename T>
NTSTATUS NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, std::vector<T>& t) {
LONG NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, std::vector<T>& t) {
return NtQuerySystemInformation(SystemInformationClass, t.data(), (ULONG)(sizeof(T) * t.size()), nullptr);
}

View file

@ -91,12 +91,6 @@ namespace controller {
class StateController;
}
#ifdef Q_OS_WIN
static const UINT UWM_IDENTIFY_INSTANCES =
RegisterWindowMessage("UWM_IDENTIFY_INSTANCES_{8AB82783-B74A-4258-955B-8188C22AA0D6}_" + qgetenv("USERNAME"));
static const UINT UWM_SHOW_APPLICATION =
RegisterWindowMessage("UWM_SHOW_APPLICATION_{71123FD6-3DA8-4DC1-9C27-8A12A6250CBA}_" + qgetenv("USERNAME"));
#endif
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
static const QString SCRIPTS_SWITCH = "scripts";

View file

@ -36,6 +36,7 @@
#include "Profile.h"
#ifdef Q_OS_WIN
#include <Windows.h>
extern "C" {
typedef int(__stdcall * CHECKMINSPECPROC) ();
}

View file

@ -15,10 +15,10 @@
#include <QtCore/QTimer>
#include <QtCore/QThread>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <QtGui/QWindow>
#include <QQuickWindow>
#include <QtQuick/QQuickWindow>
#include <DebugDraw.h>
#include <shared/QtHelpers.h>
@ -177,9 +177,35 @@ QPointF CompositorHelper::getMouseEventPosition(QMouseEvent* event) {
return event->localPos();
}
static bool isWindowActive() {
for (const auto& window : QGuiApplication::topLevelWindows()) {
if (window->isActive()) {
return true;
}
}
return false;
}
bool CompositorHelper::shouldCaptureMouse() const {
if (!_allowMouseCapture) {
return false;
}
if (!isHMD()) {
return false;
}
if (!isWindowActive()) {
return false;
}
if (ui::Menu::isSomeSubmenuShown()) {
return false;
}
// if we're in HMD mode, and some window of ours is active, but we're not currently showing a popup menu
return _allowMouseCapture && isHMD() && QApplication::activeWindow() && !ui::Menu::isSomeSubmenuShown();
return true;
}
void CompositorHelper::setAllowMouseCapture(bool capture) {
@ -206,9 +232,9 @@ void CompositorHelper::handleLeaveEvent() {
mainWidgetFrame.moveTopLeft(topLeftScreen);
}
QRect uncoveredRect = mainWidgetFrame;
foreach(QWidget* widget, QApplication::topLevelWidgets()) {
if (widget->isWindow() && widget->isVisible() && widget != mainWidget) {
QRect widgetFrame = widget->frameGeometry();
for(QWindow* window : QGuiApplication::topLevelWindows()) {
if (window->isVisible() && window != mainWidget->windowHandle()) {
QRect widgetFrame = window->frameGeometry();
if (widgetFrame.intersects(uncoveredRect)) {
QRect intersection = uncoveredRect & widgetFrame;
if (intersection.top() > uncoveredRect.top()) {
@ -292,7 +318,7 @@ glm::vec2 CompositorHelper::getReticleMaximumPosition() const {
if (isHMD()) {
result = VIRTUAL_SCREEN_SIZE;
} else {
QRect rec = QApplication::desktop()->screenGeometry();
QRect rec = QGuiApplication::primaryScreen()->geometry();
result = glm::vec2(rec.right(), rec.bottom());
}
return result;
@ -308,8 +334,8 @@ void CompositorHelper::sendFakeMouseEvent() {
// in HMD mode we need to fake our mouse moves...
QPoint globalPos(_reticlePositionInHMD.x, _reticlePositionInHMD.y);
auto button = Qt::NoButton;
auto buttons = QApplication::mouseButtons();
auto modifiers = QApplication::keyboardModifiers();
auto buttons = QGuiApplication::mouseButtons();
auto modifiers = QGuiApplication::keyboardModifiers();
QMouseEvent event(QEvent::MouseMove, globalPos, button, buttons, modifiers);
_fakeMouseEvent = true;
qApp->sendEvent(_renderingWidget, &event);

View file

@ -373,7 +373,7 @@ void OpenGLDisplayPlugin::customizeContext() {
auto usage = gpu::Texture::Usage::Builder().withColor().withAlpha();
cursorData.texture->setUsage(usage.build());
cursorData.texture->setStoredMipFormat(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA));
cursorData.texture->assignStoredMip(0, image.byteCount(), image.constBits());
cursorData.texture->assignStoredMip(0, image.sizeInBytes(), image.constBits());
cursorData.texture->setAutoGenerateMips(true);
}
}

View file

@ -290,7 +290,7 @@ void HmdDisplayPlugin::internalPresent() {
_previewTexture->setSource("HMD Preview Texture");
_previewTexture->setUsage(gpu::Texture::Usage::Builder().withColor().build());
_previewTexture->setStoredMipFormat(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA));
_previewTexture->assignStoredMip(0, image.byteCount(), image.constBits());
_previewTexture->assignStoredMip(0, image.sizeInBytes(), image.constBits());
_previewTexture->setAutoGenerateMips(true);
auto viewport = getViewportForSourceSize(uvec2(_previewTexture->getDimensions()));

View file

@ -666,7 +666,7 @@ QScriptValue EntityScriptingInterface::getMultipleEntityProperties(QScriptContex
const int ARGUMENT_EXTENDED_DESIRED_PROPERTIES = 1;
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
const auto entityIDs = qScriptValueToValue<QVector<QUuid>>(context->argument(ARGUMENT_ENTITY_IDS));
const auto entityIDs = qscriptvalue_cast<QVector<QUuid>>(context->argument(ARGUMENT_ENTITY_IDS));
return entityScriptingInterface->getMultipleEntityPropertiesInternal(engine, entityIDs, context->argument(ARGUMENT_EXTENDED_DESIRED_PROPERTIES));
}
@ -716,7 +716,7 @@ QScriptValue EntityScriptingInterface::getMultipleEntityPropertiesInternal(QScri
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::FlagsActive);
}
EntityPropertyFlags desiredProperties = qScriptValueToValue<EntityPropertyFlags>(extendedDesiredProperties);
EntityPropertyFlags desiredProperties = qscriptvalue_cast<EntityPropertyFlags>(extendedDesiredProperties);
bool needsScriptSemantics = desiredProperties.getHasProperty(PROP_POSITION) ||
desiredProperties.getHasProperty(PROP_ROTATION) ||
desiredProperties.getHasProperty(PROP_LOCAL_POSITION) ||

View file

@ -1859,7 +1859,7 @@ bool GLTFSerializer::readArray(const hifi::ByteArray& bin, int byteOffset, int c
break;
default:
qWarning(modelformat) << "Unknown accessorType: " << accessorType;
blobstream.unsetDevice();
blobstream.setDevice(nullptr);
return false;
}
for (int i = 0; i < count; ++i) {
@ -1869,13 +1869,13 @@ bool GLTFSerializer::readArray(const hifi::ByteArray& bin, int byteOffset, int c
blobstream >> value;
outarray.push_back(value);
} else {
blobstream.unsetDevice();
blobstream.setDevice(nullptr);
return false;
}
}
}
blobstream.unsetDevice();
blobstream.setDevice(nullptr);
return true;
}
template<typename T>

View file

@ -20,7 +20,7 @@ size_t Image::getByteCount() const {
if (_format == Format_RGBAF) {
return sizeof(FloatPixels::value_type) * _floatData.size();
} else {
return _packedData.byteCount();
return _packedData.sizeInBytes();
}
}

View file

@ -17,6 +17,13 @@
#include "NetworkLogging.h"
#ifdef WIN32
#include <winsock2.h>
#include <WS2tcpip.h>
#else
#include <netinet/in.h>
#endif
int hifiSockAddrMetaTypeId = qRegisterMetaType<HifiSockAddr>();
HifiSockAddr::HifiSockAddr() :

View file

@ -15,12 +15,7 @@
#include <cstdint>
#include <string>
#ifdef WIN32
#include <winsock2.h>
#include <WS2tcpip.h>
#else
#include <netinet/in.h>
#endif
struct sockaddr;
#include <QtNetwork/QHostInfo>

View file

@ -38,6 +38,10 @@
#include "udt/Packet.h"
#include "HMACAuth.h"
#if defined(Q_OS_WIN)
#include <winsock.h>
#endif
static Setting::Handle<quint16> LIMITED_NODELIST_LOCAL_PORT("LimitedNodeList.LocalPort", 0);
using namespace std::chrono_literals;

View file

@ -31,6 +31,14 @@
using namespace udt;
#ifdef WIN32
#include <winsock2.h>
#include <WS2tcpip.h>
#else
#include <netinet/in.h>
#endif
Socket::Socket(QObject* parent, bool shouldChangeSocketOptions) :
QObject(parent),
_udpSocket(parent),

View file

@ -258,7 +258,7 @@ void Font::read(QIODevice& in) {
_texture = gpu::Texture::create2D(formatGPU, image.width(), image.height(), gpu::Texture::SINGLE_MIP,
gpu::Sampler(gpu::Sampler::FILTER_MIN_POINT_MAG_LINEAR));
_texture->setStoredMipFormat(formatMip);
_texture->assignStoredMip(0, image.byteCount(), image.constBits());
_texture->assignStoredMip(0, image.sizeInBytes(), image.constBits());
}
void Font::setupGPU() {

View file

@ -46,13 +46,13 @@ void MovingPercentile::updatePercentile(qint64 sample) {
// swap new sample with neighbors in _samplesSorted until it's in sorted order
// try swapping up first, then down. element will only be swapped one direction.
while (newSampleIndex < _samplesSorted.size() - 1 && sample > _samplesSorted[newSampleIndex + 1]) {
_samplesSorted.swap(newSampleIndex, newSampleIndex + 1);
_sampleIds.swap(newSampleIndex, newSampleIndex + 1);
std::swap(_samplesSorted[newSampleIndex], _samplesSorted[newSampleIndex + 1]);
std::swap(_sampleIds[newSampleIndex], _sampleIds[newSampleIndex + 1]);
newSampleIndex++;
}
while (newSampleIndex > 0 && sample < _samplesSorted[newSampleIndex - 1]) {
_samplesSorted.swap(newSampleIndex, newSampleIndex - 1);
_sampleIds.swap(newSampleIndex, newSampleIndex - 1);
std::swap(_samplesSorted[newSampleIndex], _samplesSorted[newSampleIndex - 1]);
std::swap(_sampleIds[newSampleIndex], _sampleIds[newSampleIndex - 1]);
newSampleIndex--;
}

View file

@ -22,6 +22,7 @@
#include <unordered_map>
#include <chrono>
#include <QtCore/QOperatingSystemVersion>
#include <glm/glm.hpp>
#ifdef Q_OS_WIN
@ -793,15 +794,7 @@ void printSystemInformation() {
qCDebug(shared).noquote() << "\tKernel Type: " << QSysInfo::kernelType();
qCDebug(shared).noquote() << "\tKernel Version: " << QSysInfo::kernelVersion();
auto macVersion = QSysInfo::macVersion();
if (macVersion != QSysInfo::MV_None) {
qCDebug(shared) << "\tMac Version: " << macVersion;
}
auto windowsVersion = QSysInfo::windowsVersion();
if (windowsVersion != QSysInfo::WV_None) {
qCDebug(shared) << "\tWindows Version: " << windowsVersion;
}
qCDebug(shared) << "\tOS Version: " << QOperatingSystemVersion::current();
#ifdef Q_OS_WIN
SYSTEM_INFO si;

View file

@ -18,6 +18,7 @@
#include <QtCore/qjsondocument.h>
#include <QtCore/qjsonobject.h>
#include <QtCore/qjsonvalue.h>
#include <QtCore/QRegularExpression>
#include <shared/JSONHelpers.h>
#include "SettingHandle.h"
@ -189,7 +190,7 @@ public:
* @returns {object[]}
*/
Q_INVOKABLE QObjectList getSubConfigs() const {
auto list = findChildren<JobConfig*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);
auto list = findChildren<JobConfig*>(QRegularExpression(".*"), Qt::FindDirectChildrenOnly);
QObjectList returned;
for (int i = 0; i < list.size(); i++) {
returned.push_back(list[i]);

View file

@ -56,10 +56,10 @@ void InfoView::show(const QString& path, bool firstOrChangedOnly, QString urlQue
const QString lastVersion = infoVersion.get();
const QString version = fetchVersion(url);
// If we have version information stored
if (lastVersion != QString::null) {
if (!lastVersion.isNull()) {
// Check to see the document version. If it's valid and matches
// the stored version, we're done, so exit
if (version == QString::null || version == lastVersion) {
if (version.isNull() || version == lastVersion) {
return;
}
}

View file

@ -11,8 +11,8 @@
#include "MainWindow.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <QEvent>
#include <QMoveEvent>
#include <QResizeEvent>
@ -22,8 +22,8 @@
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMimeData>
#include <QWindow>
#include <QDebug>
#include <QtGui/QWindow>
#include <QtCore/QDebug>
#include "ui/Logging.h"
#include "DockWidget.h"
@ -60,7 +60,7 @@ QWindow* MainWindow::findMainWindow() {
void MainWindow::restoreGeometry() {
// Did not use setGeometry() on purpose,
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
QRect windowGeometry = qApp->desktop()->availableGeometry();
QRect windowGeometry = QGuiApplication::primaryScreen()->availableGeometry();
#if defined(Q_OS_MAC)
windowGeometry.setSize((windowGeometry.size() * 0.5f));
#endif