Results 1 to 3 of 3

Thread: QLineEdit Problem

  1. #1
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default QLineEdit Problem

    I want to that; when i one clicked into qlineedit, automaticlly lineedit`s text is selected .


    How can I do that ?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QLineEdit Problem

    if life was easy:

    Qt Code:
    1. QLineEdit *le=...;
    2. connect(le, SIGNAL(clicked()), le, SLOT(selectAll()));
    To copy to clipboard, switch view to plain text mode 

    but, alas, QLineEdit has no such signal...
    so, you will need to intercept mouse-clicks (using an event filter, or if you subclass the QLineEdit in some of its event handling functions) and then call selectAll()

    HTH

  3. #3
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QLineEdit Problem

    Try to look at
    Qt Code:
    1. void QWidget::focusInEvent ( QFocusEvent * event )
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. void setFocusPolicy ( Qt::FocusPolicy policy )
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

Similar Threads

  1. QLineEdit focus problem
    By matteo.cozzaglio in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2009, 14:13
  2. Focus problem with QLineEdit and InputMask
    By ttvo in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2009, 13:57
  3. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13
  4. QLineEdit problem (Jambi)
    By Binji in forum Newbie
    Replies: 1
    Last Post: 13th November 2007, 01:55
  5. QValidator, regular expressions and QLineEdit
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 01:25

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.