C++ (Qt)class My_ComboBox : public QComboBox{ Q_OBJECTpublic: explicit My_ComboBox(QWidget *parent = 0) : QComboBox (parent) { }}
C++ (Qt)class My_QToolButton : public QAbstractButton{explicit My_QToolButton (QToolButton *sibling = Q_NULLPTR) : QAbstractButton(this) // Установили этот экземпляр в качестве родителя для базового{// что-то тут}}
C++ (Qt)#include <QGraphicsTextItem> class my_QGraphicsTextItem : public QGraphicsTextItem{ Q_OBJECT public: explicit my_QGraphicsTextItem(QGraphicsItem *parent = Q_NULLPTR) : QGraphicsTextItem (parent) {} }; ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- class MainWindow : public QMainWindow{ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0) { QGraphicsScene scene; my_QGraphicsTextItem *text = new my_QGraphicsTextItem; my_QGraphicsTextItem *text2= new my_QGraphicsTextItem(text); my_QGraphicsTextItem *text3 = new my_QGraphicsTextItem(text2); scene.addItem(text ); scene.addItem(text2 ); scene.addItem(text3 ); } ~MainWindow() { delete text ; } };
C++ (Qt)#include <QGraphicsTextItem> class my_QGraphicsTextItem : public QGraphicsTextItem{ Q_OBJECT public: explicit my_QGraphicsTextItem(QGraphicsScene *parent = Q_NULLPTR) : QGraphicsTextItem (parent) {} }; ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- class MainWindow : public QMainWindow{ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0) { QGraphicsScene scene; my_QGraphicsTextItem *text = new my_QGraphicsTextItem(&scene); my_QGraphicsTextItem *text2 = new my_QGraphicsTextItem(&scene); my_QGraphicsTextItem *text3 = new my_QGraphicsTextItem(&scene); scene.addItem(text ); scene.addItem(text2 ); scene.addItem(text3 ); } ~MainWindow(); };
C++ (Qt)class my_QGraphicsTextItem : public QGraphicsTextItem{ Q_OBJECT public: explicit my_QGraphicsTextItem(QGraphicsScene *parent = Q_NULLPTR) // : QGraphicsTextItem (parent) {} {}};
C++ (Qt)class my_QGraphicsTextItem : public QGraphicsTextItem{ Q_OBJECT public: explicit my_QGraphicsTextItem(QGraphicsTextItem*parent = Q_NULLPTR) : QGraphicsTextItem (parent) {} };