Results 1 to 5 of 5

Thread: QInputDialog::getText - can't get access by keyboard

  1. #1
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QInputDialog::getText - can't get access by keyboard

    System: gentoo. Qt 4.6.2. Not using any display manager - just X server.

    I try to get user input, but dialog doesn't react on keyboard, even can't close it by pressing Esc or Enter - only by mouse clicks.

    Code:
    Qt Code:
    1. bool ok;
    2. QString pwd = QInputDialog::getText(this, NULL, tr("Password:"), QLineEdit::Password, "", &ok);
    3. if( ok && !pwd.isEmpty() )
    4. {
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    QApplication::focusWidget() remains parent of QInputDialog (guess it by logging) - is it common behavior?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QInputDialog::getText - can't get access by keyboard

    Quote Originally Posted by m_fighter View Post
    System: gentoo. Qt 4.6.2. Not using any display manager - just X server.

    I try to get user input, but dialog doesn't react on keyboard,
    You most likely posted the answer in your first line.
    Is your system working correctly?

    Qt Code:
    1. bool ok;
    2. QString pwd = QInputDialog::getText(this, NULL, tr("Password:"), QLineEdit::Password, "", &ok);
    3. if( ok && !pwd.isEmpty() )
    4. {
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    QApplication::focusWidget() remains parent of QInputDialog (guess it by logging) - is it common behavior?
    Do you mean that the mainwindow remains the parent of the input dialog? Then yes, that's by design and how you wrote your code.

  3. #3
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QInputDialog::getText - can't get access by keyboard

    Thanks for answering.

    You most likely posted the answer in your first line.
    Is your system working correctly?
    Yes, it is. But may be it's not properly configured - I am working on it. Except this trouble everything works fine. It's a some kind of terminal - I don't need there Gnome or KDE. I set up auto-login, and when system boot - X server starts and run my program.


    Do you mean that the mainwindow remains the parent of the input dialog? Then yes, that's by design and how you wrote your code.
    No, sorry for my bad English.
    I meant that the window which QApplication:: focusWidget () returned is the dialog parent (mainwindow). I expected that the QApplication:: focusWidget () will return a pointer to QInputDialog (because it is modal, and as my mind must have focus).
    Mainwindow set as central widget in qApp. Keyboard works fine in any other place of program.
    As I can see system uses policy "focus-follow-mouse" by default (I do not know where it is configured), but even when mouse over QInputDialog - it also doesn't react on keyboard.

  4. #4
    Join Date
    Aug 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QInputDialog::getText - can't get access by keyboard

    Hi m_fighter,
    I have exactly the same problem using Qt 4.6.0, MSVS2005 on Windows Vista Ultimate x64. The strange thing is that if I create a new project and I use QInputDialog, it works correctly. In the already developed large application, the dialog doesn't update?!
    Did you manage to find out what was wrong in your case?
    Thanks!

  5. #5
    Join Date
    Aug 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QInputDialog::getText - can't get access by keyboard

    Solved! I installed Qt 4.6.3 and now everything is fine.

Similar Threads

  1. Replies: 4
    Last Post: 29th March 2019, 14:58
  2. QInputDialog::getText - showing twice
    By TorAn in forum Qt Programming
    Replies: 2
    Last Post: 4th December 2009, 01:57
  3. QInputDialog default value
    By dbrmik in forum Qt Programming
    Replies: 2
    Last Post: 25th March 2009, 16:07
  4. Replies: 10
    Last Post: 13th September 2008, 02:39
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.