diff --git a/src/libs/qmldebug/qmldebugconnectionmanager.cpp b/src/libs/qmldebug/qmldebugconnectionmanager.cpp index 7dd2500e2b2..eb706b3dbbb 100644 --- a/src/libs/qmldebug/qmldebugconnectionmanager.cpp +++ b/src/libs/qmldebug/qmldebugconnectionmanager.cpp @@ -67,7 +67,7 @@ void QmlDebugConnectionManager::connectToTcpServer() QTC_ASSERT(!isConnected(), return); if (++(m_numRetries) < m_maximumRetries) { - if (m_connection.isNull()) { + if (!m_connection) { // If the previous connection failed, recreate it. createConnection(); m_connection->connectToHost(m_server.host(), port16(m_server)); @@ -90,7 +90,7 @@ void QmlDebugConnectionManager::connectToTcpServer() }); m_connectionTimer.start(m_retryInterval); - if (m_connection.isNull()) { + if (!m_connection) { createConnection(); QTC_ASSERT(m_connection, emit connectionFailed(); return); m_connection->connectToHost(m_server.host(), port16(m_server)); @@ -116,7 +116,7 @@ void QmlDebugConnectionManager::startLocalServer() }); m_connectionTimer.start(m_retryInterval); - if (m_connection.isNull()) { + if (!m_connection) { // Otherwise, reuse the same one createConnection(); QTC_ASSERT(m_connection, emit connectionFailed(); return); @@ -143,12 +143,12 @@ void QmlDebugConnectionManager::logState(const QString &message) QmlDebugConnection *QmlDebugConnectionManager::connection() const { - return m_connection.data(); + return m_connection.get(); } void QmlDebugConnectionManager::createConnection() { - QTC_ASSERT(m_connection.isNull(), destroyConnection()); + QTC_ASSERT(!m_connection, destroyConnection()); m_connection.reset(new QmlDebug::QmlDebugConnection); @@ -159,16 +159,16 @@ void QmlDebugConnectionManager::createConnection() void QmlDebugConnectionManager::connectConnectionSignals() { QTC_ASSERT(m_connection, return); - QObject::connect(m_connection.data(), &QmlDebug::QmlDebugConnection::connected, + QObject::connect(m_connection.get(), &QmlDebug::QmlDebugConnection::connected, this, &QmlDebugConnectionManager::qmlDebugConnectionOpened); - QObject::connect(m_connection.data(), &QmlDebug::QmlDebugConnection::disconnected, + QObject::connect(m_connection.get(), &QmlDebug::QmlDebugConnection::disconnected, this, &QmlDebugConnectionManager::qmlDebugConnectionClosed); - QObject::connect(m_connection.data(), &QmlDebug::QmlDebugConnection::connectionFailed, + QObject::connect(m_connection.get(), &QmlDebug::QmlDebugConnection::connectionFailed, this, &QmlDebugConnectionManager::qmlDebugConnectionFailed); - QObject::connect(m_connection.data(), &QmlDebug::QmlDebugConnection::logStateChange, + QObject::connect(m_connection.get(), &QmlDebug::QmlDebugConnection::logStateChange, this, &QmlDebugConnectionManager::logState); - QObject::connect(m_connection.data(), &QmlDebug::QmlDebugConnection::logError, + QObject::connect(m_connection.get(), &QmlDebug::QmlDebugConnection::logError, this, &QmlDebugConnectionManager::logState); } @@ -191,7 +191,7 @@ void QmlDebugConnectionManager::destroyConnection() // Don't receive any more signals from the connection or the client disconnectConnectionSignals(); destroyClients(); - m_connection.take()->deleteLater(); + m_connection.release()->deleteLater(); } } diff --git a/src/libs/qmldebug/qmldebugconnectionmanager.h b/src/libs/qmldebug/qmldebugconnectionmanager.h index 8f6b8cb3f40..5466f70f45f 100644 --- a/src/libs/qmldebug/qmldebugconnectionmanager.h +++ b/src/libs/qmldebug/qmldebugconnectionmanager.h @@ -6,9 +6,9 @@ #include #include -#include #include #include +#include namespace QmlDebug { @@ -49,7 +49,7 @@ private: void connectToTcpServer(); void startLocalServer(); - QScopedPointer m_connection; + std::unique_ptr m_connection; QTimer m_connectionTimer; QUrl m_server; diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index e61552a6396..cd98110cae4 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -370,7 +370,7 @@ QByteArray LibraryInfo::calculateFingerprint() const { QCryptographicHash hash(QCryptographicHash::Sha1); auto addData = [&hash](auto p, size_t len) { - hash.addData(reinterpret_cast(p), len); + hash.addData(QByteArrayView(reinterpret_cast(p), len)); }; addData(&_status, sizeof(_status)); @@ -621,10 +621,10 @@ LibraryInfo Snapshot::libraryInfo(const Utils::FilePath &path) const void ModuleApiInfo::addToHash(QCryptographicHash &hash) const { int len = uri.length(); - hash.addData(reinterpret_cast(&len), sizeof(len)); - hash.addData(reinterpret_cast(uri.constData()), len * sizeofQChar); + hash.addData(QByteArrayView(reinterpret_cast(&len), sizeof(len))); + hash.addData(QByteArrayView(reinterpret_cast(uri.constData()), len * sizeofQChar)); version.addToHash(hash); len = cppName.length(); - hash.addData(reinterpret_cast(&len), sizeof(len)); - hash.addData(reinterpret_cast(cppName.constData()), len * sizeofQChar); + hash.addData(QByteArrayView(reinterpret_cast(&len), sizeof(len))); + hash.addData(QByteArrayView(reinterpret_cast(cppName.constData()), len * sizeofQChar)); } diff --git a/src/libs/solutions/terminal/terminalsurface.cpp b/src/libs/solutions/terminal/terminalsurface.cpp index 00f26ce188f..8ec68f8cfee 100644 --- a/src/libs/solutions/terminal/terminalsurface.cpp +++ b/src/libs/solutions/terminal/terminalsurface.cpp @@ -226,7 +226,7 @@ struct TerminalSurfacePrivate { TerminalCell result; result.width = cell.width; - result.text = QString::fromUcs4(cell.chars); + result.text = QString::fromUcs4(reinterpret_cast(cell.chars)); const VTermColor *bg = &cell.bg; const VTermColor *fg = &cell.fg; @@ -459,7 +459,8 @@ std::u32string::value_type TerminalSurface::fetchCharAt(int x, int y) const if (cell->chars[0] == 0xffffffff) return 0; - QString s = QString::fromUcs4(cell->chars, 6).normalized(QString::NormalizationForm_C); + QString s = QString::fromUcs4(reinterpret_cast(cell->chars), 6) + .normalized(QString::NormalizationForm_C); const QList ucs4 = s.toUcs4(); return std::u32string(ucs4.begin(), ucs4.end()).front(); } diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index b96d9de0254..262e62caf03 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -807,7 +807,7 @@ QString FileUtils::normalizedPathName(const QString &name) TCHAR buffer[MAX_PATH]; const bool success = SHGetPathFromIDList(file, buffer); ILFree(file); - return success ? QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast(buffer))) + return success ? QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast(buffer))) : name; #elif defined(Q_OS_MACOS) return Internal::normalizePathName(name); diff --git a/src/libs/utils/id.cpp b/src/libs/utils/id.cpp index 9e170317cff..b40e97136b9 100644 --- a/src/libs/utils/id.cpp +++ b/src/libs/utils/id.cpp @@ -130,7 +130,7 @@ Id::Id(const char *name) Id Id::generate() { - return {QUuid::createUuid().toByteArray()}; + return Id{QUuid::createUuid().toByteArray()}; } /*! diff --git a/src/libs/utils/navigationtreeview.cpp b/src/libs/utils/navigationtreeview.cpp index 5db3d5ccec1..5cf7f86860e 100644 --- a/src/libs/utils/navigationtreeview.cpp +++ b/src/libs/utils/navigationtreeview.cpp @@ -44,7 +44,7 @@ void NavigationTreeView::scrollTo(const QModelIndex &index, QAbstractItemView::S const int viewportWidth = viewport()->width(); QRect itemRect = visualRect(index); - QAbstractItemDelegate *delegate = itemDelegate(index); + QAbstractItemDelegate *delegate = itemDelegateForIndex(index); if (delegate) { QStyleOptionViewItem option; initViewItemOption(&option); diff --git a/src/libs/utils/transientscroll.cpp b/src/libs/utils/transientscroll.cpp index 65d082ffca8..1f771b187ca 100644 --- a/src/libs/utils/transientscroll.cpp +++ b/src/libs/utils/transientscroll.cpp @@ -425,7 +425,7 @@ bool ScrollBar::event(QEvent *event) &option, QStyle::SC_ScrollBarSlider, this) - .contains(hoverEvent->pos()); + .contains(hoverEvent->position().toPoint()); d->isGrooveUnderCursor = !d->isHandleUnderCursor && style() @@ -433,7 +433,7 @@ bool ScrollBar::event(QEvent *event) &option, QStyle::SC_ScrollBarGroove, this) - .contains(hoverEvent->pos()); + .contains(hoverEvent->position().toPoint()); } } break; case QEvent::HoverLeave: diff --git a/src/libs/utils/winutils.cpp b/src/libs/utils/winutils.cpp index 3159bd3d449..ce896aa4bd8 100644 --- a/src/libs/utils/winutils.cpp +++ b/src/libs/utils/winutils.cpp @@ -20,7 +20,7 @@ QTCREATOR_UTILS_EXPORT QString winErrorMessage(unsigned long error) { QString rc = QString::fromLatin1("#%1: ").arg(error); #ifdef Q_OS_WIN - ushort *lpMsgBuf; + char16_t *lpMsgBuf; const int len = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, @@ -160,7 +160,7 @@ QTCREATOR_UTILS_EXPORT QString imageName(quint32 processId) wchar_t path[MAX_PATH]; DWORD pathLen = MAX_PATH; if (QueryFullProcessImageName(handle, 0, path, &pathLen)) - result = QString::fromUtf16(reinterpret_cast(path)); + result = QString::fromUtf16(reinterpret_cast(path)); CloseHandle(handle); #else Q_UNUSED(processId)