Skip to content

Commit

Permalink
feat: QtComboModeShow
Browse files Browse the repository at this point in the history
  • Loading branch information
XMuli committed Jul 1, 2021
1 parent 39bc540 commit a3041fe
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
16 changes: 16 additions & 0 deletions QtComboModeShow/QtComboModeShow.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
QT -= gui

CONFIG += c++11 console
CONFIG -= app_bundle

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
main.cpp

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
39 changes: 39 additions & 0 deletions QtComboModeShow/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <iostream>
#include <QVector>
using namespace std;


class A
{
public:

void add(A *pt){ m_v.push_back(pt); }

QVector<A *> m_v;
QString m_name;
};

class B : public A
{
public:
void add(A *pt){ m_v.push_back(pt); }
};


class C : public A
{
public:
};

int main(int argc, char *argv[])
{
A ma1;
B mb1, mb2, mb3, mb4;
C mc1, mc2, mc3;

ma1.add(&mb1); ma1.add(&mb3);
mb1.add(&mc1); mb1.add(&mb2);
mb3.add(&mc2); mb3.add(&mc3); mb3.add(&mb4);

return 0;
}

0 comments on commit a3041fe

Please sign in to comment.