Results 1 to 10 of 10

Thread: Some QComboBox and custom QValidator background

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Location
    Israel
    Posts
    90
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    59
    Thanked 2 Times in 2 Posts

    Default Re: Some QComboBox and custom QValidator background

    First of all thank you for your time and attention, and for bringing up the relevant documentation.

    I'm sorry but even after reading about the different types of signals emitted from the lineEdit control I can't "guess" the behavior of an editable QComboBox just because it has a lineEdit member. For example, where does it say that validation is even called upon leaving focus of the combo's lineEdit?

    I don't expect the documentation to answer "every question" for "every case". I stand by what I said that the documentation about the integration of a validator and a combox is almost not there (unless you know how the combo box wraps the signals emitted from its lineEdit members).

    I put a breakpoint in my validate method to see if it's called at any point during my UI/programmatic interaction. I'm not seeing any calls so I'm guessing something in my wiring is wrong.

    This piece of documentation:

    "Note that if there is a validator set on the line edit, the returnPressed()/editingFinished() signals will only be emitted if the validator returns QValidator::Acceptable."
    still leaves me wondering why I'm not seeing the call.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: Some QComboBox and custom QValidator background

    For example, where does it say that validation is even called upon leaving focus of the combo's lineEdit?
    Here (QLineEdit):
    When editing is finished, either because the line edit lost focus or Return/Enter is pressed the editingFinished() signal is emitted.
    And since the validator is applied during text input, and because finishing the text input through focus change is part of the input, the validator should be called as result of focus leave.

    I put a breakpoint in my validate method to see if it's called at any point during my UI/programmatic interaction. I'm not seeing any calls so I'm guessing something in my wiring is wrong.
    Ok, that is the right way to do it.
    Hmm...
    Can you post the code where you set your validator?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QComboBox and QValidator
    By mrandreas in forum Newbie
    Replies: 3
    Last Post: 27th September 2010, 18:29
  2. How to change QComboBox background with a picture?
    By mulei in forum Qt Programming
    Replies: 3
    Last Post: 24th September 2010, 07:59
  3. custom display in a QComboBox
    By scarleton in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2010, 22:13
  4. QComboBox Custom Widget has missing designer properties
    By vieraci in forum Qt Programming
    Replies: 5
    Last Post: 9th December 2009, 13:30
  5. Can't compile custom QValidator
    By vieraci in forum Qt Programming
    Replies: 1
    Last Post: 22nd August 2009, 15:12

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