Results 1 to 3 of 3

Thread: Problem in QInputDialog...!

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Angry Problem in QInputDialog...!

    This is my source:
    Qt Code:
    1. bool ok;
    2. QString passwd_request = QInputDialog::getText(this, tr("Give password:"),
    3. tr("Current Password:"), QLineEdit::Normal,
    4. "", &ok);
    To copy to clipboard, switch view to plain text mode 
    And these are the mad errors:
    Qt Code:
    1. /home/alex/Qt/Machine/mainwindow.cpp:1189: warning: unused variable ‘ok’
    2. /home/alex/Qt/Machine/mainwindow.cpp:1192: error: ‘ok’ was not declared in this scope
    To copy to clipboard, switch view to plain text mode 

    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....

  2. #2
    Join Date
    Feb 2006
    Posts
    32
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem in QInputDialog...!

    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?

  3. #3
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Cool Re: Problem in QInputDialog...!

    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

Similar Threads

  1. Replies: 4
    Last Post: 29th March 2019, 14:58
  2. QInputDialog and OSG
    By Pertur in forum Qt Programming
    Replies: 3
    Last Post: 30th July 2010, 09:34
  3. How to use Qinputdialog in Symbian
    By ramesh.bs in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 2nd June 2010, 11:51
  4. QInputDialog default value
    By dbrmik in forum Qt Programming
    Replies: 2
    Last Post: 25th March 2009, 16:07
  5. QInputDialog
    By bkv in forum Newbie
    Replies: 2
    Last Post: 6th October 2006, 07:34

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
  •  
Qt is a trademark of The Qt Company.