I'm making a program in PySide6. Testing it on Macbook the project uses the Mac's dark-theme, but running on Arch Linux it's running the default "Fusion" theme even though I have set the QT6 system theme like described on the wiki with qt6ct. The theme works on the qt6ct program itself, is there something I can do in the project, or on my system to get the system theme in my project?
Related
I've recently installed Ubuntu 22.04 LTS on my development laptop. Previously I was running 18.04 so this is my first experience of Wayland. I did a clean installation on a new disc. I had relatively few problems reinstalling gitkraken and cloning the repository of my source code from github but when I came to install the Qt libraries this is where my problems started. The on-line installer from the Qt website simply wouldn't run. It just exited silently. I eventually found an old version of the on-line installer executable in a backup of my downloads folder from Ubuntu 18.04 and was able to use this to download and install the same version of the Qt libraries that I was using previously (5.15.0). This is also the same version that I use on my other development machine which runs Windows 10. Keeping the two in step is useful and upgrading too many things at the same time seemed like asking for trouble. I installed the latest versions of Qt Creator (7.0.1) and g++ (11.2.0).
I was then able to build my application and, after a brief search of stack overflow I added "-platform wayland" to the command line arguments setting in Qt Creator but the application crashed almost immediately on start-up with the error "The Wayland connection experienced a fatal error: Protocol error".
Several things made me think this might be a bug in the Qt libraries rather than my application (none of them definitive!):
At the point of application exit, apart from main() there is none of my application code in the call-stack (see below)
My application has been stable for a long time and has survived several operating system, compiler and Qt version changes across two OS families
The fact that the latest Qt on-line installer (itself almost certainly a Qt application) wouldn't run
I downloaded Qt 5.15.12 (the latest Qt 5 version available) and rebuilt my application against that but the result was the same.
The next step is obviously to strip my application right down to something minimal that still shows the problem but before I do I was wondering whether this is something other people have come across when migrating a Qt5 application to Wayland and whether I need to take the bigger step of upgrading to Qt6? The Qt Wiki describes Qt 5.11 as being "stable" with Wayland.
The call stack at the time of the error looks like this:
qt_message_fatal
QMessageLogger::fatal
QtWaylandClient::QWaylandDisplay::checkError
QtWaylandClient::QWaylandDisplay::flushRequests
doActive
QMetaObject::activate
QSocketNotifier::activated
QSocketNotifier::event
QApplicationPrivate::notify_helper
QApplication::notify
QCoreApplication::notifyInternal2
QCoreApplication::sendEvent
socketNotifierSourceDispatch
g_main_context_dispatch
??
g_main_context_iteration
QEventDispatcherGlib::processEvents
QEventLoop::exec
QCoreApplication::exec
main
Many thanks.
It's something to do with QDialog::setMaximumSize. The call to setMaximumSize itself does not crash but if I remove all calls to it the application works fine. Some controls do subjectively seem bigger on Wayland so I wonder if Qt 5 on Wayland crashes if the size of the QDialog contents exceeds the maximum size specified. This certainly doesn't cause a crash in Qt 5 on Windows and didn't in Qt 5 on Ubuntu prior to the switch to Wayland. I think this is a Qt bug but of course it may well be fixed in a later version of Qt and there's an easy enough work-around now I know the cause.
I was using setMaximumSize to allow the dialog to expand dynamically as widgets were added but to prevent the user from making the window any bigger than it needed to be. layout()->setSizeConstraint(QLayout::SetFixedSize); achieves the same thing.
I'm deploying an app developed by Qt for both Windows and Linux:
On Windows I'm using built-in Qt windeployqt tool:
windeployqt.exe app.exe --qmldir %NS_REPO_DIR%\qml\
On Linux I'm using linuxdeployqt:
linuxdeployqt_EXE="${NS_REPO_DIR}/scripts/linuxdeployqt/linuxdeployqt-7-x86_64.AppImage"
${linuxdeployqt_EXE} app -qmake=${NS_QT_QMAKE_EXE} -qmldir=${NS_REPO_DIR}/qml/
The deployment size for Windows is around 70 MB and for Linux is around 300 MB. Is it normal? Is there anything I might be missing?
Thanks!
Update
This is my deployment on Linux whose content is sorted by size. The Qt files don't look like to be debug mode. Also, there is a huge libQt5WebEngineCore.so.5.12.7 file of 111 MB:
We would have to blame here to all the GNU/Linux distributions makers for changing so many things.
Unlike Windows that there are only few version Windows 7,8, 10 and that is it. In GNU/Linux we have so many versions and variants that we have to include "almost" everything that an application needs to ensure it will run on the majority of the existent system variants.
Said that, you can manually check the files deployed in your AppDir manually and remove those you know that your application will not require.
Side note: While linuxdeployqt is still functional there are other tools that do a better job. Consider checking https://github.com/linuxdeploy/ and https://github.com/AppImageCrafters/appimage-builder
I know Gluon uses GraalVM Native Image features to create native executable packages. But... What I need to know is:
Can it can deploy native packages (executable) for Apple OS based devices (macOS and iOS) in Linux? Or Is it OS specific dependent like jpackage?
What about deploying Windows ".exe" packages in Linux, Is it possible?
If you check the documentation for the Client plugin, there are some requisites to be met in order to create a native image.
So far, the following hosts are required for the possible native image targets:
Linux: targets Linux (x86_64 desktop) and Android (aarch64). Embedded support is still experimental.
Windows: targets Windows (x86_64 desktop). Optionally WSL 2 (Windows Subsystem for Linux) can be used to target Linux/Android.
MacOS X 10: targets Mac (x86_64 desktop) and iOS (arm64).
For each host you need a specific GraalVM build.
See the different samples, and the tutorials (like this one) to know more about each scenario.
I have a QT creator built application which appears fine on macOS Mojave while the system uses the light theme but it looks worse when change to dark theme.
Could I made the application to keep the light theme no matter what the system theme is?
You should be able to exclude an app from dark mode (please have a look here at https://www.tekrevue.com/tip/exclude-app-dark-mode-macos-mojave/.
However, it may not work since the issue you are facing may be with Qt itself. Applications built with an SDK prior to 10.14 will run with a mixed dark/light palette on Mojave. To solve the issue you must build your app with SDK 10.14 (more info about that here and here.
This happened to me with one app: my build machine was running High Sierra (thus using SDK 10.13) and when I ran the application on Mojave with the dark theme I got very wierd results. Once I upgraded my build machine to Mojave, the problem disappeared.
I've been coding with Python and C++ and now need to work on building a gui for data visualization purposes. I work on Mac Snow Leopard (intel), python 3.1 using gcc 4.2.1 (from Xcode 3.1)
I wanted to first install Qt and then PyQt. And my goals are to be able to:
- quickly prototype GUI and the accompanied logic that drives the GUI using PyQt and python
- if I decided I need the speed, or if it's fairly easy to translate my GUI into C++ using the Qt tools, I have the options to translate my app into C++
- Be able to deploy my application onto Windows (both the python and c++ version of my app)
Give the goals above, what are the correct steps I should take and what issues i should be aware of when setting up Qt and PyQt. Which other deployment tools do I need?
From my readings so far, here's what I have:
download the Qt source for mac and configure it with
-platform macx-g++42 -arch x86_64 -no-framework
(i've read somewhere that
building as framework causes some
trouble in deployment and/or
debugging, can't find the article
anymore)
download latest SIP source and build
download latest PyQt and build from source (any special options I should pay attention to?)
For deployment, I've read that I would need to use py2exe/cx_freeze for windows, p2app for mac:
http://arstechnica.com/open-source/guides/2009/03/how-to-deploying-pyqt-applications-on-windows-and-mac-os-x.ars
but seems like what the article describe is deploying an app you build on windows on the windows platform and vice versa. How do you deploy to windows (is it even possible?) if you are writing your Qt app on a mac ?
Really appreciate the help
I'm guessing by deploying, you mean a compiled version to users that have no Python or Qt or anything.
I'm been trying py2app for a while now and never really worked out for me. You can try PyInstaller. It worked out pretty well for me since it's made to work with plugins like PyQt and PIL etc. I put up some instructions here
http://tech.xster.net/tips/deploy-pyqt-applications-on-mac-os-x-with-pyinstaller/
They don't really support cross-compilation though. Just recently, they made cross-compilation for windows binaries on linux possible. If you want to spend some time hacking it, it's probably possible. But probably easier just to get a windows machine and building a binary with it.