Accessing the value from line edit..
Hey folks..I am a beginner and trying out my first QT program. I am having problem accessing value from line edit. First I created a design using QT windows.ui and then wanted to access value from 3 different line edits in the design and perform calculation. but I really dont have any idea how to . I looked up in the API and everywhere... I know it should be something really easy but I cant figure it out...With the following code I have an error stating "class Qlabel has no member named value". I would appreciate bunch if anyone could explain me the solution. Thanks in advance !
MainWindow::MainWindow(QWidget *parent) :
value1= ui->saleprice->value(); value2=ui->original->value();
[EDIT: code formatting, please wrap in @-tags, Volker]
You posted code, but not UI definition, so I can only guess that saleprice is QLabel.
Indeed, class Qlabel has no member named value, but text (if that is what you are looking for).
From doc: "text : QString - This property holds the label's text."
Same applies for QLineEdit, no member named value, but text (QString).
Go to "qt doc":http://doc.qt.nokia.com/4.7/index.html then in search index edit box write word "value" and hit enter, there you can find all Qt classes which have value as property or method (not much of them), and draw a conclusion - Qt have a bit different naming conventions compared to Java, but you will get it if you browse doc or use code completion in Qt Creator.
stemd thanks for the information. I will for sure check qt doc and try to figure out. I will post again if I run into problem.