hello everyone,
I got an application where, when the mouse is Double Clicked in the textedit area, I need to get the entire line in that position. Is there any method of doing it?
Thanks in advance,
Sarma.
hello everyone,
I got an application where, when the mouse is Double Clicked in the textedit area, I need to get the entire line in that position. Is there any method of doing it?
Thanks in advance,
Sarma.
txtEdit->text()
a life without programming is like an empty bottle
Sorry sir,
That gives the entire text present in the textedit. But I want the line on which the mouse is Double clicked.
Use clicked(int para, int pos) signal and in the slot call text(int para) which returns the text of the given paragraph.
sir,
Please tell me in which variable the line is stored so that I can access it and make operations on it.
I have added the following statement after the declaration of textedit:
Qt Code:
To copy to clipboard, switch view to plain text mode
Is it correct or it gives any errors. And I would like to tell one thing that I need to get the text if I "Double click the mouse" and in above statement, the signal is simply clicked(). why it is so?
Last edited by Sarma; 8th March 2006 at 11:45.
Parameter names are not allowed in SIGNAL and SLOT macros.Originally Posted by Sarma
Try this:Qt Code:
To copy to clipboard, switch view to plain text mode
sir,
Isn't that the signal and the slot should have the same no. of parameters and are of same type.Originally Posted by wysota
I need to get the text if I "Double click the mouse" and in above statement, the signal is simply clicked(). why it is so?
No. The slot can have less parameters than the signal (last parameters can be omitted).Originally Posted by Sarma
Because there is no doubleClicked signal with paragraph coordinates. You'd have to implement that functionality yourself, by finding the paragraph under cursor (QTextEdit has some methods for that) and translating it to the text.I need to get the text if I "Double click the mouse" and in above statement, the signal is simply clicked(). why it is so?
How would I know the cursor position where the mouse is Double clicked (or) simply clicked in a textedit . I have tried it with getCursorPosition(), but it was of no use.
QCursor::pos()
Sir,
That gives the coordinates of the cursor in the screen. But what if I have a large text in the textedit? I need to get this position and based on the scrollbar value, I need to calculate the paragraph in the text where the event occured. And I think this would be cumbersome. Please tell me other solution possible.
Thanks and regards,
Sarma.
Bookmarks