Overriding paintEvent broke window minimizing from taskbar
-
A round clock example can be used as an example of code. The problem is this, if you override paintEvent then you lose the ability to minimize the window from the start menu (taskbar, not tray) by clicking of progamm icon. When you click on the program icon, nothing happens. At the same time, the folding itself through showMinimized works. And unfolding also works. How to fix? Windows 10, qt 6.1.2
-
I doubt that paintEvent() has something to do with it. Please provide some code - a minimal compilable example would be the best - creating a simply QWidget with an overwritten paintEvent shouldn't be that hard.
-
QWidget mainWindow {}; mainWindow.setWindowFlag(Qt::FramelessWindowHint);
Minimize fine, if do that
Window::Window(QWidget *parent) : QWidget(parent, Qt::FramelessWindowHint) { //... }
not working, but
Window::Window(QWidget *parent) : QWidget(parent) { setWindowFlag(Qt::FramelessWindowHint); //... }
work fine too, why?
-
@loginmen https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum
"Qt::WA_TranslucentBackground 120 Indicates that the widget should have a translucent background, i.e., any non-opaque regions of the widgets will be translucent because the widget will have an alpha channel. Setting this flag causes WA_NoSystemBackground to be set. On Windows the widget also needs the Qt::FramelessWindowHint window flag to be set. This flag is set or cleared by the widget's author." -
@jsulm correct message:
QWidget mainWindow {}; mainWindow.setWindowFlag(Qt::FramelessWindowHint);
Minimize fine, if do that
Window::Window(QWidget *parent) : QWidget(parent, Qt::FramelessWindowHint) { //... }
not working, but
Window::Window(QWidget *parent) : QWidget(parent) { setWindowFlag(Qt::FramelessWindowHint); //... }
work fine too, why?
-
@JonB in constructor i have flags:
00000801
and in use function:
8800F801
flags decode:
80000000 WindowFullscreenButtonHint 08000000 WindowCloseButtonHint 00000001 Window 00000800 FramelessWindowHint 0000F000: 00001000 WindowTitleHint 00002000 WindowSystemMenuHint 00004000 WindowMinimizeButtonHint 00008000 WindowMaximizeButtonHint
If i use
Window::Window(QWidget *parent) : QWidget(parent, Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint) { //... }
Minimize work fine and button not showing