Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. inheritance
    Log in to post

    • UNSOLVED StyleSheet not applying when a child is declared
      General and Desktop • qwidget stylesheet inheritance • • Dzious  

      1
      0
      Votes
      1
      Posts
      51
      Views

      No one has replied

    • UNSOLVED How can I access the private data member without friend class?
      General and Desktop • c++ inheritance design pattern friend class pimpl idiom • • Yash001  

      3
      0
      Votes
      3
      Posts
      82
      Views

      You cannot, without modifying the class where the private member is declared. That's why it was made private. Without a get/set method pair it is only visible internally to the class.
    • SOLVED Connect in derived class to base class slot
      General and Desktop • slots inheritance • • Lynix  

      5
      0
      Votes
      5
      Posts
      446
      Views

      @JonB Thanks, that worked perfectly. Also, I've decided to write a getter that returns a const reference to the list which also works perfectly.
    • SOLVED inheritance problem
      Mobile and Embedded • qobject subclassing inheritance • • amina  

      8
      0
      Votes
      8
      Posts
      315
      Views

      @amina said in inheritance problem: it is working now great, so don't forget to mark your post as solved!
    • UNSOLVED how to add QDebug to inherited classes?
      General and Desktop • qdebug inheritance • • Dariusz  

      7
      0
      Votes
      7
      Posts
      688
      Views

      Since you're explicitly calling QDebug operator<<(QDebug &stream, const base &obj) the compiler can't call the other function. What you can do is to write your own "virtual QString debug() const" function in every class which you the call within the debug stream operator function. But once again - plain C++ :)
    • SOLVED (Pure) Abstract class that inherits from QGraphicsItem
      General and Desktop • qgraphicsitem inheritance custom item abstract class • • Pl45m4  

      2
      0
      Votes
      2
      Posts
      728
      Views

      Hi As long as you dont do multiple inheritance , i think you base class design should work just fine. However, make sure to overrride int QGraphicsItem::type() const pr concrete class to make sure qgraphicsitem_cast() works.
    • SOLVED How to include shared code/headers from another directory? /src/widget/ using /src/common/
      General and Desktop • c++ inheritance dependencies include link error • • StevenFS  

      5
      0
      Votes
      5
      Posts
      11479
      Views

      @SGaist I sincerely want to thank you for your help! This project took six-months and your assistance was crucial in getting over the goal line in the final week. If I missed that hard deadline my six-month contract-to-hire would have been terminated. Partly because of your assistance I made it work and was hired full-time permanent! We shipped Version 1.0 and two weeks later I delivered a significant V1.1 follow up!. I momentarily had it setup as a (static?)linked library but backtracked to direct #includes from the /common/ folder, mainly because I understood it better. I intend to switch again to the library method because of compile times as you suggested. I was also scared off by an article suggesting I would need to add C++ #EXTERN statements, etc. to create a public interface for the library. Is that true, or can the .pro/.pri files define that folder as a library with NO changes to the C++? I still have to migrate *.qml files to the /common/ but I assume it's basically the same pattern as the C++. I haven't replied because I thought I had more questions but the project has been moving too rapidly. Thank you!
    • SOLVED QTcpServer Base class
      General and Desktop • qtcpserver inheritance abstract class • • moffa13  

      3
      0
      Votes
      3
      Posts
      703
      Views

      @mrjj said: but does QSslSocket not inherited QTcpSocket ? Yes, you're right thank you !
    • SOLVED 'Call to implicitly-deleted copy constructor' when attempting to implement class inheritance
      General and Desktop • inheritance constructor • • MikePi-Top  

      2
      0
      Votes
      2
      Posts
      5565
      Views

      Hi, QObject is a non copyable type. See here for more information.
    • SOLVED How to get a class pointer without messing up data.
      General and Desktop • class pointer inheritance pointers • • Basti46  

      4
      0
      Votes
      4
      Posts
      1121
      Views

      Hi Just a note first Having class SerialPort : public QObject and then QSerialPort *serialPort; Where only diffence is capital S to the main class is just confusing. anyway, why is the issue with settings(new SettingsDialog()), did you declare it as void settings(SettingsDialog *mydialog) Im not sure what you dont understand. To use a pointer to a class in another class, you simply give the pointer to the other class and it can use it class B {}; class A { B* mykeptBpointer; setB(B* myb) { mykeptBpointer = myb; } void DoB { mykeptBpointer->xxxx(); }; A mya; B* myb = new B; mya.setB(b); oh, is settings(new SettingsDialog()) rather settings = new SettingsDialog();
    • SOLVED Subclass of subclass of qobject
      General and Desktop • qobject subclassing inheritance • • Alart  

      10
      0
      Votes
      10
      Posts
      7257
      Views

      The Q_OBJECT macro can be put in public, protected or private section and it will do the same. It doesn't matter for moc but I highly recommend to always put it at the top of your class for the following reason: The Q_OBJECT macro is defined like this: #define Q_OBJECT \ public: \ //stuff... \ private: \ //other stuff... So it's easy to make your other members private by mistake like this: class Foo { public: Q_OBJECT int bar; //oh no! bar is private }; If you put the macro at the top it won't affect access declarations below: class Foo { Q_OBJECT public: int bar; //yes! bar is public as intended };
    • QML Opacity Inheritance [ Solved ]
      QML and Qt Quick • qml window inheritance opacity • • Cybrum  

      6
      0
      Votes
      6
      Posts
      8250
      Views

      @bck25 ,@Frime Thank you all for the replies. I can not set the alpha value as I am using an image as the background. I solved this by moving the opacity to the BorderImage which acts as background of the Window. Window { id : root flags: Qt.FramelessWindowHint visible:true color: "transparent" // This works properly when Aero theme is enabled in Windows BorderImage { visible:true width:root.width height:root.height opacity: 0.8 source: "background.png" } }
    • [Solved] Subclass QHeaderView.
      General and Desktop • qtableview qheaderview subclassing inheritance • • SwePtr  

      3
      0
      Votes
      3
      Posts
      2072
      Views

      Oh, I see. Thank you sir.
    • Memory management with QObjects
      General and Desktop • qobject memory pointer inheritance • • RDiGuida  

      4
      0
      Votes
      4
      Posts
      1619
      Views

      If your question was how to initialize QObject from child you do not need extra Parent variable, no extra deletes, just add it in constructor: Contact::Contact(int cat,QString fir,QString lst,QString ad,QString zp, QString ct,QString nm,QObject *parent) ::QObject( parent ) { .......... }
    • How to extend QFileSystemModel (inheritance)
      General and Desktop • qfilesystemmode inheritance • • Vandi  

      9
      0
      Votes
      9
      Posts
      2915
      Views

      @Chris-Kawa I am building from within Qt Creator (Windows 7), my .pro file didn't contain that! it just had: QT += gui Thank you Chris.