Results 1 to 4 of 4

Thread: QComboBox and QValidator

  1. #1
    Join Date
    Sep 2010
    Location
    Norway
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QComboBox and QValidator

    I want to use the QValidator of the QComboBox, but I don't want the QCombobox to be editable and I dont want to keep the QValidator. I want to set the validator to the combobox and use it later on. However if the QComboBox is not editable the getValidator returns null. Why don't I just insert valid data to the combobox? tell it to the customers!!

    Thanks Andreas

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QComboBox and QValidator

    Is there a question here somewhere or did you just want to complain? If the latter then I can understand how you feel, if the former then you have to be more specific.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2010
    Location
    Norway
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox and QValidator

    Yes I wanted to complain. However, it was suppose to be a question too: Is there a way of setting a qvalidator to the qcombobox and retreving it when the qcombobox is not editable?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QComboBox and QValidator

    Quote Originally Posted by mrandreas View Post
    Yes I wanted to complain. However, it was suppose to be a question too: Is there a way of setting a qvalidator to the qcombobox and retreving it when the qcombobox is not editable?
    If it is just about attaching one object to another then you can make the validator a child of the combobox and then query the combobox for its children inheriting QValidator interface (using QObject::findChild).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    mrandreas (28th September 2010)

Similar Threads

  1. QValidator problem
    By zgulser in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2011, 04:24
  2. Can't compile custom QValidator
    By vieraci in forum Qt Programming
    Replies: 1
    Last Post: 22nd August 2009, 15:12
  3. QValidator and ListWidget
    By csvivek in forum Qt Programming
    Replies: 4
    Last Post: 9th July 2008, 19:19
  4. QValidator for QGraphicsTextItem
    By arjunasd in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 15:34
  5. QLineEdit & QValidator - umm...
    By matheww in forum Qt Programming
    Replies: 3
    Last Post: 20th June 2007, 21:40

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.