Results 1 to 5 of 5

Thread: How to read value which written inside the QLineEdit

  1. #1
    Join Date
    Feb 2012
    Posts
    27
    Thanked 2 Times in 2 Posts

    Default How to read value which written inside the QLineEdit

    I wanted to know that how can I read the value which is written in side the QLineEdit.
    As in spinBoxwe can read it's value by

    int a;
    a=spinBox->value();
    qDebug("%d",a);

    Same way I wanted to know the value in to the comboBox.
    Is there any way to read this value???

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to read value which written inside the QLineEdit


  3. #3
    Join Date
    Feb 2012
    Posts
    27
    Thanked 2 Times in 2 Posts

    Default Re: How to read value which written inside the QLineEdit

    Hey Marek I wanted to make such that kind of application in which i can write only one character and if i write second character then first character is clear and second character takes it's place.....
    So is there any easy solution to do that????

  4. #4
    Join Date
    Feb 2012
    Posts
    27
    Thanked 2 Times in 2 Posts

    Default Re: How to read value which written inside the QLineEdit

    Hello friends I make my application using following code,

    QString p;
    p=lineEditBox->text();

    QStringList stringList= p.split("",QString::SkipEmptyParts);
    for (int i = 0; i < stringList.size(); i++)
    {
    if(i==stringList.size()-1)
    {
    lineEditBox->clear();
    lineEditBox->setText(stringList.at(i));
    }
    }

    I hope this will helpful to someone ...

  5. The following user says thank you to RENOLD for this useful post:

    Hossein (13th October 2015)

  6. #5
    Join Date
    Feb 2012
    Posts
    44
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to read value which written inside the QLineEdit

    keep line edit box max length to 1 and add slot for that i.e textchanged() for that line edit and inside that slot do what u want.

Similar Threads

  1. How can I know what QT version a software was written on?
    By gilamran in forum Qt Programming
    Replies: 1
    Last Post: 28th October 2010, 23:15
  2. Replies: 1
    Last Post: 18th October 2010, 16:07
  3. Replies: 0
    Last Post: 22nd February 2010, 16:36
  4. PHP extensions written in C++/Qt
    By seim in forum Qt Programming
    Replies: 0
    Last Post: 12th February 2009, 00:40
  5. detecting that a file is currently being written to...
    By momesana in forum Qt Programming
    Replies: 11
    Last Post: 31st October 2007, 13:02

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.