Results 1 to 3 of 3

Thread: Problem with QValidator and keyboard

  1. #1
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4

    Default Problem with QValidator and keyboard

    I have a QLineEdit control, and wanna set validator for it.
    Qt Code:
    1. ui->lineEdit->setValidator(new QIntValidator(5,20, this));
    To copy to clipboard, switch view to plain text mode 
    So, I can't type any alphabet or special character on the lineEdit.
    Problem is: I use scim-unikey as my keyboard software. When I change from English keyboard to Vietnamese keyboard, I still type alphabet character (not special character) on the lineEdit.
    The character display on the lineEdit but when I focus mouse on another control, ther character disappear (I think this is right because I set QIntValidator for the lineEdit).
    I wouldn't like the alphabet character display on the lineEdit. How can I fix this ?

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QValidator and keyboard

    use eventfilter instead.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  3. #3
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4

    Default Re: Problem with QValidator and keyboard

    Quote Originally Posted by sonulohani View Post
    use eventfilter instead.
    I dont know what you mean. Plz give me an example.

    New problem:
    Qt Code:
    1. QRegExp regExp("[A-Za-z0-9]+");
    2. regExpVal->setRegExp (regExp);
    3. ui->lineEditName->setValidator (regExpVal);
    4. ui->lineEditAlias->setValidator (regExpVal);
    To copy to clipboard, switch view to plain text mode 
    After do that, I cant type any alphanumeric character on lineEditName and lineEditAlias with Vietnamese keyboard. Qt always clear the character I've input.
    How can I fix this ?

Similar Threads

  1. Use of QValidator in QLineEdit
    By giorgik in forum Qt Programming
    Replies: 5
    Last Post: 14th June 2012, 09:25
  2. QValidator problem
    By zgulser in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2011, 04:24
  3. QComboBox and QValidator
    By mrandreas in forum Newbie
    Replies: 3
    Last Post: 27th September 2010, 18:29
  4. QValidator and ListWidget
    By csvivek in forum Qt Programming
    Replies: 4
    Last Post: 9th July 2008, 19:19
  5. QValidator for QGraphicsTextItem
    By arjunasd in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 15:34

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