Coder Social home page Coder Social logo

fedoraqt / qgnomeplatform Goto Github PK

View Code? Open in Web Editor NEW
263.0 9.0 38.0 280 KB

QPlatformTheme for a better Qt application inclusion in GNOME

License: GNU Lesser General Public License v2.1

C++ 96.05% CMake 3.95%
qt qt5 gnome qt-application platform-theme

qgnomeplatform's Introduction

QGnomePlatform

QGnomePlatform project is unmaintained a no longer actively developed.

QGnomePlatform is a Qt Platform Theme designed to use as many of the GNOME settings as possible in unmodified Qt applications. It allows Qt applications to fit into the environment as well as possible.

How to compile

This library uses private Qt headers and will likely not be forward nor backward compatible. This library will have to be recompiled with every Qt update.

mkdir build
cd build
cmake [OPTIONS] [-DUSE_QT6=true] ..
make && make install

Usage

This library is used automatically in Gtk based desktops such as Gnome, Cinnamon or Xfce.

This platform theme can also be used by setting the QT_QPA_PLATFORMTHEME environment variable to "gnome". For example, put the following command in .bashrc:

export QT_QPA_PLATFORMTHEME='gnome'

License

Most code is under LGPL 2.1 with the "or any later version" clause. New code should be contributed under this license.

This project also incorporates some code from the Qt Project. Because of that the so-called combined work is licensed under LGPL 3.0-only, GPL 2.0, GPL 3.0, or any later GPL version approved by the KDE Free Qt Foundation.

qgnomeplatform's People

Contributors

0x64c avatar cdrummond avatar city-busz avatar gladhorn avatar grulja avatar h4tr3d avatar ilya-fedin avatar jbruechert avatar jtojnar avatar kamikazow avatar laknoll avatar leidav avatar liangqi avatar martinbriza avatar michel-slm avatar mitya57 avatar onigino avatar polter-rnd avatar rokm avatar tsdgeos avatar wolpertinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qgnomeplatform's Issues

Qt can't find the Semi-Light variant of Fira Sans

I don't know if this is an issue you guys can/should fix, but I decided to report anyway...

So, my font settings on GNOME Tweaks looks like this:

Screenshot from 2020-02-29 16-30-55

The "problematic" font is the one set for Interface Text, which is displayed as Fira Sans Book 10 in the screenshot, but it's actually saved with a different name in dconf (don't know why, tbh):

$ gsettings get org.gnome.desktop.interface font-name
'Fira Sans Semi-Light 10'

However, when I launch any Qt program, that font doesn't get picked up. Well, actually it's the Semi-Light variant that doesn't get picked up, because if I go back to GNOME Tweaks and set the Interface Text font to Fira Sans Regular 10, then Qt is able to pick up the font properly.

Here's how I found out:

$ env QT_QPA_PLATFORMTHEME=gnome QT_LOGGING_RULES="*=true" qbittorrent
[... very long output ...]
qt.text.font.match: QFontDatabase::match
  request:
    family: Fira Sans Semi-Light [-- any --], script: 2
    weight: 50, style: 0
    stretch: 0
    pixelSize: 13
    pitch: *
qt.text.font.match:   NO MATCH FOUND

qt.text.font.match: QFontDatabase::match
  request:
    family: Bitstream Vera Sans [-- any --], script: 2
    weight: 50, style: 0
    stretch: 0
    pixelSize: 13
    pitch: *
qt.text.font.match:   REMARK: looking for best foundry for family 'Bitstream Vera Sans' [1]
qt.text.font.match:           looking for matching style in foundry 'Bits' 4
qt.text.font.match:           best style has distance 0x0
qt.text.font.match:           found smoothly scalable font (13 pixels)
qt.text.font.match:           found a match: score 0 best score so far ffffffff
qt.text.font.match: returning box engine
[... more output ...]

Is there any workarounds to this? Thanks!

Icons in menus and buttons

With GTK, icons are not displayed in buttons and menus, but qt does this.
QGnomePlatform does not use the GTK setting, but it should.
(E.g. in qt5ct this can be set.)
In addition, the GNOME like arrangement should be used for dialog buttons ("OK" button always on the right etc.)
qtgnome

QObject::connect: invalid null parameter for native dialogs without parent

Running a (native) dialog without parent results in the following warning printed to the terminal:

QObject::connect: invalid null parameter

Judging by the message, the most likely cause is a connect() call on the (null) parent object.

MWE:

#include <QtWidgets>

int main (int argc, char **argv)
{
    QApplication app(argc, argv);
    QFileDialog::getOpenFileName();
    return 0;
}

Port to CMake

According to https://www.qt.io/blog/qt-6-build-system CMake is the default build system for Qt6. The page says about qmake: "At the moment the qmake build system is still in place" which doesn't really give confidence that qmake is here for the long haul.

Wrong colors applied for the adwaita-qt theme (Qt 5.15)

Hello there,

Qt was recently updated to version 5.15 on Arch Linux, and that broke either QGnomePlatform or adwaita-qt. Although I'm not exactly sure which one, my bet is on QGnomePlatform, because qt5ct applies the theme kinda okay -- because I still have theming issues on some other programs, such as qBittorrent. But with QGnomePlatform, I never had those.

$ QT_QPA_PLATFORMTHEME=gnome QT_LOGGING_RULES="*=true" keepassxc &> qt.log
$ grep platform qt.log
qt.qpa.qgnomeplatform: Font name:  "Cantarell"  (size  11 )
qt.qpa.qgnomeplatform: Monospace font name:  "Source Code Pro"  (size  10 )
qt.qpa.qgnomeplatform: TitleBar font name:  "Cantarell"  (size  11 )
qt.qpa.qgnomeplatform: Cursor blink time:  1200
qt.qpa.qgnomeplatform: Double click time:  400
qt.qpa.qgnomeplatform: Long press time:  500
qt.qpa.qgnomeplatform: Double click distance:  5
qt.qpa.qgnomeplatform: Dnd drag threshold:  8
qt.qpa.qgnomeplatform: Password hint timeout:  0
qt.qpa.qgnomeplatform: Icon theme:  "Papirus-Dark"
qt.qpa.qgnomeplatform: Theme name:  "Adwaita-dark"
qt.qpa.qgnomeplatform: Dark version:  yes

>>> qt.log

Before / After

qgnomeplatform + adwaita-qt on Qt 5.14:

Screenshot from 2020-06-06 23-09-19

qgnomeplatform + adwaita-qt on Qt 5.15:

Screenshot from 2020-06-06 23-05-58

I'm using the git version of both adwaita-qt and qgnomeplatform. And I've tried recompiling both of them, but it didn't help either.

Thanks!

Doesn't work on Ubuntu

Tested on Ubuntu 18.04 and 19.04, it seems that the system is not able to find the QGnomePlatform style.

$ qtcreator -style gnome
QApplication: invalid style override passed, ignoring it.

I also tried with style gtk3 and qgnomeplatform with the same result.

And this also with QT_QPA_PLATFORMTHEME='gnome' but Qt apps present the fusion style and the manual style override fails to find the theme.

$ cat /etc/profile.d/use-qt-gtk.sh 
export QT_QPA_PLATFORMTHEME=gnome

Maybe I'm doing something wrong on my side.
Thanks.

Does not work in Cinnamon

Settings schema is hardcoded and points to org.gnome.desktop.interface. Under Cinnamon scheme is org.cinnamon.desktop.interface but it does not contains monospace-font-name that reused from Gnome schema.

Seems, that two settings provides is needed: main and fallback. Main must be configured using XDG_SESSION_DESKTOP (or DESKTOP_SESSION) environment variables. Fallback must be configured to the Gnome always.

If Main settings sets construction fails or current desktop is a Gnome, just make it pointed to Fallback one.

If Main settings set does not contain some property, request it from Fallback one.

PS I know, that PR is a best report, but time... :-)

qgtk3dialoghelpers.cpp:(.text+0x6a0): undefined reference to `XSetTransientForHint'

Do not compile on openSUSE Tumbleweed.
I got this error:
[ 65s] g++ -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,-rpath-link,/usr/lib64 -shared -o libqgnomeplatform.so platformplugin.o qgnomeplatformtheme.o gnomehintssettings.o qgtk3dialoghelpers.o moc_platformplugin.o moc_gnomehintssettings.o moc_qgtk3dialoghelpers.o -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lQt5ThemeSupport -L/usr/lib64 -lQt5DBus -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
[ 65s] qgtk3dialoghelpers.o: In function QGtk3Dialog::show(QFlags<Qt::WindowType>, Qt::WindowModality, QWindow*)': [ 65s] qgtk3dialoghelpers.cpp:(.text+0x6a0): undefined reference to XSetTransientForHint'
[ 65s] collect2: error: ld returned 1 exit status
[ 65s] make: *** [Makefile:157: libqgnomeplatform.so] Error 1
[ 65s] error: Bad exit status from /var/tmp/rpm-tmp.gkeRhn (%build)

Override system theme

Hi, is there any way to override current system theme if some applications doesn't work well? I'm using Adwaita dark, and this WPS Office seems hard-coded the UI, make it unusable with dark theme. The apps look fine if I use Adwaita Light though.

Please suggest how could I workaround this kind of issue.
Screenshot from 2019-10-06 11-31-40

Several dialog types are not working with QGnomePlatform

I'm using Qt 5.6.1-3.fc24.x86_64 from Fedora 24 on Gnome 3. Several of the dialog types are not working at all. The easiest way to reproduce this is to use the systemdialogs example in Qt Creator.

When using QGnomePlatform,

  • FileDialog shows something weird, definitely not the native Gnome file dialog
  • ColorDialog, FontDialog and MessageDialog do not work at all
  • Custom Dialog works as expected.

When not using QGnomePlatform,

  • FileDialog shows the native Gnome file dialog
  • ColorDialog, FontDialog and MessageDialog do not show the Gnome dialog, but at least work
  • Custom Dialog looks identical to the app with QGnomePlatform

Add support for other styles [patch]

I've forked your adwaita-qt project to make Qt version of style adwaita-compact: adwaita-compact-qt.

The problem is that it doesn't work with QGnomePlatform because it has a fixed list with styles. I've patched it this way:

--- src/gnomehintssettings.cpp.orig	2017-01-02 17:00:40.955909108 +0300
+++ src/gnomehintssettings.cpp	2017-01-02 17:03:28.084595516 +0300
@@ -116,8 +116,11 @@
     m_hints[QPlatformTheme::SystemIconFallbackThemeName] = "breeze";
     m_hints[QPlatformTheme::IconThemeSearchPaths] = xdgIconThemePaths();
 
+    // First try to use GTK theme if it's Qt version is available
+    // Otherwise, use adwaita or try default themes
     QStringList styleNames;
-    styleNames << QStringLiteral("adwaita")
+    styleNames << m_gtkTheme
+               << QStringLiteral("adwaita")
                // Avoid using gtk+ style as it uses gtk2 and we use gtk3 which is causing a crash
                // << QStringLiteral("gtk+")
                << QStringLiteral("fusion")

How about adding something like this to upstream? It will help integrating Qt apps with GNOME since not everybody use Adwaita.

Memory leaks on shutdown

Running any application using QGnomePlatform will lead to a bunch of leaks being reported by ASAN or similar tools. While these leaks are low value (since they essentially are one-off), it would be nice to fix these to help reduce the noise when working on third party applications.

The underlying causes appear to be these:

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7f331f0ae4c7 in operator new(unsigned long) (/lib64/libasan.so.6+0xb04c7)
    #1 0x7f331793d399 in QGnomePlatformTheme::palette(QPlatformTheme::Palette) const (/usr/lib64/qt5/plugins/platformthemes/libqgnomeplatform.so+0x1d399)
    #2 0x7f32ffffffff  (<unknown module>)

Is there any reason to use 'new' to allocate a new QPalette each call - and never delete it - rather than keeping it as a member of GnomeSettingsPrivate, and returning a pointer to it? The same problem applies to GnomeSettingsPrivate::font, which also allocates a QFont for the fallback case (for Sans).

Indirect leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7f331f0ae4c7 in operator new(unsigned long) (/lib64/libasan.so.6+0xb04c7)
    #1 0x7f3317c90941 in QDBusPendingCallWatcher::QDBusPendingCallWatcher(QDBusPendingCall const&, QObject*) (/lib64/libQt5DBus.so.5+0x6a941)
    #2 0x7f3317946e1f in QGnomePlatformTheme::loadSettings() (/usr/lib64/qt5/plugins/platformthemes/libqgnomeplatform.so+0x26e1f)

The pending call watcher created in this case does not have a parent, and is never deleted.

The return of "GtkDialog mapped without a transient parent" message

Hello,

on my Fedora 25 installations, I have lately seen Qt applications print the following message to terminal whenever a native dialog (e.g., a file chooser) is opened:

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

At first I thought the QGnomePlatform is missing a filter for this message (along the lines of the Qt's own gtk3 code), but that is not the case. It has the custom log handler with filter installed, however, the log handler is never called for this specific message.

It turns out that GLib has new (?) logging system, called structured logging, which is used by gtk3, and bypasses the old-style log handler.

So the message can be silenced again by installing a custom log writer that matches and discards it. The only problem is that the docs for g_log_set_writer_func() are discouraging that sort of approach:

Libraries **must not** call this function — only programs are allowed to install a writer function, as there must be a single, central point where log messages are formatted and outputted.

Any ideas?

File dialog filter name with parentheses cut at wrong position

In qgtk3dialoghelpers.cpp#L479, the filter name is stripped off as follows:
const QString name = filter.left(filter.indexOf(QLatin1Char('(')));

This blindly strips off all strings at parentheses, notwithstanding whether these parentheses are part of the name (as in "My File Format (Version 2)") or, as is the intended case, hold the suffixes. So "My File Format (Version 2) (*.mff)" is displayed as "My File Format" rather than "My File Format (Version 2)". This is a major usability problem with apps proposing multiple versions of a format to select from.

I suggest that you use the regexp from QPlatformFileDialogHelper instead, as in (untested):

QRegExp rx("^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$");

foreach (const QString &filter, filters) {
        GtkFileFilter *gtkFilter = gtk_file_filter_new();
        QString name = filter
        int i = rx.indexIn(filter);
        if (i >= 0)
            name = regexp.cap(1);
        const QStringList extensions = cleanFilterList(filter);

        gtk_file_filter_set_name(gtkFilter, name.isEmpty() ? extensions.join(QStringLiteral(", ")).toUtf8() : name.toUtf8());
        foreach (const QString &ext, extensions)
            gtk_file_filter_add_pattern(gtkFilter, ext.toUtf8());

        gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(gtkDialog), gtkFilter);

        _filters.insert(filter, gtkFilter);
        _filterNames.insert(gtkFilter, filter);
}

Kate won't display the "Open File" or "Save File" dialog anymore on latest master

Hi,

I am having a similar issue as #73
kate does not show the open or save file dialogs.

Manjaro
QGnomePlatform d5a01ea
Qt 5.15.1
gnome 3.38.1
kate 20.08.3

QT settings:
QT_AUTO_SCREEN_SCALE_FACTOR=1
QT_QPA_PLATFORMTHEME=gnome
QT_STYLE_OVERRIDE=Fusion

I do not have xdg-desktop-portal-gtk installed (this was asked in the other issue) I also don't know why this has to be installed?
Output of dbus-monitor --session while executing a save:

method call time=1606126205.541434 sender=:1.322 -> destination=org.freedesktop.portal.Desktop serial=52 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.FileChooser; member=SaveFile
   string "x11:88080390"
   string "Save File"
   array [
      dict entry(
         string "current_folder"
         variant             array of bytes "/home/tim" + \0
      )
      dict entry(
         string "directory"
         variant             boolean false
      )
      dict entry(
         string "filters"
         variant             array [
               struct {
                  string "All Files "
                  array [
                     struct {
                        uint32 0
                        string "*"
                     }
                  ]
               }
            ]
      )
      dict entry(
         string "handle_token"
         variant             string "qt385525313"
      )
      dict entry(
         string "modal"
         variant             boolean true
      )
      dict entry(
         string "multiple"
         variant             boolean false
      )
   ]
error time=1606126205.541631 sender=org.freedesktop.DBus -> destination=:1.322 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=52
   string "The name org.freedesktop.portal.Desktop was not provided by any .service files"

This seems to me that something is missing?

Font too thick in Fedora 32 beta

Please compare gtk and qt fonts:

image

Seems like the same face to me, but in qt it looks bolder. I've also tested this in Arch and there it looks fine.

Regression for QColorDialog and QFontDialog

The added support for preview widget in #62 introduces a regression for QColorDialog and QFontDialog, because it attempts to apply the preview widget to QGtk3Dialog regardless of the actual dialog type.

This results in the Gtk errors:

(python:103109): GLib-GObject-WARNING **: 23:25:26.845: ../gobject/gsignal.c:2617: signal 'update-preview' is invalid for instance '0x55741c4403d0' of type 'GtkColorChooserDialog'

(python:103109): GLib-GObject-WARNING **: 23:25:26.845: invalid cast from 'GtkColorChooserDialog' to 'GtkFileChooser'

(python:103109): Gtk-CRITICAL **: 23:25:26.845: gtk_file_chooser_set_preview_widget: assertion 'GTK_IS_FILE_CHOOSER (chooser)' failed

I suppose the fastest and the least invasive fix would be to set up the preview widget and connect the update-preview signal only if gtkWidget is an instance of GtkFileChooserDialog.

Unable to start OBS Studio

Hi,
After the installation on ArchLinux, OBS can't start.
Its a fresh ArchLinux with Nvidia drivers, all updates for Gnome etc..

 theaifam5@archlinux  ~  obs                                         

(obs:12836): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplayManager'

(obs:12836): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(obs:12836): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

(obs:12836): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(obs:12836): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(obs:12836): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(obs:12836): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(obs:12836): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplay'

(obs:12836): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(obs:12836): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed

(obs:12836): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(obs:12836): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
[1]    12836 segmentation fault (core dumped)  obs

Without "QGnomePlatform" works.

Build broken with qt 5.15

Latest Arch Linux with testing repos, qt 5.15.0.1, qgnomeplatform-git

-isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtX11Extras -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtCore/5.15.0 -isystem /usr/include/qt/QtCore/5.15.0/QtCore -isystem /usr/include/qt/QtDBus -isystem /usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++ -o qgnomeplatformdecoration.o qgnomeplatformdecoration.cpp
qgnomeplatformdecoration.cpp: In member function 'virtual void QGnomePlatformDecoration::paint(QPaintDevice*)':
qgnomeplatformdecoration.cpp:206:18: error: aggregate 'QPainterPath borderRect' has incomplete type and cannot be defined
  206 |     QPainterPath borderRect;
      |                  ^~~~~~~~~~
qgnomeplatformdecoration.cpp:215:18: error: aggregate 'QPainterPath roundedRect' has incomplete type and cannot be defined
  215 |     QPainterPath roundedRect;
      |                  ^~~~~~~~~~~
qgnomeplatformdecoration.cpp:226:18: error: aggregate 'QPainterPath borderPath' has incomplete type and cannot be defined
  226 |     QPainterPath borderPath;
      |                  ^~~~~~~~~~
qgnomeplatformdecoration.cpp:293:22: error: aggregate 'QPainterPath path' has incomplete type and cannot be defined
  293 |         QPainterPath path;
      |                      ^~~~
qgnomeplatformdecoration.cpp:312:26: error: aggregate 'QPainterPath path' has incomplete type and cannot be defined
  312 |             QPainterPath path;
      |                          ^~~~
qgnomeplatformdecoration.cpp:335:26: error: aggregate 'QPainterPath path' has incomplete type and cannot be defined
  335 |             QPainterPath path;
      |                          ^~~~
qgnomeplatformdecoration.cpp: In member function 'bool QGnomePlatformDecoration::updateButtonHoverState(Button)':
qgnomeplatformdecoration.cpp:553:62: warning: unused parameter 'hoveredButton' [-Wunused-parameter]
  553 | bool QGnomePlatformDecoration::updateButtonHoverState(Button hoveredButton)
      |                                                       ~~~~~~~^~~~~~~~~~~~~
make[1]: *** [Makefile:1044: qgnomeplatformdecoration.o] Error 1
make[1]: Leaving directory '/home/seqularise/.cache/yay/qgnomeplatform-git/src/QGnomePlatform/decoration'
make: *** [Makefile:74: sub-decoration-make_first] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

GDK 3.0 not in include path of `common` subpackage

Build fails with glib2's gio/gio.h or gdk3's gdk/gdk.h not being found with the upstream code.

On my machine I managed to fix this by adding gdk-3.0 to the PKGCONFIG section of the common.pro. It seems that the gtk+-3.0 include doesn't create glib2 or gdk3 includes to the CC flags at least on Arch Linux.

Should the gdk-3.0 be added to the PKGCONFIG to enable better out-of-the-box compability more systems?

QGnomePlatform breaks QtQuick MessageDialog rendering

When QGnomePlatform is active, all QtQuick dialogs fail to render, only showing black. This happens for me with Qt 5.11.3 and Qt 5.12.1, possibly other versions too.

dialog-bug

Calling QGuiApplication::setDesktopSettingsAware(false) works around the issue. Attached is a minimal reproducer.

QGnomePlatform package: qgnomeplatform-0.5-6.fc29.x86_64
Qt package: qt5-qtbase-5.11.3-1.fc29.x86_64

Minimal reproducer: dialog-bug.zip

Downstream user-reported bug: moonlight-stream/moonlight-qt#161

Dark mode is not picked up when using QT_STYLE_OVERRIDE=adwaita-dark

Dark mode is not picked up when using QT_STYLE_OVERRIDE=adwaita-dark and therefore the menus are using the light theme. This used to work correctly with version 0.6.1.

QT_LOGGING_RULES="qt.qpa.qgnomeplatform.debug=true" QT_STYLE_OVERRIDE=adwaita-dark GoldenCheetah

qt.qpa.qgnomeplatform: Font name: "Noto Sans" (size 10 )
qt.qpa.qgnomeplatform: Monospace font name: "Source Code Pro" (size 11 )
qt.qpa.qgnomeplatform: TitleBar font name: "Noto Sans" (size 10 )
qt.qpa.qgnomeplatform: Cursor blink time: 1200
qt.qpa.qgnomeplatform: Double click time: 400
qt.qpa.qgnomeplatform: Long press time: 500
qt.qpa.qgnomeplatform: Double click distance: 5
qt.qpa.qgnomeplatform: Dnd drag threshold: 8
qt.qpa.qgnomeplatform: Password hint timeout: 0
qt.qpa.qgnomeplatform: Icon theme: "Adwaita"
qt.qpa.qgnomeplatform: Theme name: "Adwaita"
qt.qpa.qgnomeplatform: Dark version: no

KDE font size doesn't scale properly with gnome scaling factor

As I increase the scaling factor, this is what it does to kate:
scale = 1.0: https://jmvalin.ca/misc_stuff/kate_fonts_1.0.png
scale = 1.49: https://jmvalin.ca/misc_stuff/kate_fonts_1.49.png
scale = 1.5: https://jmvalin.ca/misc_stuff/kate_fonts_1.5.png
scale = 2.0: https://jmvalin.ca/misc_stuff/kate_fonts_2.0.png

Note how the "editing font" doesn't scale in the same way as the font in the menus. Note also the huge difference in the size of the menu font between 1.49 and 1.5.

Changing the appearance of qt apps

How could I generally affect qt look? For example, using goldendict the interface renders in gtk+ style and looks ok, but using okular the interface is pretty ugly with italic fonts and dumb icons. 'qgnomeplatform' is exported.

DPI scaling appears to be applied twice

I have my text scaling factor set to 1.25 in GNOME. With QGnomePlatform, text appears too large. This doesn't happen with qt5ct or QGtkStyle.

Setting the DPI to 96 in KDE System Settings makes the text size consistent with GNOME, but then obviously the correct DPI won't be used in KDE…

AppIndicators currently don't work due to null QPlatformSystemTrayIcon

Currently, there is no way to use AppIndicators when QGnomePlatform is used because the platform theme is returning null for createPlatformSystemTrayIcon(). https://github.com/MartinBriza/QGnomePlatform/blob/a6a2fc01bbcdc6c0a41fb1806f977432e28c86c6/src/qgnomeplatformtheme.cpp#L99

Would it be possible to implement something similar to what upstream Qt is doing for QGnomeTheme? https://github.com/qt/qtbase/blob/5.10/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp#L790 It seems that those classes are not exposed in the public Qt headers, so some code duplication may be needed.

Add breeze to list of fallback styles

Could you add breeze between adwaita and fusion? It's plasma default, so quite a standard style nowadays.

    styleNames << QStringLiteral("adwaita")
               << QStringLiteral("fusion")
               << QStringLiteral("windows");

Some font scaling factors (like 1.4) are ignored

I reported a bug against KDE's flatpak runtime. I run Gnome as my DE and if I set my font scaling factor to 1.4 via the tweak-tool, it does not apply to Qt flatpak apps. KDE's Jan Grulich traced the problem to QGnomePlatform.

https://bugs.kde.org/show_bug.cgi?id=407194

It looks it depends on the value you set to font-scaling, if I use 1.4, then it doesn't work, but if I use 1.5 then it scales. There is some logic apparently in Qt doing this work based on DPI. We used to do scaling in QGnomePlatform, but it was removed because of this Qt behavior. It looks it wasn't a good decision to drop it completely and we will need to just implement it properly.

See: 687c74e

Please open a bug for QGnomePlatform as this has nothing to do with KDE.

According to Grulich, it is not a flatpak specific bug. For me, non-flatpak Qt apps work fine, though, but it is probably because 687c74e is not yet in CentOS. He also noticed that scaling factor 1.5 works fine, and I can confirm that.

This is important for users with visual impairment as well as those who use a high DPI display.

It does not use dark theme when it was enabled

With Gnome, I use the dark theme of Adwaita by the global option with gnome-tweak-tool.
So, I tested liveusb-creator, Qt application which use your work normally (the theme is closer to real GTK application) but the theme still in white...

Do you plan to take account that option?

Why setting a default QPalette?

Currently when gtk theme changes a best effort is done to find and set a similar qt theme. Also, a palette is loaded and set but... it's just a default palette created as QPalette(). What is the point of that?

Missing native dialogs

With QGnomePlatform enabled, whenever the application requests a file chooser dialog, a color chooser dialog, or a font chooser dialog, the Qt-provided dialogs are used, which are lacking both in aesthetics and in functionality. To the end-user, this will look like an obvious regression compared to Gtk2-dialogs provided by QGtk2 platform theme, which is used by default in absence of QGnomePlatform.

The reason is that QGtk2 provides wrappers for the native dialogs, which are missing from the QGnomePlatform. In Qt 5.7, QGtk2 was replaced by QGtk3 theme platform, which provides wrappers for Gtk3 dialogs. That code could be directly integrated into QGnomePlatform to provide the missing dialog functionality, or could serve as a good starting point for reimplementation.

QGnomePlatform causes a graphical issue in the menubar of mGBA

Hi,

I'm using a GBA emulator using Qt 5 called mGBA on Fedora 25,
QGnomePlatform, which is shipped by default since this release, causes this weird graphical artifact on mGBA
mgba_qt_issue
When I remove QGnomePlatform, this bug disappears.
According to one developer of mGBA (mgba-emu/mgba#514), the problem needs to be fixed upstream.

Do you think it is possible to fix it on your side ?

QT5 apps crashes when opening file dialog under gnome-wayland session

On gnome with wayland session, QT_QPA_PLATFORMTHEME is set to 'qgnomeplatform. QT5 apps such as kwrite crashes when opening file dialog. On wayland, GTK3 file dialog uses wayland backend unless GDK_BACKEND is set to x11.

Current workaround is either launching QT5 apps using GDK_BACKEND=x11, setting QT_QPA_PLATFORMTHEME other than qgnomeplatform (such as qt5ct), or setting QT_QPA_PLATFORM to wayland/wayland-egl.

Related QT bug report

Remove fallback to breeze

Currently, QGnomePlatform fallbacks to breeze icon theme.
Flatpak KDE runtime has breeze theme by default, but host may not. If an app checks if there are some icon in the system, a user uses adwaita, breeze has such icon, but adwaita is not and icon is not displayed by app itself, but app sends icon name to some system component - then user will see a dummy icon or even empty space.
If there will be no fallback to breeze, then icon check will fail and app can fallback to icon that guaranteed to exist (e.g. icon with app id) and everything will be ok.

CMake build system installs Qt plugins into a wrong place

Since introduction of CMake build system, it installs built Qt modules into / rather than the Qt plugins prefix ($prefix/lib/qt/plugins).

Build transcript:

$ pwd
/tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform

$ git describe --tags
0.7.0-11-g51ea320

$ mkcd build
mkdir: создан каталог 'build'

$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Checking for module 'glib-2.0'
--   Found glib-2.0, version 2.66.6
-- Found GSettingSchemas: TRUE
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.24
-- The following OPTIONAL packages have been found:

 * Qt5XkbCommonSupport (required version >= 5.12.0)

-- The following REQUIRED packages have been found:

 * Qt5DBus
 * Qt5 (required version >= 5.12.0)
 * Qt5ThemeSupport
 * GSettingSchemas
 * Qt5Core (required version >= 5.12.0)
 * Qt5Gui (required version >= 5.12.0)
 * Qt5Widgets (required version >= 5.12.0)
 * AdwaitaQt (required version >= 1.2.50)
 * PkgConfig
 * Qt5WaylandClient (required version >= 5.12.0), Qt Wayland decoration support
   Required for QGnomePlatform decoration plugin
 * Threads

-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/build

$ ninja
[15/16] Building CXX object src/theme/CMakeFiles/qgnomeplatformtheme.dir/qxdgdesktopportalfiledialog.cpp.o
../src/theme/qxdgdesktopportalfiledialog.cpp: В функции-члене «void QXdgDesktopPortalFileDialog::openPortal()»:
../src/theme/qxdgdesktopportalfiledialog.cpp:249:110: предупреждение: «QStringList QString::split(QChar, QString::SplitBehavior, Qt::CaseSensitivity) const» устарело: Use Qt::SplitBehavior variant instead [-Wdeprecated-declarations]
  249 |                 QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), QString::SkipEmptyParts);
      |                                                                                                              ^
In file included from /usr/include/qt/QtCore/qobject.h:47,
                 from /usr/include/qt/QtCore/QObject:1,
                 from /usr/include/qt/QtGui/5.15.2/QtGui/qpa/qplatformdialoghelper.h:54,
                 from ../src/theme/qxdgdesktopportalfiledialog_p.h:42,
                 from ../src/theme/qxdgdesktopportalfiledialog.cpp:40:
/usr/include/qt/QtCore/qstring.h:615:17: замечание: объявлено здесь
  615 |     QStringList split(QChar sep, SplitBehavior behavior,
      |                 ^~~~~
[16/16] Linking CXX shared module src/theme/libqgnomeplatformtheme.so

$ mkdir ../destdir
mkdir: создан каталог '../destdir'

$ DESTDIR=$(realpath ../destdir) ninja install
[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: /tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/destdir/usr/lib/libqgnomeplatform.so
-- Installing: /tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/destdir/wayland-decoration-client/libqgnomeplatformdecoration.so
-- Set runtime path of "/tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/destdir/wayland-decoration-client/libqgnomeplatformdecoration.so" to ""
-- Installing: /tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/destdir/platformthemes/libqgnomeplatformtheme.so
-- Set runtime path of "/tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/destdir/platformthemes/libqgnomeplatformtheme.so" to ""

Note:

/tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/destdir/wayland-decoration-client/libqgnomeplatformdecoration.so

/tmp/makepkg/qgnomeplatform-git/src/QGnomePlatform/destdir/platformthemes/libqgnomeplatformtheme.so

Wayland

F25 defaults to Wayland but Qt5 applications still run using XWayland.

QGnomePlatform should:

Set the QT_QPA_PLATFORM=wayland environment variable.
Disable Qt's built-in CSDs (QT_WAYLAND_DISABLE_WINDOWDECORATION=1).
Make Mutter/GS draw their own Gnome title bars.

Regression on `gtk-application-prefer-dark-theme` setting?

Hi,

Although most applications will work fine with Adwaita-dark, some applications aren't that well supported.
cough WPS cough

For this reason, I actually want to enable the dark theme just for the native GTK application.
Previously I was able to do that, by manually set the parameter gtk-application-prefer-dark-theme=1 in ~\.config\gtk-3.0\settings.ini and ~\.config\gtk-4.0\settings.ini.

However, recently I realized that it doesn't work anymore.
It seems like some widgets are getting affected by the parameter mentioned above.
Some screenshots attached below.

OS: Fedora 33
Gnome 3.38.2

Screenshot from 2020-12-08 11-55-04
Screenshot from 2020-12-08 11-55-33
Screenshot from 2020-12-08 11-59-34

Thanks.

[RFE] Add context menu support into window decorations

Right clicking on GTK applications brings up the menu to minimise/maximise etc. This does not happen when QGnomePlatform is being used for Qt applications. Alt + Spacebar still works.

$ rpm -q gnome-shell qgnomeplatform
gnome-shell-3.34.0-3.fc31.x86_64
qgnomeplatform-0.5-13.fc31.x86_64

Upstream?

Do you intend to upstream this to Qt so that it will eventually become part of Qt?

Maybe just use gtk platform instead of QGnomePlatform

First of all, I don't want to say this project is wrong or not needed. It's just my though about "Qt in GNOME" problem.

I wonder whether https://github.com/CrimsonAS/gtkplatform may use better approach than QGnomePlatform does. gtkplatform uses GTK to draw window, titlebar and menubar and uses gtk's drawing area to put window's content rendered by Qt into GTK window. While it has some performance costs for me, end user, it provides better UX. Also, this approach has one advantage: decorations are consistent with GTK apps because they are rendered by GTK as client-side.

gtkplatform uses Adwaita-Qt style inside Qt-rendered window if Adwaita-Qt is available. Project author even wants to provide some GTK-specific widgets like headerbars into Qt apps. Both projects have the same level of instability. :(

Maybe it may be good idea to drop QGnomePlatform and move forward with https://github.com/CrimsonAS/gtkplatform ? Just asking. :)

Here is comparison between these two projects using KeePassXC as example:
Zrzut ekranu z 2020-04-13 19-05-23
Zrzut ekranu z 2020-04-13 19-06-23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.