PDA

View Full Version : Problem in QInputDialog...!



hakermania
7th August 2010, 21:28
This is my source:

bool ok;
QString passwd_request = QInputDialog::getText(this, tr("Give password:"),
tr("Current Password:"), QLineEdit::Normal,
"", &ok);
And these are the mad errors:

/home/alex/Qt/Machine/mainwindow.cpp:1189: warning: unused variable ‘ok’
/home/alex/Qt/Machine/mainwindow.cpp:1192: error: ‘ok’ was not declared in this scope
:p:p:p:p
The thing is that I used the same to the constructor of the program, where it asks for password as well and there is no problem. In a function, when a checkbox is checked is the problem....

bmesing
8th August 2010, 10:09
Since everything looks sensible to me, I suggest you try to slowly reduce your example until it works.
1. Try to compile in debug mode (try rebuild all)
2. Try to use ok in a different context, e.g. insert a line "ok = false;"
3. Try to use the code in a simple main.cpp file
4. Try renaming ok to something else
5. Advice the compiler to create the preprocessor output and take a look at it
6. Out of options ;)

Btw. which compiler are you using?

hakermania
8th August 2010, 14:58
Well the real prblem was that I had forgot to put {} into an if function..
LoL
Thx for your reply anyway. I am using qmake btw