Results 1 to 9 of 9

Thread: show the position in qlabel

  1. #1
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default show the position in qlabel

    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

  2. #2
    Join Date
    Dec 2010
    Location
    Russia
    Posts
    83
    Thanks
    1
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: show the position in qlabel

    Take a look at the "QPoint Qwidget :: pos( )const" method...

  3. The following user says thank you to AlexSudnik for this useful post:

    ready (26th March 2011)

  4. #3
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: show the position in qlabel

    please elaborate it .....

  5. #4
    Join Date
    Dec 2010
    Location
    Russia
    Posts
    83
    Thanks
    1
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: show the position in qlabel

    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.

  6. #5
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: show the position in qlabel

    Actually I want to only show position in Qlabel whenever I provide co-ordinate value from line edit...
    how is it possible??

  7. #6
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: show the position in qlabel

    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,
    Qt Code:
    1. showLabel->setText(QString::number(imgLabel->x())+"," +QString::number(imgLabel->y()));
    To copy to clipboard, switch view to plain text mode 

  8. The following user says thank you to BalaQT for this useful post:

    ready (26th March 2011)

  9. #7
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: show the position in qlabel

    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)
    Last edited by ready; 26th March 2011 at 16:59.

  10. #8
    Join Date
    Mar 2011
    Posts
    35
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: show the position in qlabel

    Even I want to solve the same problem...

  11. #9
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: show the position in qlabel

    hi @jerkymotion,
    Qt Code:
    1. showLabel->setText(QString::number(imgLabel->x())+"," +QString::number(imgLabel->y()));
    To copy to clipboard, switch view to plain text mode 
    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
    Last edited by BalaQT; 28th March 2011 at 11:02.

Similar Threads

  1. QLabel and its content (pixmap) position problem.
    By miqqo in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2010, 09:57
  2. Set Position of QLabel
    By Qt Coder in forum Newbie
    Replies: 1
    Last Post: 19th March 2009, 06:51
  3. QLabel selection: start and end position?
    By truefusion in forum Qt Programming
    Replies: 2
    Last Post: 18th January 2009, 02:00
  4. Position of text in a qlabel
    By jiveaxe in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2008, 13:26
  5. Clearing a QLabel since the mouse position
    By SkripT in forum Qt Programming
    Replies: 10
    Last Post: 18th January 2006, 18:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.