summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp7
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm29
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm8
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp4
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp23
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp4
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp64
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h2
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp10
15 files changed, 99 insertions, 64 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 0fabb25233..17c197ea38 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -533,6 +533,12 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para
return pthread_create(&m_qtAppThread, nullptr, startMainMethod, nullptr) == 0;
}
+static void quitQtCoreApplication(JNIEnv *env, jclass /*clazz*/)
+{
+ Q_UNUSED(env);
+ QCoreApplication::quit();
+}
+
static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/)
{
Q_UNUSED(env);
@@ -733,6 +739,7 @@ static JNINativeMethod methods[] = {
{"startQtAndroidPlugin", "()Z", (void *)startQtAndroidPlugin},
{"startQtApplication", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApplication},
{"quitQtAndroidPlugin", "()V", (void *)quitQtAndroidPlugin},
+ {"quitQtCoreApplication", "()V", (void *)quitQtCoreApplication},
{"terminateQt", "()V", (void *)terminateQt},
{"setDisplayMetrics", "(IIIIDDDD)V", (void *)setDisplayMetrics},
{"setSurface", "(ILjava/lang/Object;II)V", (void *)setSurface},
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 6478365d07..602cea97a7 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -58,6 +58,8 @@
#include <QDebug>
+#include <vector>
+
enum {
defaultWindowWidth = 160,
defaultWindowHeight = 160
@@ -1613,6 +1615,13 @@ void QCocoaWindow::recreateWindowIfNeeded()
[m_nsWindow closeAndRelease];
if (isChildNSWindow())
[m_view.window.parentWindow removeChildWindow:m_view.window];
+ if (isContentView()) {
+ // We explicitly disassociate m_view from the window's contentView,
+ // as AppKit does not automatically do this in response to removing
+ // the view from the NSThemeFrame subview list, so we might end up
+ // with a NSWindow contentView pointing to a deallocated NSView.
+ m_view.window.contentView = nil;
+ }
m_nsWindow = 0;
}
@@ -1636,13 +1645,6 @@ void QCocoaWindow::recreateWindowIfNeeded()
[m_nsWindow setContentView:m_view];
[m_view release];
[m_view setPostsFrameChangedNotifications:YES];
- // QTBUG-58963
- // viewDidChangeFrame() should be called for each window automatically at this point because it is
- // registered with Q_NOTIFICATION_HANDLER(NSViewFrameDidChangeNotification);
- // The corner case when it's not called and we need to make a manual geometry update is when window's
- // size is not specified explicitly but minimumSize is set and matches to the size NSView was created with.
- if (QSizeF::fromCGSize(m_view.frame.size) == [QNSView defaultViewSize])
- viewDidChangeFrame();
}
}
@@ -1862,8 +1864,7 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
// the new state.
return;
}
- default:
- Q_FALLTHROUGH();
+ default:;
}
// Then we apply the new state if needed
@@ -1881,12 +1882,8 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
[m_nsWindow miniaturize:sender];
break;
case Qt::WindowNoState:
- switch (windowState()) {
- case Qt::WindowMaximized:
+ if (windowState() == Qt::WindowMaximized)
toggleMaximized();
- default:
- Q_FALLTHROUGH();
- }
break;
default:
Q_UNREACHABLE();
@@ -2068,10 +2065,10 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
}
// Find consecutive registered border areas, starting from the top.
- QList<BorderRange> ranges = m_contentBorderAreas.values();
+ std::vector<BorderRange> ranges(m_contentBorderAreas.cbegin(), m_contentBorderAreas.cend());
std::sort(ranges.begin(), ranges.end());
int effectiveTopContentBorderThickness = m_topContentBorderThickness;
- foreach (BorderRange range, ranges) {
+ for (BorderRange range : ranges) {
// Skip disiabled ranges (typically hidden tool bars)
if (!m_enabledContentBorderAreas.value(range.identifier, false))
continue;
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index a05bd66890..75a508370f 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -88,7 +88,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
QSet<quint32> m_acceptedKeyDowns;
}
-+ (QSizeF)defaultViewSize;
- (id)init;
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
#ifndef QT_NO_OPENGL
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index e16915273a..bbdf9ad44f 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -140,8 +140,7 @@ static bool _q_dontOverrideCtrlLMB = false;
- (id) init
{
- self = [super initWithFrame : NSMakeRect(0, 0, [[self class] defaultViewSize].width(), [[self class] defaultViewSize].height())];
- if (self) {
+ if (self = [super initWithFrame:NSZeroRect]) {
m_backingStore = 0;
m_maskImage = 0;
m_shouldInvalidateWindowShadow = false;
@@ -189,11 +188,6 @@ static bool _q_dontOverrideCtrlLMB = false;
[super dealloc];
}
-+ (QSizeF)defaultViewSize
-{
- return QSizeF(300.0, 300.0);
-}
-
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow
{
self = [self init];
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 5f65f8e958..f017929148 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -1088,6 +1088,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
} break;
case QtWindows::DpiChangedEvent: {
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_DLGFRAME)
+ return false; // Fixed-size window should not be resized
+
platformWindow->setFlag(QWindowsWindow::WithinDpiChanged);
const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam);
SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top,
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index 71fd12d71b..bd4822c664 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -717,7 +717,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
if (preferredType == QVariant::String)
ret = str;
else
- ret = str.toUtf8();
+ ret = std::move(str).toUtf8();
}
qCDebug(lcQpaMime) << __FUNCTION__ << ret;
return ret;
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 4ae1a751e9..3e2cb5e9e9 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -815,14 +815,14 @@ QString QWindowsFileIconEngine::cacheKey() const
// Return "" for .exe, .lnk and .ico extensions.
// It is faster to just look at the file extensions;
// avoiding slow QFileInfo::isExecutable() (QTBUG-13182)
- const QString &suffix = fileInfo().suffix();
+ QString suffix = fileInfo().suffix();
if (!suffix.compare(QLatin1String("exe"), Qt::CaseInsensitive)
|| !suffix.compare(QLatin1String("lnk"), Qt::CaseInsensitive)
|| !suffix.compare(QLatin1String("ico"), Qt::CaseInsensitive)) {
return QString();
}
return QLatin1String("qt_.")
- + (suffix.isEmpty() ? fileInfo().fileName() : suffix.toUpper()); // handle "Makefile" ;)
+ + (suffix.isEmpty() ? fileInfo().fileName() : std::move(suffix).toUpper()); // handle "Makefile" ;)
}
QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon::State)
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index 150fc8a25e..edfcf038d7 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -91,6 +91,7 @@ typedef ITypedEventHandler<CoreWindow*, PointerEventArgs*> PointerHandler;
typedef ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*> SizeChangedHandler;
typedef ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*> VisibilityChangedHandler;
typedef ITypedEventHandler<DisplayInformation*, IInspectable*> DisplayInformationHandler;
+typedef ITypedEventHandler<ICorePointerRedirector*, PointerEventArgs*> RedirectHandler;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef ITypedEventHandler<ApplicationView*, IInspectable*> VisibleBoundsChangedHandler;
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
@@ -454,6 +455,8 @@ typedef HRESULT (__stdcall ICoreWindow::*CoreWindowCallbackRemover)(EventRegistr
uint qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRegistrationToken);
uint qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
+typedef HRESULT (__stdcall ICorePointerRedirector::*RedirectorCallbackRemover)(EventRegistrationToken);
+uint qHash(RedirectorCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef HRESULT (__stdcall IApplicationView2::*ApplicationView2CallbackRemover)(EventRegistrationToken);
uint qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
@@ -464,6 +467,7 @@ class QWinRTScreenPrivate
public:
QTouchDevice *touchDevice;
ComPtr<ICoreWindow> coreWindow;
+ ComPtr<ICorePointerRedirector> redirect;
ComPtr<Xaml::IDependencyObject> canvas;
ComPtr<IApplicationView> view;
ComPtr<IDisplayInformation> displayInformation;
@@ -482,6 +486,7 @@ public:
QHash<Qt::Key, KeyInfo> activeKeys;
QHash<CoreWindowCallbackRemover, EventRegistrationToken> windowTokens;
QHash<DisplayCallbackRemover, EventRegistrationToken> displayTokens;
+ QHash<RedirectorCallbackRemover, EventRegistrationToken> redirectTokens;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QHash<ApplicationView2CallbackRemover, EventRegistrationToken> view2Tokens;
ComPtr<IApplicationView2> view2;
@@ -513,6 +518,10 @@ QWinRTScreen::QWinRTScreen()
hr = window->get_CoreWindow(&d->coreWindow);
Q_ASSERT_SUCCEEDED(hr);
+
+ hr = d->coreWindow.As(&d->redirect);
+ Q_ASSERT_SUCCEEDED(hr);
+
hr = d->coreWindow->Activate();
Q_ASSERT_SUCCEEDED(hr);
@@ -595,6 +604,10 @@ QWinRTScreen::~QWinRTScreen()
hr = (d->displayInformation.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr);
}
+ for (QHash<RedirectorCallbackRemover, EventRegistrationToken>::const_iterator i = d->redirectTokens.begin(); i != d->redirectTokens.end(); ++i) {
+ hr = (d->redirect.Get()->*i.key())(i.value());
+ Q_ASSERT_SUCCEEDED(hr);
+ }
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
for (QHash<ApplicationView2CallbackRemover, EventRegistrationToken>::const_iterator i = d->view2Tokens.begin(); i != d->view2Tokens.end(); ++i) {
hr = (d->view2.Get()->*i.key())(i.value());
@@ -754,6 +767,9 @@ void QWinRTScreen::initialize()
Q_ASSERT_SUCCEEDED(hr);
onOrientationChanged(Q_NULLPTR, Q_NULLPTR);
onVisibilityChanged(nullptr, nullptr);
+
+ hr = d->redirect->add_PointerRoutedReleased(Callback<RedirectHandler>(this, &QWinRTScreen::onRedirectReleased).Get(), &d->redirectTokens[&ICorePointerRedirector::remove_PointerRoutedReleased]);
+ Q_ASSERT_SUCCEEDED(hr);
}
void QWinRTScreen::setCursorRect(const QRectF &cursorRect)
@@ -1378,6 +1394,13 @@ HRESULT QWinRTScreen::onDpiChanged(IDisplayInformation *, IInspectable *)
return S_OK;
}
+HRESULT QWinRTScreen::onRedirectReleased(ICorePointerRedirector *, IPointerEventArgs *args)
+{
+ // When dragging ends with a non-mouse input device then onRedirectRelease is invoked.
+ // QTBUG-58781
+ return onPointerUpdated(nullptr, args);
+}
+
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
HRESULT QWinRTScreen::onWindowSizeChanged(IApplicationView *, IInspectable *)
#else
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h
index 7dcdb98ead..fd6499c2b9 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.h
+++ b/src/plugins/platforms/winrt/qwinrtscreen.h
@@ -52,6 +52,7 @@ namespace ABI {
namespace Core {
struct IAutomationProviderRequestedEventArgs;
struct ICharacterReceivedEventArgs;
+ struct ICorePointerRedirector;
struct ICoreWindow;
struct ICoreWindowEventArgs;
struct IKeyEventArgs;
@@ -149,6 +150,7 @@ private:
#else
HRESULT onWindowSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
#endif
+ HRESULT onRedirectReleased(ABI::Windows::UI::Core::ICorePointerRedirector *, ABI::Windows::UI::Core::IPointerEventArgs *);
QScopedPointer<QWinRTScreenPrivate> d_ptr;
QRectF mCursorRect;
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 7f1cff1299..396d8837e9 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -479,7 +479,7 @@ QByteArray QXcbIntegration::wmClass() const
}
if (!name.isEmpty() && !className.isEmpty())
- m_wmClass = name.toLocal8Bit() + '\0' + className.toLocal8Bit() + '\0';
+ m_wmClass = std::move(name).toLocal8Bit() + '\0' + std::move(className).toLocal8Bit() + '\0';
}
return m_wmClass;
}
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index 7592eb2887..186f31e08a 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -305,7 +305,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
QString formatWithCharset = format;
formatWithCharset.append(QLatin1String(";charset=utf-8"));
- xcb_atom_t a = connection->internAtom(formatWithCharset.toLatin1());
+ xcb_atom_t a = connection->internAtom(std::move(formatWithCharset).toLatin1());
if (a && atoms.contains(a)) {
*requestedEncoding = "utf-8";
return a;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 3d8c6de72f..db6ade5662 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1472,8 +1472,8 @@ void QXcbWindow::setParent(const QPlatformWindow *parent)
void QXcbWindow::setWindowTitle(const QString &title)
{
- const QString fullTitle = formatWindowTitle(title, QString::fromUtf8(" \xe2\x80\x94 ")); // unicode character U+2014, EM DASH
- const QByteArray ba = fullTitle.toUtf8();
+ QString fullTitle = formatWindowTitle(title, QString::fromUtf8(" \xe2\x80\x94 ")); // unicode character U+2014, EM DASH
+ const QByteArray ba = std::move(fullTitle).toUtf8();
xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
m_window,
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
index 8b6ec31400..c64a02fa0c 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
@@ -57,11 +57,6 @@
QT_BEGIN_NAMESPACE
-static QByteArray standardButtonText(int button)
-{
- return QGtk3Theme::defaultStandardButtonText(button).toUtf8();
-}
-
class QGtk3Dialog : public QWindow
{
Q_OBJECT
@@ -236,7 +231,7 @@ void QGtk3ColorDialogHelper::onColorChanged(QGtk3ColorDialogHelper *dialog)
void QGtk3ColorDialogHelper::applyOptions()
{
GtkDialog *gtkDialog = d->gtkDialog();
- gtk_window_set_title(GTK_WINDOW(gtkDialog), options()->windowTitle().toUtf8());
+ gtk_window_set_title(GTK_WINDOW(gtkDialog), qUtf8Printable(options()->windowTitle()));
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(gtkDialog), options()->testOption(QColorDialogOptions::ShowAlphaChannel));
}
@@ -245,8 +240,8 @@ QGtk3FileDialogHelper::QGtk3FileDialogHelper()
{
d.reset(new QGtk3Dialog(gtk_file_chooser_dialog_new("", 0,
GTK_FILE_CHOOSER_ACTION_OPEN,
- standardButtonText(QPlatformDialogHelper::Cancel), GTK_RESPONSE_CANCEL,
- standardButtonText(QPlatformDialogHelper::Ok), GTK_RESPONSE_OK,
+ qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Cancel)), GTK_RESPONSE_CANCEL,
+ qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Ok)), GTK_RESPONSE_OK,
NULL)));
connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted()));
@@ -294,7 +289,7 @@ bool QGtk3FileDialogHelper::defaultNameFilterDisables() const
void QGtk3FileDialogHelper::setDirectory(const QUrl &directory)
{
GtkDialog *gtkDialog = d->gtkDialog();
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), directory.toLocalFile().toUtf8());
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(directory.toLocalFile()));
}
QUrl QGtk3FileDialogHelper::directory() const
@@ -316,13 +311,19 @@ QUrl QGtk3FileDialogHelper::directory() const
void QGtk3FileDialogHelper::selectFile(const QUrl &filename)
{
+ setFileChooserAction();
+ selectFileInternal(filename);
+}
+
+void QGtk3FileDialogHelper::selectFileInternal(const QUrl &filename)
+{
GtkDialog *gtkDialog = d->gtkDialog();
if (options()->acceptMode() == QFileDialogOptions::AcceptSave) {
QFileInfo fi(filename.toLocalFile());
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), fi.path().toUtf8());
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(gtkDialog), fi.fileName().toUtf8());
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(fi.path()));
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(fi.fileName()));
} else {
- gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(gtkDialog), filename.toLocalFile().toUtf8());
+ gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(filename.toLocalFile()));
}
}
@@ -409,16 +410,23 @@ static GtkFileChooserAction gtkFileChooserAction(const QSharedPointer<QFileDialo
}
}
+void QGtk3FileDialogHelper::setFileChooserAction()
+{
+ GtkDialog *gtkDialog = d->gtkDialog();
+
+ const GtkFileChooserAction action = gtkFileChooserAction(options());
+ gtk_file_chooser_set_action(GTK_FILE_CHOOSER(gtkDialog), action);
+}
+
void QGtk3FileDialogHelper::applyOptions()
{
GtkDialog *gtkDialog = d->gtkDialog();
const QSharedPointer<QFileDialogOptions> &opts = options();
- gtk_window_set_title(GTK_WINDOW(gtkDialog), opts->windowTitle().toUtf8());
+ gtk_window_set_title(GTK_WINDOW(gtkDialog), qUtf8Printable(opts->windowTitle()));
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(gtkDialog), true);
- const GtkFileChooserAction action = gtkFileChooserAction(opts);
- gtk_file_chooser_set_action(GTK_FILE_CHOOSER(gtkDialog), action);
+ setFileChooserAction();
const bool selectMultiple = opts->fileMode() == QFileDialogOptions::ExistingFiles;
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(gtkDialog), selectMultiple);
@@ -437,7 +445,7 @@ void QGtk3FileDialogHelper::applyOptions()
setDirectory(opts->initialDirectory());
foreach (const QUrl &filename, opts->initiallySelectedFiles())
- selectFile(filename);
+ selectFileInternal(filename);
const QString initialNameFilter = opts->initiallySelectedNameFilter();
if (!initialNameFilter.isEmpty())
@@ -446,19 +454,19 @@ void QGtk3FileDialogHelper::applyOptions()
GtkWidget *acceptButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_OK);
if (acceptButton) {
if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
- gtk_button_set_label(GTK_BUTTON(acceptButton), opts->labelText(QFileDialogOptions::Accept).toUtf8());
+ gtk_button_set_label(GTK_BUTTON(acceptButton), qUtf8Printable(opts->labelText(QFileDialogOptions::Accept)));
else if (opts->acceptMode() == QFileDialogOptions::AcceptOpen)
- gtk_button_set_label(GTK_BUTTON(acceptButton), standardButtonText(QPlatformDialogHelper::Open));
+ gtk_button_set_label(GTK_BUTTON(acceptButton), qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Open)));
else
- gtk_button_set_label(GTK_BUTTON(acceptButton), standardButtonText(QPlatformDialogHelper::Save));
+ gtk_button_set_label(GTK_BUTTON(acceptButton), qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Save)));
}
GtkWidget *rejectButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_CANCEL);
if (rejectButton) {
if (opts->isLabelExplicitlySet(QFileDialogOptions::Reject))
- gtk_button_set_label(GTK_BUTTON(rejectButton), opts->labelText(QFileDialogOptions::Reject).toUtf8());
+ gtk_button_set_label(GTK_BUTTON(rejectButton), qUtf8Printable(opts->labelText(QFileDialogOptions::Reject)));
else
- gtk_button_set_label(GTK_BUTTON(rejectButton), standardButtonText(QPlatformDialogHelper::Cancel));
+ gtk_button_set_label(GTK_BUTTON(rejectButton), qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Cancel)));
}
}
@@ -473,12 +481,12 @@ void QGtk3FileDialogHelper::setNameFilters(const QStringList &filters)
foreach (const QString &filter, filters) {
GtkFileFilter *gtkFilter = gtk_file_filter_new();
- const QStringRef name = filter.leftRef(filter.indexOf(QLatin1Char('(')));
+ const QString name = filter.left(filter.indexOf(QLatin1Char('(')));
const QStringList extensions = cleanFilterList(filter);
- gtk_file_filter_set_name(gtkFilter, name.isEmpty() ? extensions.join(QLatin1String(", ")).toUtf8() : name.toUtf8());
+ gtk_file_filter_set_name(gtkFilter, qUtf8Printable(name.isEmpty() ? extensions.join(QLatin1String(", ")) : name));
foreach (const QString &ext, extensions)
- gtk_file_filter_add_pattern(gtkFilter, ext.toUtf8());
+ gtk_file_filter_add_pattern(gtkFilter, qUtf8Printable(ext));
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(gtkDialog), gtkFilter);
@@ -520,7 +528,7 @@ static QString qt_fontToString(const QFont &font)
{
PangoFontDescription *desc = pango_font_description_new();
pango_font_description_set_size(desc, (font.pointSizeF() > 0.0 ? font.pointSizeF() : QFontInfo(font).pointSizeF()) * PANGO_SCALE);
- pango_font_description_set_family(desc, QFontInfo(font).family().toUtf8());
+ pango_font_description_set_family(desc, qUtf8Printable(QFontInfo(font).family()));
int weight = font.weight();
if (weight >= QFont::Black)
@@ -560,7 +568,7 @@ static QString qt_fontToString(const QFont &font)
static QFont qt_fontFromString(const QString &name)
{
QFont font;
- PangoFontDescription *desc = pango_font_description_from_string(name.toUtf8());
+ PangoFontDescription *desc = pango_font_description_from_string(qUtf8Printable(name));
font.setPointSizeF(static_cast<float>(pango_font_description_get_size(desc)) / PANGO_SCALE);
QString family = QString::fromUtf8(pango_font_description_get_family(desc));
@@ -585,7 +593,7 @@ static QFont qt_fontFromString(const QString &name)
void QGtk3FontDialogHelper::setCurrentFont(const QFont &font)
{
GtkFontChooser *gtkDialog = GTK_FONT_CHOOSER(d->gtkDialog());
- gtk_font_chooser_set_font(gtkDialog, qt_fontToString(font).toUtf8());
+ gtk_font_chooser_set_font(gtkDialog, qUtf8Printable(qt_fontToString(font)));
}
QFont QGtk3FontDialogHelper::currentFont() const
@@ -612,7 +620,7 @@ void QGtk3FontDialogHelper::applyOptions()
GtkDialog *gtkDialog = d->gtkDialog();
const QSharedPointer<QFontDialogOptions> &opts = options();
- gtk_window_set_title(GTK_WINDOW(gtkDialog), opts->windowTitle().toUtf8());
+ gtk_window_set_title(GTK_WINDOW(gtkDialog), qUtf8Printable(opts->windowTitle()));
}
QT_END_NAMESPACE
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h
index 99add3bda3..ba43046e04 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h
@@ -110,6 +110,8 @@ private:
static void onFilterChanged(QGtk3FileDialogHelper *helper);
void applyOptions();
void setNameFilters(const QStringList &filters);
+ void selectFileInternal(const QUrl &filename);
+ void setFileChooserAction();
QUrl _dir;
QList<QUrl> _selection;
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index f8cab07597..b60fa1058f 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -911,7 +911,7 @@ bool QPSQLDriver::open(const QString & db,
connectString.append(QLatin1Char(' ')).append(opt);
}
- d->connection = PQconnectdb(connectString.toLocal8Bit().constData());
+ d->connection = PQconnectdb(std::move(connectString).toLocal8Bit().constData());
if (PQstatus(d->connection) == CONNECTION_BAD) {
setLastError(qMakeError(tr("Unable to connect"), QSqlError::ConnectionError, d));
setOpenError(true);
@@ -1073,12 +1073,12 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
else
- tbl = tbl.toLower();
+ tbl = std::move(tbl).toLower();
if (isIdentifierEscaped(schema, QSqlDriver::TableName))
schema = stripDelimiters(schema, QSqlDriver::TableName);
else
- schema = schema.toLower();
+ schema = std::move(schema).toLower();
switch(d->pro) {
case QPSQLDriver::Version6:
@@ -1153,12 +1153,12 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
else
- tbl = tbl.toLower();
+ tbl = std::move(tbl).toLower();
if (isIdentifierEscaped(schema, QSqlDriver::TableName))
schema = stripDelimiters(schema, QSqlDriver::TableName);
else
- schema = schema.toLower();
+ schema = std::move(schema).toLower();
QString stmt;
switch(d->pro) {