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. Multiple inheritance in qt
Forum Updated to NodeBB v4.3 + New Features

Multiple inheritance in qt

Scheduled Pinned Locked Moved General and Desktop
9 Posts 6 Posters 3.8k 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.
  • N Offline
    N Offline
    Neha123
    wrote on last edited by
    #1

    Please someone send an ex: code of multiple inheritance in Qt(full code with .cpp file and ah file) which you have.

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

      Please, describe what problem you have and what inheritance you need? What is your goal?
      This means, use "smart question":http://www.catb.org/~esr/faqs/smart-questions.html

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Neha123
        wrote on last edited by
        #3

        In first widget there are 2 lineEdits and 2 buttons. if we click 1st button we get its add: in the 2nd form.if we click the 2nd button we get its difference in 3rd form . I want to do it using inheritance.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on last edited by
          #4

          I'd go for a signal/slot solution any time here... Multiple inheritance is tricky to begin with and you will probably end up with clearer code if you don't use it.

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            What do you want to inherit? You have a composit there. One widget containing others. The üparent cant be a button and a line edit at the same time.
            Event inheriting from different widgets will definitly not work.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • N Offline
              N Offline
              Neha123
              wrote on last edited by
              #6

              can anyone send an example of inheritance( full code ) pleaseeeeee

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Gourmand
                wrote on last edited by
                #7

                signal/slot system and child/parent relationships allow avoid bug-generating multiple inheritance with Qt therefore MI is very rarely used here, me don't have even one MI-class in tens of thousands lines of code

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dialingo
                  wrote on last edited by
                  #8

                  Here you go:

                  http://doc.qt.nokia.com/4.7-snapshot/uitools-multipleinheritance.html

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

                    [quote author="Neha123" date="1307534413"]can anyone send an example of inheritance( full code ) pleaseeeeee[/quote]

                    Moaning and crying for help is usually leading to no answers at all. Behave like a grown up and you will treated like a such, behave childish and you will be treated like a nasty child.

                    Begging for code is childish. This is a support forum not a do-my-homework-site.

                    If you have a question, write it down in a way such that others can understand it. And/or describe what you want to achieve, also in a way such that others can understand it.

                    You cannot have multiple inheritance with more than one QObject based base class. Although possible, and valuable in some circumstances, multiple inheritance can be very dangerous and error prone.

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

                    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