summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
Commit message (Collapse)AuthorAgeFilesLines
* platforms: rename QGenericUnixServices to QDesktopUnixServicesLiang Qi2025-01-211-2/+2
| | | | | | | | | | The implementation follows XDG Desktop Portal mostly, and is for desktop, not generic unix. Task-number: QTBUG-130884 Pick-to: 6.9 Change-Id: I88456abb37b8b23cfec00ee8eac8ffee9a65ed9f Reviewed-by: Tor Arne Vestbø <[email protected]>
* GTK3 platformtheme: port from Q_FOREACH to ranged-forAhmad Samir2025-01-031-3/+4
| | | | | | | | | | | | setNameFilters(): the container parameter referes to a local const conatiner at the call site. The other two loops are straightforward ports, iterating over local const containers. Task-number: QTBUG-115796 Change-Id: I42a89af311b75e98c75f955f9a706a4b29cad5e3 Reviewed-by: Marc Mutz <[email protected]>
* Mark GTK theme plugin as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-091-0/+2
| | | | | | | | | | | | | | | | The density of Q_FOREACH uses isn't very high here, but at this time, this author just goes through the code-base and white-lists TUs that still use Q_FOREACH in order to globally enable QT_NO_FOREACH. Mark the whole plugin with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TU by #undef'ing QT_NO_FOREACH locally, at the top of each file. Since the TU is part of a larger executable, this requires the file to be compiled separately, so add it to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). Task-number: QTBUG-115839 Change-Id: If731d02f65131c94afa8beb51679ed2ff7d2cdaa Reviewed-by: Richard Moe Gustavsen <[email protected]>
* QGtk3Dialog: remove the #include for empty mocThiago Macieira2022-09-011-2/+0
| | | | | | | | | | | | | | | | | | This amends 64e6233252117415d6765b6f7a8f4df39490b678. Automoc complains: AutoMoc warning --------------- "SRC:/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp" includes the moc file "qgtk3dialoghelpers.moc", but does not contain a Q_OBJECT, Q_GADGET, Q_GADGET_EXPORT, Q_NAMESPACE, Q_NAMESPACE_EXPORT or Q_ENUM_NS macro. AutoMoc: /home/tjmaciei/src/qt/qt6/qtbase/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp:0:1: note: No relevant classes found. No output generated. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ic6547f8247454b47baa8fffd170ea8a8ce0ed06c Reviewed-by: Liang Qi <[email protected]> Reviewed-by: Ilya Fedin <[email protected]>
* QGtk3Theme: Support setting dialog parent on WaylandIlya Fedin2022-08-191-2/+21
| | | | | | | | This adds support for setting parent window for GTK dialogs on Wayland using the new API added for portals Change-Id: I29085c926ce4338ff2ad75728d566ec843d3aa5a Reviewed-by: Liang Qi <[email protected]>
* Remove unneeded QWindow from QGtk3DialogIlya Fedin2022-08-171-62/+20
| | | | | | | | | | | | | It seems QWindow here is only for making the dialog modal, but QDialog already handles that and this makes two modals block each other depending on the order they created with Task-number: QTBUG-98988 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I6847cfab480395f62eaa0ebf79acf8b024192178 Reviewed-by: David Edmundson <[email protected]> Reviewed-by: Liang Qi <[email protected]> Reviewed-by: Dmitry Shachnev <[email protected]>
* QGtk3Theme: Use GDK X11-specific API only built with X11Ilya Fedin2022-07-061-1/+6
| | | | | | | | | And respect xlib config option Pick-to: 6.4 6.3 6.2 Change-Id: I596097259ed008357e739c3cfe41ab2fc4e18db7 Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Liang Qi <[email protected]>
* Fix typos in docs and commentsKai Köhne2022-06-151-1/+1
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* Plugins: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-041-1/+3
| | | | | | | | | As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Task-number: QTBUG-98434 Change-Id: I7fadd3cf27ad099028d70f05956303e3af62c0f5 Reviewed-by: Marc Mutz <[email protected]>
* Plugins: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-05-021-1/+1
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Id76add7e86b6dfb89f758a9efb0644067f0f44de Reviewed-by: Marc Mutz <[email protected]>
* QGtk3ThemePlugin: includemocsMarc Mutz2022-04-291-0/+2
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: I1e023a23a95088effbbcd830eff627fbc4a3c12a Reviewed-by: Mårten Nordheim <[email protected]>
* Implement preview support for GTK file dialogIlya Fedin2021-09-291-0/+40
| | | | | | | | | | | | | | | This adds preview support in GTK file dialog implementation, this is helpful for a lot of applications like image viewers, messengers and etc. [ChangeLog][Platform Specific Changes][Linux] A native GTK file dialog (created via QFileDialog or QtQuick.Dialogs) now shows an image preview pane. Task-number: QTBUG-3796 Task-number: QTBUG-53167 Change-Id: Ib80108c09b84d774440a0445adcccab4b64652ef Reviewed-by: Shawn Rutledge <[email protected]>
* QFont: Prefer setFamilies() over setFamily()Andy Shaw2020-11-201-1/+1
| | | | | | | | | | | | | | | | By depending on setFamilies() then we can be sure that font names with spaces, commas, quotes and so on are correctly handled without being misinterpreted. For now it will split on the comma when a string containing one is passed to setFamily. But from Qt 6.2 this will be removed to preserve the family string as a convenience function. [ChangeLog][QtGui][QFont] Indicated that setFamilies/families is preferred over setFamily/family to ensure that font family names are preserved when spaces, commas and so on are used in the name. Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* Use OpenType font weightsJonas Karlsson2020-08-281-2/+1
| | | | | | | Task-number: QTBUG-42248 Change-Id: Icdb301b27d6699c2b842c4563fbef9df73c23cbc Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-4/+4
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* Convert QStrings with qUtf8Printable for GTK API callsMichael Brüning2017-03-301-25/+20
| | | | | | | | | | | The fix for dangling pointers in 524f39 caused some problems when the QByteArray was implicitly converted to const gchar*. This is fixed by wrapping the QString in question in qUtf8Printable where possible and removing the former convenience method. Task-number: QTBUG-59692 Change-Id: I5abcf42e1c23b12c7a5c4c195d801f377fe9d138 Reviewed-by: J-P Nurmi <[email protected]>
* Set the mode for the GTK3 file chooser also in selectFileMichael Brüning2017-03-291-3/+16
| | | | | | | | | | | | | | | | If the mode is not GTK_FILE_CHOOSER_ACTION_SAVE or GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER , a GTK warning will be generated which makes Qt WebEngine's Glib error handler assert. Doing so only when showing the dialog is too late. This patch moves the actual file selection to a private method that can be called from both selectFile and applyOptions in order to prevent overwriting the file chooser action potentially multiple times. Task-number: QTBUG-59692 Change-Id: Ied939248cdc3a0b4c9e8239ab61ba617a46b8496 Reviewed-by: J-P Nurmi <[email protected]>
* gtk3: Fix use of dangling pointersThiago Macieira2017-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | QString::toUtf8() returns QByteArray, which got implicitly converted to C strings and promptly deleted. Instead, return the QByteArray to the caller. Found by ASAN: ==13935==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060000dffb8 at pc 0x7f764f27320b bp 0x7ffd49b11bb0 sp 0x7ffd49b11358 READ of size 7 at 0x6060000dffb8 thread T0 #1 0x7f7649d174e2 in g_strdup (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x684e2) #2 0x7f763f7abe5b (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x39e5b) #3 0x7f763f78915a in g_object_new_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1715a) #4 0x7f763f789520 in g_object_new (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x17520) #5 0x7f7640f6bcb0 in gtk_dialog_add_button (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x186cb0) #6 0x7f7640f8d2c9 in gtk_file_chooser_dialog_new (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1a82c9) #7 0x7f7641727281 (/opt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes/libqgtk3.so+0x13281) Task-number: QTBUG-59611 Change-Id: I37cc967e689f4523b504fffd14adbf944b53b754 Reviewed-by: J-P Nurmi <[email protected]>
* QGtk3Dialog: don't crash on WaylandJ-P Nurmi2016-12-091-4/+6
| | | | | | | | | | | Check if it's an X11 window before calling XSetTransientForHint(). No transient parent will be set for GTK+ dialogs on Wayland. That has to be implemented separately. Task-number: QTBUG-55583 Change-Id: Iabc2a72681c8157bb2f2fe500892853aa397106b Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-081-5/+13
|\ | | | | | | | | | | | | Conflicts: src/corelib/tools/qalgorithms.h Change-Id: Ib8ce4d5d9ecd5b9c166d5b8b44e58f3e4e7283ff
| * GTK+ dialogs: Get rid of deprecated GtkStock usageDmitry Shachnev2016-11-031-5/+13
| | | | | | | | | | | | | | | | GtkStock has been deprecated since GTK+ 3.10, and is removed in GTK+ 4. Use the standard button names provided by Qt instead. Change-Id: I55e8452178544b4a9ebf5c75b70f4c5c56c047f4 Reviewed-by: J-P Nurmi <[email protected]>
* | Plugins: optimize string usageAnton Kudryavtsev2016-10-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Prefer QStringRef methods to avoid allocations. Use startsWith/endsWith rather than comparing substrings; and avoid substrings where references suffice. Use new QStringList::join(QL1S). Change-Id: I46c44aca96578633370006d613eb0ac13f7cfc03 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
* | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-08-291-16/+14
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a were reverted because of reconstruction in 5.7. defineTest(qtConfTest_checkCompiler) in configure.pri is smart enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5. DirectWrite: Fix advances being scaled to 0 Since 131eee5cd, the stretch of a font can be 0, meaning "whatever the font provides". In combination with ec7fee96, this would cause advances in the DirectWrite engine to be scaled to 0, causing the QRawFont test to fail. Conflicts: configure mkspecs/features/uikit/device_destinations.sh mkspecs/features/uikit/xcodebuild.mk src/corelib/global/qglobal.cpp src/corelib/global/qnamespace.qdoc src/plugins/platforms/cocoa/qcocoamenuitem.h src/plugins/platforms/windows/qwindowsservices.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp src/widgets/kernel/qapplication.cpp tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
| * GTK+ dialogs: do not emit duplicate selected signalsJ-P Nurmi2016-08-201-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As mentioned in the bug report, these are already emitted in: - QColorDialog::done(Accepted) - QFileDialog::done() - QFontDialog::accepted() The same signal emissions were reverted from the Cocoa dialogs in 916a8c44c4a9ba639e89660226d14d51ed44feaa. For QtQuick Dialogs, these don't matter because they handle this in accepted(). Task-number: QTBUG-55298 Change-Id: I7990836745b160ec8de948697e2924322a583b6c Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
| * QGtk3FileDialogHelper: provide proper filterSelected()J-P Nurmi2016-08-201-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GTK+ file dialog never had a proper filterSelected() signal. As a workaround, filterSelected() was emitted from accept() to ensure that the signal wasn't entirely missing. Now we can remove the improper emission on accept, because using the "notify::filter" signal gives proper notifications whenever the filter selection in the dialog changes. Change-Id: Iedfe08c49b85adf262af9cdc750efb1fd1698379 Task-number: QTBUG-55298 Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
| * Fix QGtk3ColorDialogHelper::currentColorChanged() emissionJ-P Nurmi2016-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though GtkColorChooser provides a "color-activated" signal, it does not get emitted whenever the selection in the dialog changes, but only when a color is activated in a sense that the dialog is accepted. Switch to the "notify::rgba" signal to get proper live notifications of the selection changes. Task-number: QTBUG-55298 Change-Id: I39ab798764c8b42a998d75c56605948eaf154dcd Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
| * QGtk3FontDialogHelper: provide proper currentFontChanged()J-P Nurmi2016-08-171-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | A workaround for the missing currentFontChanged() signal was added in 130f43c. Now we can remove the improper emission on accept, because by using the "notify::font" signal gives proper notifications whenever the current font selection in the dialog changes. Task-number: QTBUG-55298 Change-Id: Id9a4f32a92f0be8f466a0a0587bb2acd4c9056f7 Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-161-2/+4
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| * QGtk3Dialog::show(): add missing null-check to avoid warningsJ-P Nurmi2016-08-151-2/+4
| | | | | | | | | | | | | | | | | | | | Or else QObject::connect() warns about 'invalid null parameter' when showing parentless dialogs. Task-number: QTBUG-55298 Change-Id: I39b1dfc81e5da0c793c86cff763f946db15c13ae Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* | QGtk3FileDialogHelper: respect QFileDialogOptions::ReadOnlyJ-P Nurmi2016-06-271-0/+3
| | | | | | | | | | Change-Id: I982dd10632760fe91b89ade30d79f97f27d17dcd Reviewed-by: Mitch Curtis <[email protected]>
* | Improve QGtk3FontDialogHelper::onAccepted()J-P Nurmi2016-06-201-2/+3
| | | | | | | | | | | | | | | | Call currentFont() only once. It does a conversion from a Pango font description string to a Qt font, so not entirely trivial operation. Change-Id: Ic67b7c5b0874621c51a5cce4766acd4243d3dfde Reviewed-by: Mitch Curtis <[email protected]>
* | QGtk3ColorDialogHelper: ensure currentColorChanged() gets emittedJ-P Nurmi2016-06-201-1/+3
|/ | | | | | | | | | GTK does not emit the "color-activated" signal as expected, so make sure currentColorChanged() gets emitted the same way it's done for QGtk3FontDialogHelper. This ensures that QML bindings get re-evaluated as appropriate. Change-Id: Id00f144e8b9a08afee57ef6a6033972cdc4307b0 Reviewed-by: Mitch Curtis <[email protected]>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-241-2/+2
| | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/plugins/platforms/windows/qwindowsfontengine.cpp src/plugins/platforms/windows/qwindowsnativeimage.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <[email protected]>
* Merge remote-tracking branch 'origin/5.6' into devFrederik Gladhorn2016-01-081-0/+11
| | | | | | Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
* Port the Gtk platform theme to Gtk+ 3Dmitry Shachnev2015-11-131-0/+587
The major changes compared to the Gtk+ 2 version are: * Everything is ported to modern Gtk/Gdk API. * GtkFontChooserDialog is used instead of deprecated GtkFontSelectionDialog. * Hiding buttons on dialogs (like OK/Cancel) is no longer supported, as it is impossible to do that with dialogs using GtkHeaderBars. * Some workarounds were added to the QGtk3Theme constructor to correctly work with Gtk+ 3. [ChangeLog][Platform Specific Changes] The Gtk+ platform theme has been ported to Gtk+ 3. Change-Id: Iacb01279b6432e0901e3bb1353d5792543cc76e4 Done-with: J-P Nurmi <[email protected]> Reviewed-by: Oswald Buddenhagen <[email protected]> Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <[email protected]> Reviewed-by: J-P Nurmi <[email protected]>