Results 1 to 7 of 7

Thread: error: request for member `ok' in `xxx

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Location
    Rome, GA
    Posts
    199
    Thanks
    14
    Thanked 41 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: error: request for member `ok' in `xxx

    It sounds like you need to inherit from QDialog and make your own dialog box with a line edit. Then you create a method within your main window called showDialog() or something. You don't want to use show() as QWidget already has a method called show(); Then inside showDialog() you would either create the Dialog object as a non-modal or modal dialog. Does that make sense? I'm not sure I'm explaining it well.

    Also, Qt provides a handful of standard pre-built dialogues that you may not be aware of: QFileDialog, QInputDialog, QProgressDialog, QFontDialog, QColorDialog
    So inside showDialog() you could do this:
    Qt Code:
    1. MyGui::showDialog()
    2. {
    3. QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
    4. tr("User name:"), QLineEdit::Normal,
    5. QDir::home().dirName(), &ok);
    6. //do something with text...
    7. }
    To copy to clipboard, switch view to plain text mode 

    I just took that from the documentation example.
    Last edited by JimDaniel; 6th March 2009 at 21:20.

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.