Results 1 to 4 of 4

Thread: How can I implement a dialog like Windows when I input an invalid file name?

  1. #1
    Join Date
    Feb 2011
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile How can I implement a dialog like Windows when I input an invalid file name?

    Hi guys,

    I'm a QT programmer, now I need to enable users to specify a name for an object in my program. There's a rule that the name can only contain several characters, and if user inputs an invalid character, I want to pop up a dialog to indicate the error, like Windows does (see the attached image). I have implemented a sub-class deriving from QRegExpValidator, and can successfully obtain the signal when it fails to validate. But how can I implement a dialog like this? Anyone has any idea about this?

    Thanks in advance.InvalidFileName.png

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I implement a dialog like Windows when I input an invalid file name?

    It think QToolTip will do the trick for you

  3. #3
    Join Date
    Feb 2011
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I implement a dialog like Windows when I input an invalid file name?

    Can you explain the detail? I've tried QToolTip like this: lineEdit->setToolTip(tr("Please input valid characters")); but it doesn't work

    Quote Originally Posted by nish View Post
    It think QToolTip will do the trick for you

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I implement a dialog like Windows when I input an invalid file name?

    show the tooltip when you get a signal from your QRegExpValidator using QToolTip::showText

Similar Threads

  1. QDateTimeEdit (QTimeEdit, QDateEdit) invalid input
    By Kumosan in forum Qt Programming
    Replies: 10
    Last Post: 15th June 2012, 13:21
  2. Qlistview scrollbar invalid on windows
    By wushaowen in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2011, 03:16
  3. Input Dialog with Check Box?
    By PeterThePuter in forum Newbie
    Replies: 5
    Last Post: 26th October 2010, 06:30
  4. Why modeless dialog block keyboard input
    By franco.amato in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2010, 03:08
  5. Replies: 2
    Last Post: 16th January 2010, 05:22

Tags for this Thread

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.