PDA

View Full Version : QLineEdit



sonuani
19th February 2008, 11:12
hi,
I want to find the length of the text in QLineEdit.
how to get that?
(It should work similar to linelength function in MFC)

jpn
19th February 2008, 11:16
Length as in characters or as in pixels?

QLineEdit::text()
QString::length()
QWidget::fontMetrics()
QFontMetrics::width()

codeslicer
19th February 2008, 11:32
Well, if say the name of your QLineEdit is lineEdit, you would use this:

lineEdit.text().length();

If you get errors in this line, try replacing the dots with a pointer(->)
HTH! :cool:

~codeslicer

sonuani
19th February 2008, 11:40
Thanx.Its working