The WindowDoesNotAcceptFocus flag is making me thirsty!!!!!!!
-
I don't mind seeing people wanting old bugs sorted and asking for attention on the forums. Being noticed is the only way to get an action.
To bring balance to the force: One thing to highlight an old bug - another thing entirely to argue drop everything for this. I don't want that. I get new things and new things fixed every release... I don't want brakes applied to everything else because they couldn't get to this.
Ridiculing Qt for releasing new versions while this is outstanding is a ridiculous concept itself. And you probably know it, you're passionate to see this fixed, we get it. I do advocate voicing the wish to have this looked at again - just not how.
-
Lol! a pop-up message telling me that the topic is too old ahah!
Anyway, so far the bug is getting really old, 4 years soon! Please Qt, fix it!! I face the same issue by using C++ on Windows 8 and Windows 8.1 with Qt 5.9 . What's the point to release Qt 5.10 when the previous version which is even not 1 year old can't run the basics? 0_o
-
Lol! a pop-up message telling me that the topic is too old ahah!
Anyway, so far the bug is getting really old, 4 years soon! Please Qt, fix it!! I face the same issue by using C++ on Windows 8 and Windows 8.1 with Qt 5.9 . What's the point to release Qt 5.10 when the previous version which is even not 1 year old can't run the basics? 0_o
@amonR2 said in The WindowDoesNotAcceptFocus flag is making me thirsty!!!!!!!:
Anyway, so far the bug is getting really old, 4 years soon! Please Qt, fix it!! I face the same issue by using C++ on Windows 8 and Windows 8.1 with Qt 5.9 . What's the point to release Qt 5.10 when the previous version which is even not 1 year old can't run the basics? 0_o
Since Qt is open source you are welcome to provide the fix.
If you are not able to do so, i would say be thankful for what you get free of charge. -
I don't mind seeing people wanting old bugs sorted and asking for attention on the forums. Being noticed is the only way to get an action.
To bring balance to the force: One thing to highlight an old bug - another thing entirely to argue drop everything for this. I don't want that. I get new things and new things fixed every release... I don't want brakes applied to everything else because they couldn't get to this.
Ridiculing Qt for releasing new versions while this is outstanding is a ridiculous concept itself. And you probably know it, you're passionate to see this fixed, we get it. I do advocate voicing the wish to have this looked at again - just not how.
@6thC You call it "Ridiculing", I call it "common sense" or "relevancy". Thank you for your help and contribution.
@raven-worx First: there's nothing free in life.
Second: Qt is not free. Opensource and licensed products don't mean free, far from that.
Third: I am not a Qt API developer, it's not my job.
Don't get mad but here I have a real question for you: would you accept to be slapped for free?@Snotboogie Thanks a lot for the hint.
Since a solution through Qt does not exist we have to use win32 API for Windows platforms. This function works pretty well for me (windows 8 & 8.1):
setWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_NOACTIVATE);
Regarding Linux,
setAttribute(Qt::WA_X11DoNotAcceptFocus);
was working fine. But only for Qt 4.8, I have not tried it on Qt 5s yet. -
Hi, this bug is still not fixed in Windows 10, right? I´m coding a custom keyboard and I having trouble with the buttons stealing the focus from text inputs like word, notepad, etc.
Regards.
-
At least for me is working very fine with PySide6 just by setting up into the MainWindow init function like so: self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus)
-
Hi ich versuche das gleiche verhalten unter wayland zu erhalten, aber bekomme es nicht hin :(
from PyQt6.QtWidgets import QApplication, QPushButton, QVBoxLayout, QWidget from PyQt6.QtCore import Qt from PyQt6 import QtCore class TestWidget(QWidget): def __init__(self): super().__init__() self.setWindowFlags(Qt.WindowType.NoDropShadowWindowHint | Qt.WindowType.FramelessWindowHint | Qt.WindowType.WindowStaysOnTopHint | Qt.WindowType.WindowDoesNotAcceptFocus | Qt.WindowType.BypassWindowManagerHint) self.initUI() def initUI(self): self.button = QPushButton('Button', self) self.button.clicked.connect(self.on_button_click) layout = QVBoxLayout() layout.addWidget(self.button) self.setLayout(layout) # self.setAttribute(Qt.WidgetAttribute.WA_ForceDisabled, True) self.show() def on_button_click(self): print('Button clicked') if __name__ == '__main__': app = QApplication([]) w = TestWidget() app.exec()
ich hab es mal versucht wie im letzten kommentar angegeben nach oben zu verschieben aber no luck :( gibt es schon eine loesung dafuer ?
-
Hi ich versuche das gleiche verhalten unter wayland zu erhalten, aber bekomme es nicht hin :(
from PyQt6.QtWidgets import QApplication, QPushButton, QVBoxLayout, QWidget from PyQt6.QtCore import Qt from PyQt6 import QtCore class TestWidget(QWidget): def __init__(self): super().__init__() self.setWindowFlags(Qt.WindowType.NoDropShadowWindowHint | Qt.WindowType.FramelessWindowHint | Qt.WindowType.WindowStaysOnTopHint | Qt.WindowType.WindowDoesNotAcceptFocus | Qt.WindowType.BypassWindowManagerHint) self.initUI() def initUI(self): self.button = QPushButton('Button', self) self.button.clicked.connect(self.on_button_click) layout = QVBoxLayout() layout.addWidget(self.button) self.setLayout(layout) # self.setAttribute(Qt.WidgetAttribute.WA_ForceDisabled, True) self.show() def on_button_click(self): print('Button clicked') if __name__ == '__main__': app = QApplication([]) w = TestWidget() app.exec()
ich hab es mal versucht wie im letzten kommentar angegeben nach oben zu verschieben aber no luck :( gibt es schon eine loesung dafuer ?
@deblin Hi! Es gibt Forum in Deutscher Sprache hier: https://forum.qt.io/category/28/german
-
Hi ich versuche das gleiche verhalten unter wayland zu erhalten, aber bekomme es nicht hin :(
from PyQt6.QtWidgets import QApplication, QPushButton, QVBoxLayout, QWidget from PyQt6.QtCore import Qt from PyQt6 import QtCore class TestWidget(QWidget): def __init__(self): super().__init__() self.setWindowFlags(Qt.WindowType.NoDropShadowWindowHint | Qt.WindowType.FramelessWindowHint | Qt.WindowType.WindowStaysOnTopHint | Qt.WindowType.WindowDoesNotAcceptFocus | Qt.WindowType.BypassWindowManagerHint) self.initUI() def initUI(self): self.button = QPushButton('Button', self) self.button.clicked.connect(self.on_button_click) layout = QVBoxLayout() layout.addWidget(self.button) self.setLayout(layout) # self.setAttribute(Qt.WidgetAttribute.WA_ForceDisabled, True) self.show() def on_button_click(self): print('Button clicked') if __name__ == '__main__': app = QApplication([]) w = TestWidget() app.exec()
ich hab es mal versucht wie im letzten kommentar angegeben nach oben zu verschieben aber no luck :( gibt es schon eine loesung dafuer ?
@deblin said in The WindowDoesNotAcceptFocus flag is making me thirsty!!!!!!!:
unter wayland zu erhalten
There are several features of a windowing system that Wayland does not allow/support. For example, you cannot move a window to a particular position. Maybe it does not accept this flag? If it works under Xorg but not under Wayland this is probably the case?
-
Oh I am sorry the hole website is in german and i forgot about it xD
To be a little more precise it is wayland gnome with kompositor mutter.
i tried it now in native language
#include <QApplication> #include <QPushButton> #include <QWidget> int main(int argc, char **argv) { QApplication app(argc, argv); QWidget window; window.setWindowFlags(Qt::WindowDoesNotAcceptFocus); QPushButton button("Click me!", &window); QObject::connect(&button, &QPushButton::clicked, [&]() { button.setText("You clicked me!"); }); window.show(); return app.exec(); } but onclick it gets focus :( I wrote a virtuel keyboard that runs fine under x11 but wayland always gives it a focus, therefore i cant use it ....
-
i didnt find a soloution only a work-around :(
created a gnomeshell plugin to bounce back focus
{ "shell-version": ["43.6"], "uuid": "myextension@example.com", "name": "My Extension", "description": "Example Gnome Shell Extension" } const Main = imports.ui.main; const Shell = imports.gi.Shell; let focusChangedId; let previousWindow; function enable() { focusChangedId = global.display.connect('notify::focus-window', () => { const focusedWindow = global.display.focus_window; if (focusedWindow) { // Prüfen Sie, ob das fokussierte Fenster das ist, das Sie ignorieren möchten if (focusedWindow.get_title() === 'ignorier') { // Wenn das der Fall ist, setzen Sie den Fokus zurück auf das vorherige Fenster if (previousWindow) { Main.activateWindow(previousWindow); } } else { // Wenn das nicht der Fall ist, aktualisieren Sie das vorherige Fenster previousWindow = focusedWindow; } } }); } function disable() { if (focusChangedId) { global.display.disconnect(focusChangedId); focusChangedId = null; previousWindow = null; } }
and switched it on with the python prog
import subprocess def enable_extension(extension_id): subprocess.run(['gnome-extensions', 'enable', extension_id]) def disable_extension(extension_id): subprocess.run(['gnome-extensions', 'disable', extension_id])
but this creates other issues :( so I am back too X11 good luck to the next one! 2017 was the first post to this is. I try it in another 5 years ....
-
I've encountered a similar problem. In my case, the widget continually activates and gains focus while being resized. I've set the following properties for the widget:
setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); setAttribute(Qt::WA_ShowWithoutActivating);
This issue seems to occur only on Windows, and it doesn't happen before we upgrade to 5.15; I haven't experienced it on MacOS. My solution was to add Qt::BypassWindowManagerHint to the widget, and the widget won't get activated and focused anymore.