i have an app where i have 2 widgets, one widget shows a video and the other one two buttons as transparent widget lying over the video. Means the widget with the buttons has the focus. When now somebody clicks on the video normally this should emit a signal to open a website in an external browser, but while the other widget has the focus, this signal is not emitted while the click only changes the focus to the video but is not getting the click itself.
is there a way to use the click, to change the focus and catch the click event to open my website?
Georg
I guess you can try the function: setFocusProxy()
video.setFocusProxy(button);
Maybe you can get some help.
Related
I add simple combobox in my qml form but after selection, the button of it stay blue like the mouse stay clicked and I can not select any more after the first click, do you know why?...
ComboBox{
model:["test1","test2"]
}
image upload is not working then here drive link to see what I mean:
https://drive.google.com/open?id=1Un0pOCTbmEu_FeCHDzTYKF8FbV4YTxHR
thank you for your help
Qt 5.10.0 added support for native menus on Windows. This caused a regression in Qt Quick Controls 1 ComboBox. ComboBox did not get notified that the menu popup was closed, so it thought it was still pressed and therefore refused to re-open the popup. The bug (QTBUG-64628) has been fixed in Qt 5.10.1. Try updating.
I am doing work on Qt. i am not using android. It's just a desktop application running on windows/linux.how to know which component (placed on a widget or form ) is currently focused ?
i have onscreen keyboard which appears when a QLineEdit,QTextEdit or QPlainTextEdit get focused and hide when these lost focus.But when i switch focuse from one TextEdit(or lineEdit,PlainTextEdit) to Another TextEdit(or lineEdit,PlainTextEdit) my keyboard hide and again show.I just want to stop this
If you want to stop the keyboard from flickering when the widget it's coming from and the one it's going to are similar then you could perhaps implement a timer. I imagine you have the lost focus signals going to your code that is hiding the keyboard. Instead of really hiding it, you can start a timer like
QTimer::singleShot(500, this, SLOT(really_close_keyb()));
Within that really_close_keyb() slot you could implement code to check if the widget that currently has focus should have a keyboard or not, and if it should then you don't hide it.
With this your keyboard will be up for 1/2 sec after the user focuses out of a line edit, giving enough time to focus on another one without losing the keyboard. Adjust the timing to suit.
I need to know in my app if a modal window is opened when I click on a button.
So I'm searching for a method which permits to know if a modal window is opened in my application or no, and which returns the window (or NULL)
Is it possible?
See QApplication's static activeModalWidget
I have a simple parent widget that reimplements mousePressEvent/mouseReleaseEvent. The parent's child widgets use enterEvent/leaveEvent. When I hover the mouse over the child widgets, leaveEvent/enterEvent executes, but when I click and hold the mouse, mousePressEvent executes, but enterEvent/leaveEvent goes silent (in other words, no click and drag). Any ideas about what could be causing this?
If you press and hold down the mouse button on a widget then that widget grabs mouse events until you release the button. This is not a special feature of Qt, you can find similar behaviour in every other GUI APIs I know.
Take a look at the relevant part of the Qt documentation:
QWidget / Events:
mousePressEvent() is called when a mouse button is pressed while the
mouse cursor is inside the widget, or when the widget has grabbed the
mouse using grabMouse(). Pressing the mouse without releasing it is
effectively the same as calling grabMouse().
void QWidget::grabMouse ():
Grabs the mouse input. This widget receives all mouse events until
releaseMouse() is called; other widgets get no mouse events at all.
I render Qt gui elements on my own 3d application screen by rendering Qt stuff to QImage and then drawing that on the screen. I redirect input to QGraphicsScene, but not everything works. Clicking buttons works fine while clicking QLineEdit or web page elements in QWebView doesnt. However doubleclick seems to work - doubleclicked QLineEdit would select some text, but still would not gain focus. What could be causing this?
I had the exact same problem. It seemed i had
QGraphicsView.keyPressEvent(self, keyEvent)
implemented in my graphicsView. Had to resend the event up the chain of inheritance.
I also implemented keyboard event sending. No matter how i send events (QGraphicsScene::keyPressEvent()/QGraphicsScene::keyReleaseEvent() or QApplication::sendEvent) text is not typed into control, even if some text is selected in QLineEdit (text should be overwritten, shouldnt it?). I suspect this is because of QLineEdit not gaining focus by clicking it, but i cant find out why it is not focused. All events are sent to my subclass of QGraphicsScene.