PDA

View Full Version : show the position in qlabel



ready
26th March 2011, 09:39
Hi guys I have successfully able to get position of my coordinate from Qlabel...in Lineedit..:)....I displayed the Image in Qlabel
Now I want to show the co-ordinate position in Qlabel whenever I provide data from my lineedit.....(Just show the position the Qlabel)
Is it possible ...if the How??
please help me..
Every help shall be appreciated

AlexSudnik
26th March 2011, 13:15
Take a look at the "QPoint Qwidget :: pos( )const" method...

ready
26th March 2011, 15:31
please elaborate it .....

AlexSudnik
26th March 2011, 15:49
Open up Qt Assistant --> Main Classes --> QWidget. Find a property called pos,read the given information.Pos is not the only geometry-related property,navigate through the Assistant and you'll find the one you need.

ready
26th March 2011, 16:32
Actually I want to only show position in Qlabel whenever I provide co-ordinate value from line edit...
how is it possible??

BalaQT
26th March 2011, 17:04
hi ready,

whenever I provide data from my lineedit.....(Just show the position the Qlabel)
so you want to show the image qlabel's position, in another qlabel?


Now I want to show the co-ordinate position in Qlabel whenever I provide data from my lineedit
what is the data you provide in lineedit?

if you want to show the image position in another label,

showLabel->setText(QString::number(imgLabel->x())+"," +QString::number(imgLabel->y()));

ready
26th March 2011, 17:59
so you want to show the image qlabel's position, in another qlabel?
yes ..you are right.:)
let's forget about lineedit at this moment

Added after 32 minutes:

come on .......somebody must have Idea how to do this....
I have already recieved x-cordinate from mouseevent....in QLabel ...
I want to do the reverse process....i.e....provide....coordinate value to qlabel and show the position in Qlabel(just to indicate)

jerkymotion
26th March 2011, 18:33
Even I want to solve the same problem...:)

BalaQT
28th March 2011, 08:58
hi @jerkymotion,

showLabel->setText(QString::number(imgLabel->x())+"," +QString::number(imgLabel->y()));
did u try the above code?

@ready,

come on .......somebody must have Idea how to do this....
I have already recieved x-cordinate from mouseevent....in QLabel ...
I want to do the reverse process....i.e....provide....coordinate value to qlabel and show the position in Qlabel(just to indicate)

provide coordinate value to qlabel means you want to move the qlabel?


I want to only show position in Qlabel whenever I provide co-ordinate value from line edit
imgLabel->move(x,y);

you need to get the x, y value from your lineedit.

hope it helps,
Bala