Results 1 to 11 of 11

Thread: How could I make the QLineEdit UpperCase without using InputMask?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: How could I make the QLineEdit UpperCase without using InputMask?

    a little bit tricky, but works fine
    Qt Code:
    1. ...
    2. connect(le, SIGNAL(textEdited(const QString &)), SLOT(toUpper(const QString &)));
    3. ...
    4. void Test::toUpper(const QString &text)
    5. {
    6. QLineEdit *le = qobject_cast<QLineEdit *>(sender());
    7. if (!le)
    8. return;
    9. le->setText(text.toUpper());
    10. }
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  2. The following 2 users say thank you to spirit for this useful post:

    Qtonimo (6th August 2012), waynew (9th January 2010)

Similar Threads

  1. how to make system calls to be displayed in QLineEdit
    By wagmare in forum Qt Programming
    Replies: 2
    Last Post: 10th November 2008, 05:08
  2. how to make the QLineEdit uneditable by user
    By wagmare in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2008, 09:20
  3. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13
  4. QValidator, regular expressions and QLineEdit
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 01:25
  5. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57

Tags for this Thread

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.