LINUX: Can't render opacity or an image (setWindowIcon(QIcon(":/images/qt.png"));)
-
Hello, I'm learning how to use Qtcreator to create apps, and I'm following the steps of a course that I downloaded, but is just not rendering nothing, i use ArchLinux, at the beginning (first time in using the program) it warns about, using clangd as a kit been potentially bad for it, because of CPU concerns,, QTcreator runs well, but for some reason is not rendering nothing when I run it with ctrl + r...
this is the cpp i'm working on right now:
#include "widget.h"Widget::Widget(QWidget *parent)
: QWidget(parent)
{
setWindowTitle("Hello World");
//resize(500,300);
setFixedWidth(500);
setFixedHeight(300);
// setStyleSheet("background-color:red");
// setWindowOpacity(0.4);
setWindowIcon(QIcon(":/images/qt.png"));}
Widget::~Widget()
{
}i can send the project:
https://www.mediafire.com/file/xfxrzzxjxzfpmyb/4.2+4-WindowScratchIcon.zip/file -
Hi and welcome,
@Ada-OS said in LINUX: Can't render opacity or an image (setWindowIcon(QIcon(":/images/qt.png"));):
i use ArchLinux
What windowing system/server do you use?
Note:
This feature is available on Embedded Linux, macOS, Windows, and X11 platforms that support the Composite extension.
Note: On X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.
-
i use Wayland, i switched to x11 like an hour a go into an x11 session (yeah, i have x11 also), and nothing, now i don't know if i'm missing a pkg
EDIT: also my DE is KDE Plasma, and I tried the Flatpak version, same.. Google's AI, thinks that this could be:
~~To use Qt Creator with Wayland on Arch Linux, ensure you have the necessary packages installed, including qt6-wayland or qt5-wayland, and set the QT_QPA_PLATFORM=wayland environment variable.
Here's a more detailed breakdown:Install Qt Creator: Use the package manager pacman to install Qt Creator: sudo pacman -S qtcreator.
Install Wayland support for Qt:
Install the appropriate Wayland plugin for your Qt version: For Qt 6: sudo pacman -S qt6-wayland.
For Qt 5: sudo pacman -S qt5-wayland.
Set the environment variable:
To force Qt applications to use Wayland, set the QT_QPA_PLATFORM environment variable: Open a terminal and run: export QT_QPA_PLATFORM=wayland.
To make this change permanent, add the line export QT_QPA_PLATFORM=wayland to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc).
Troubleshooting:
If you encounter issues with Qt applications finding the Wayland plugin, ensure that the necessary directories are correctly copied or symlinked, as described in this Qt Forum thread.
If you are using a custom Qt build, make sure that the Wayland plugin is included in the build.
If you are using XWayland, you might need to set QT_QPA_PLATFORM=xcb to run Qt applications on XWayland.Wayland and Qt:
Wayland is a display server protocol that aims to replace the X Window System.
Qt provides the Qt Wayland Compositor module for developing custom display servers based on the Wayland protocol.
The Qt Wayland Compositor module provides QML and C++ APIs for developing custom display servers.
~~i have all of that i just need to run qtcreator under that env var, and see if that can solve it
followed the ai steps, nothing also.. just that now the qt icon is not missing everytime i run a project in the window but that's all, didn't really worked at all