Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Extending QLineControl
Forum Updated to NodeBB v4.3 + New Features

Extending QLineControl

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fp615
    wrote on last edited by
    #1

    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 ?

    Thanks
    Francesco

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      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.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fp615
        wrote on last edited by
        #3

        [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

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          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...

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved