platform plugins: use string view types more
Change-Id: I793cfff1afca6b98a672615e33a19f8210e429dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
b6e7aad064
commit
4f1bb8ee40
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
#if QT_CONFIG(accessibility)
|
||||
|
||||
/**
|
||||
|
|
@ -742,7 +744,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
|||
QRectF rect;
|
||||
if (range.length > 0) {
|
||||
NSUInteger position = range.location + range.length - 1;
|
||||
if (position > range.location && iface->textInterface()->text(position, position + 1) == QStringLiteral("\n"))
|
||||
if (position > range.location && iface->textInterface()->text(position, position + 1) == "\n"_L1)
|
||||
--position;
|
||||
QRect lastRect = iface->textInterface()->characterRect(position);
|
||||
rect = firstRect.united(lastRect);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
static long int startApplicationThread(void *data)
|
||||
{
|
||||
QHaikuApplication *app = static_cast<QHaikuApplication*>(data);
|
||||
|
|
@ -32,7 +34,7 @@ QHaikuIntegration::QHaikuIntegration(const QStringList ¶meters)
|
|||
{
|
||||
Q_UNUSED(parameters);
|
||||
|
||||
const QString signature = QStringLiteral("application/x-vnd.Qt.%1").arg(QFileInfo(QCoreApplication::applicationFilePath()).fileName());
|
||||
const QString signature = "application/x-vnd.Qt.%1"_L1.arg(QFileInfo(QCoreApplication::applicationFilePath()).fileName());
|
||||
|
||||
QHaikuApplication *app = new QHaikuApplication(signature.toLocal8Bit());
|
||||
be_app = app;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ inline QString QIOSMessageDialog::messageTextPlain()
|
|||
{
|
||||
// Concatenate text fragments, and remove HTML tags
|
||||
const QSharedPointer<QMessageDialogOptions> &opt = options();
|
||||
const QString &lineShift = QStringLiteral("\n\n");
|
||||
constexpr auto lineShift = "\n\n"_L1;
|
||||
const QString &informativeText = opt->informativeText();
|
||||
const QString &detailedText = opt->detailedText();
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ inline QString QIOSMessageDialog::messageTextPlain()
|
|||
if (!detailedText.isEmpty())
|
||||
text += lineShift + detailedText;
|
||||
|
||||
text.replace("<p>"_L1, QStringLiteral("\n"), Qt::CaseInsensitive);
|
||||
text.replace("<p>"_L1, "\n"_L1, Qt::CaseInsensitive);
|
||||
text.remove(QRegularExpression(QStringLiteral("<[^>]*>")));
|
||||
|
||||
return text;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static inline QQnxIntegration::Options parseOptions(const QStringList ¶mList
|
|||
|
||||
static inline int getContextCapabilities(const QStringList ¶mList)
|
||||
{
|
||||
QString contextCapabilitiesPrefix = QStringLiteral("screen-context-capabilities=");
|
||||
constexpr auto contextCapabilitiesPrefix = "screen-context-capabilities="_L1;
|
||||
int contextCapabilities = SCREEN_APPLICATION_CONTEXT;
|
||||
for (const QString ¶m : paramList) {
|
||||
if (param.startsWith(contextCapabilitiesPrefix)) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
class QWasmIntegrationPlugin : public QPlatformIntegrationPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -17,7 +19,7 @@ public:
|
|||
QPlatformIntegration *QWasmIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
||||
{
|
||||
Q_UNUSED(paramList);
|
||||
if (!system.compare(QStringLiteral("wasm"), Qt::CaseInsensitive))
|
||||
if (!system.compare("wasm"_L1, Qt::CaseInsensitive))
|
||||
return new QWasmIntegration;
|
||||
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ static bool initResources()
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QWindowsCursorCacheKey
|
||||
\brief Cache key for storing values in a QHash with a QCursor as key.
|
||||
|
|
@ -436,8 +438,8 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor
|
|||
if (!bestFit)
|
||||
return PixmapCursor();
|
||||
|
||||
const QPixmap rawImage(QStringLiteral(":/qt-project.org/windows/cursors/images/") +
|
||||
QString::fromLatin1(bestFit->fileName));
|
||||
const QPixmap rawImage(":/qt-project.org/windows/cursors/images/"_L1 +
|
||||
QLatin1StringView(bestFit->fileName));
|
||||
return PixmapCursor(rawImage, QPoint(bestFit->hotSpotX, bestFit->hotSpotY));
|
||||
}
|
||||
#endif // !QT_NO_IMAGEFORMAT_PNG
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ QUrl QWindowsShellItem::url() const
|
|||
if (urlV.isValid())
|
||||
return urlV;
|
||||
// Last resort: encode the absolute desktop parsing id as data URL
|
||||
const QString data = QStringLiteral("data:text/plain;base64,")
|
||||
const QString data = "data:text/plain;base64,"_L1
|
||||
+ QLatin1StringView(desktopAbsoluteParsing().toLatin1().toBase64());
|
||||
return QUrl(data);
|
||||
}
|
||||
|
|
@ -1359,7 +1359,7 @@ QString tempFilePattern(QString name)
|
|||
int lastDot = name.lastIndexOf(u'.');
|
||||
if (lastDot < 0)
|
||||
lastDot = name.size();
|
||||
name.insert(lastDot, QStringLiteral("_XXXXXX"));
|
||||
name.insert(lastDot, "_XXXXXX"_L1);
|
||||
|
||||
for (int i = lastDot - 1; i >= 0; --i) {
|
||||
if (!validFileNameCharacter(name.at(i)))
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QWindowsDropDataObject
|
||||
\brief QWindowsOleDataObject subclass specialized for handling Drag&Drop.
|
||||
|
|
@ -56,8 +58,8 @@ bool QWindowsDropDataObject::shouldIgnore(LPFORMATETC pformatetc) const
|
|||
QString formatName = QWindowsMimeRegistry::clipboardFormatName(pformatetc->cfFormat);
|
||||
if (pformatetc->cfFormat == CF_UNICODETEXT
|
||||
|| pformatetc->cfFormat == CF_TEXT
|
||||
|| formatName == QStringLiteral("UniformResourceLocator")
|
||||
|| formatName == QStringLiteral("UniformResourceLocatorW")) {
|
||||
|| formatName == "UniformResourceLocator"_L1
|
||||
|| formatName == "UniformResourceLocatorW"_L1) {
|
||||
const auto urls = dropData->urls();
|
||||
return std::all_of(urls.cbegin(), urls.cend(), [] (const QUrl &u) { return u.isLocalFile(); });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,14 +155,14 @@ static inline bool launchMail(const QUrl &url)
|
|||
return false;
|
||||
}
|
||||
// Fix mail launch if no param is expected in this command.
|
||||
if (command.indexOf(QStringLiteral("%1")) < 0) {
|
||||
if (command.indexOf("%1"_L1) < 0) {
|
||||
qWarning() << "The mail command lacks the '%1' parameter.";
|
||||
return false;
|
||||
}
|
||||
//Make sure the path for the process is in quotes
|
||||
const QChar doubleQuote = u'"';
|
||||
if (!command.startsWith(doubleQuote)) {
|
||||
const int exeIndex = command.indexOf(QStringLiteral(".exe "), 0, Qt::CaseInsensitive);
|
||||
const int exeIndex = command.indexOf(".exe "_L1, 0, Qt::CaseInsensitive);
|
||||
if (exeIndex != -1) {
|
||||
command.insert(exeIndex + 4, doubleQuote);
|
||||
command.prepend(doubleQuote);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
static const UINT q_uNOTIFYICONID = 0;
|
||||
|
||||
static uint MYWM_TASKBARCREATED = 0;
|
||||
|
|
@ -116,7 +118,7 @@ static inline HWND createTrayIconMessageWindow()
|
|||
return nullptr;
|
||||
// Register window class in the platform plugin.
|
||||
const QString className =
|
||||
ctx->registerWindowClass(QWindowsContext::classNamePrefix() + QStringLiteral("TrayIconMessageWindowClass"),
|
||||
ctx->registerWindowClass(QWindowsContext::classNamePrefix() + "TrayIconMessageWindowClass"_L1,
|
||||
qWindowsTrayIconWndProc);
|
||||
const wchar_t windowName[] = L"QTrayIconMessageWindow";
|
||||
return CreateWindowEx(0, reinterpret_cast<const wchar_t *>(className.utf16()),
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace QWindowsUiAutomation;
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
bool QWindowsUiaAccessibility::m_accessibleActive = false;
|
||||
|
||||
|
|
@ -78,8 +79,8 @@ static QString alertSound(const QObject *object)
|
|||
|
||||
static QString soundFileName(const QString &soundName)
|
||||
{
|
||||
const QString key = QStringLiteral("AppEvents\\Schemes\\Apps\\.Default\\")
|
||||
+ soundName + QStringLiteral("\\.Current");
|
||||
const QString key = "AppEvents\\Schemes\\Apps\\.Default\\"_L1
|
||||
+ soundName + "\\.Current"_L1;
|
||||
return QWinRegistryKey(HKEY_CURRENT_USER, key).stringValue(L"");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
const int xdnd_version = 5;
|
||||
|
||||
static inline xcb_window_t xcb_window(QPlatformWindow *w)
|
||||
|
|
@ -459,7 +461,7 @@ void QXcbDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardMod
|
|||
static const bool isUnity = qgetenv("XDG_CURRENT_DESKTOP").toLower() == "unity";
|
||||
if (isUnity && xdndCollectionWindow == XCB_NONE) {
|
||||
QString name = QXcbWindow::windowTitle(connection(), target);
|
||||
if (name == QStringLiteral("XdndCollectionWindowImp"))
|
||||
if (name == "XdndCollectionWindowImp"_L1)
|
||||
xdndCollectionWindow = target;
|
||||
}
|
||||
if (target == xdndCollectionWindow) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue