Important: Please read the Qt Code of Conduct -

Extending QLineControl

  • QLineControl is an internal class used with QLineEdit. I may need to change QLineControl functionality regarding the mask part and some keystrokes.

    I think I may do in 2 different ways:

    1. cloning QLineEdit, QLineEditPrivate and QLineControl so that they are independent, like a fork... It will be my responsability to keep them in sync with the official classes if changes are introduced.

    2. subclassing QLineEdit, intercept all the QEvent/QSignal I need and clone the "mask code" from QLineControl... actually is porting some code from QLineControl to subclassed QLineEdit and block the event if handled locally... but it may be needed to interact with the underlying QLineControl object..

    What do you think ?


  • With solution 2 it is not guaranteed that your patched code is called always. The execution path may ripple through and eventually land on the original implementation.

    So, I would go with solution #1, even if it looks like more work in the first place.

  • [quote author="Volker" date="1333716685"]So, I would go with solution #1, even if it looks like more work in the first place.[/quote]

    Thank you for your reply... I actually think that #1 is less work than #2 ! And code remainsin its proper place and updating to new Qt versions should be easier.

    Thank you

  • If you think your needed changes are generic enough, you might also considder creating a patch for Qt itself, and contributing that back so others can use it as well in the future, and you don't have to maintain your own copy of QLineEdit and all that is needed for that for the indefinate future...

Log in to reply