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. Promoting inside code.
QtWS25 Last Chance

Promoting inside code.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.6k Views
  • 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.
  • B Offline
    B Offline
    bareil76
    wrote on last edited by
    #1

    Hi All,

    I have a lot of QLineEdit which I need to promote to a subclass of QLineEdit that I wrote myself.

    How can I promote without using the user interface of QtCreator? I want to do it in the code.

    Thanks

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      If you want to write code, how about using your sub-class which is inherited from QLineEdit. This is lot better.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bareil76
        wrote on last edited by
        #3

        Yes... I want to use my sub-class.... but how to do it?

        I do not want to go and promote each single QLineEdit manually.

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          You write an new class and inherit from QLineEdit. You add the new functionality to new class or modify the existing functionality.

          @class mylineedit : public QLineEdit {

          }@

          I'm confident you are aware of this.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            What "promote" feature actually does is replacing the name of the original class with the promoted one, so if you want it in code the equivalent is find/replace. There's really not much more to it.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bareil76
              wrote on last edited by
              #6

              Yes I was aware of that.

              On the other end.. I used qt creator to put the QlineEdit.. so I cannot edit the text. I clicked each one and promoted them .. it did not took that long.

              Thanks for your help.

              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