2013年9月10日星期二

QT Press the left mouse button to determine at which the edit box

 This post last edited by the gkljx on 2013-09-08 16:14:16
want to achieve a similar touch function keys , four edit box , first select an edit box , and then go press the button , you can press the button in the edit box to display the content . .

------ Solution ------- -------------------------------------
custom tag variable FLAG, 1,2,3 , 4 represents four edit box , click the appropriate edit box let FALG equal to a few , and click the button to send under FLAG


------ Solution ------------------------------------ --------
Qt easier , as long as the interface of this class , ui-> xxx will be able to find the corresponding controls (UI editor control to remember the name )
--- --- Solution --------------------------------------------
QWidget * QApplication::widgetAt(const QPoint & point) [static]
Returns the widget at global screen position point, or 0 if there is no Qt widget there.

This function can be slow.

See also QCursor::pos(), QWidget::grabMouse(), and QWidget::grabKeyboard().


------ Solution ------------------------------------ --------
may be your level of Qt event handlers do not know, you can simply point qApp install a eventFilter, inside handle mouse click event and then determine which one click widget
------ Solution ------------------------------------------ -
edit box you can inherit this class , the inherited class, add a signal , that is, when the edit box has focus when the focus changes or sends a signal , the signal parameters is this edit box 's ID, and you draw on the UI of the edit box to use this class definition , and then in the MainWindow and this signal will be a function of your tank connected to record the edit box 's ID, with this ID , and after editing much easier , I was so engage in, can successfully
------ Solution ----------------------------------- ---------
bool value in the edit box to get hold of the variables have changed to call the mouse events. Like this should be easy to understand that.
------ For reference only -------------------------------------- -
that I can think of , the question is , how do I determine my present point is that this edit box rather than another . .
------ For reference only -------------------------------------- -
per click , the FLAG push into a vector variable inside , how


------ For reference only ---------------------------------- -----
want to know how to determine the point of a few number edit box ? Press the left mouse button to capture the events I can , but I'm back on the control in which there is no way to determine it. . If MFC has GetDlgItem (IDC_EDIT2) -> GetSafeHwnd () to obtain control what . QT under no such function? I just started learning QT, so a little white. .
------ For reference only -------------------------------------- -

I know ah. . But now is how to judge my point is this control , like on my mouse, press down, and when the press was what ? Where to add a message handler ?
------ For reference only -------------------------------------- -
I tried to use the left mouse button controls , but when the mouse point to the controls at the time did not capture the information, do not know how it is . . I use the Dialog window . .
------ For reference only -------------------------------------- -
Well, did not particularly understand , came into contact with QT three days , a number of mechanisms have not comprehend the message , hope Detailed ah. .
------ For reference only -------------------------------------- -
http://wenku.baidu.com/view/afe8f85aad02de80d4d840a9.html
In this document can solve

没有评论:

发表评论