cryomicl
18th May 2017, 07:07
I have a GUI displaying a tree architecture as shown here 12472. Each of those nodes are separate classes that are derived from the node above them. All of them inherit QObject for their implementation.
Now I need to add a few properties to be displayed when the user selects "Properties" under the Right-Click menu of "Implicit". Selecting this opens a window like so 12473. I added these properties in the header file of Implicit like so :
#ifndef FCIMPLICIT_H
#define FCIMPLICIT_H
#include <QObject>
#include "Interface.h"
#include "ResourceItem.h"
#include "MonWindow.h"
#include "FCTab.h"
#include "ResourceItem.h"
#include "FCAbstract.h"
#include "FCInterface.h"
#include "FCConnections.h"
class CFCImplicit: public CResourceItem
{
Q_OBJECT
Q_PROPERTY(int FCPortID READ getPortID )
Q_PROPERTY(QString Type READ getType )
Q_PROPERTY(QString Status READ getStat )
Q_PROPERTY(int WWNodeNumber READ getNodeNo )
Q_PROPERTY(int WWPortNumber READ getPortNo )
Q_PROPERTY(bool AutoActive READ getAuto )
public:
CFCImplicit(QObject*);
~CFCImplicit();
QString getType();
QString getStat();
int getPortID();
int getPortNo();
int getNodeNo();
bool getAuto();
};
FCinterface.h is the header of the "FCASM" node.
The issue is that only the first property is displayed, as seen in the second picture. Is there a reason why this is happening? Am I supposed to add something to the constructor or a new function?
The constructor for the Implicit class is
CFCImplicit::CFCImplicit(QObject* parent) : CResourceItem(parent)
{
fnSetProperty("objectName", QString("Implicit"));
((CResourceItem*)parent)->fnAddResources(this);
}
EDIT
This is what the whole thing looks like 12474
Now I need to add a few properties to be displayed when the user selects "Properties" under the Right-Click menu of "Implicit". Selecting this opens a window like so 12473. I added these properties in the header file of Implicit like so :
#ifndef FCIMPLICIT_H
#define FCIMPLICIT_H
#include <QObject>
#include "Interface.h"
#include "ResourceItem.h"
#include "MonWindow.h"
#include "FCTab.h"
#include "ResourceItem.h"
#include "FCAbstract.h"
#include "FCInterface.h"
#include "FCConnections.h"
class CFCImplicit: public CResourceItem
{
Q_OBJECT
Q_PROPERTY(int FCPortID READ getPortID )
Q_PROPERTY(QString Type READ getType )
Q_PROPERTY(QString Status READ getStat )
Q_PROPERTY(int WWNodeNumber READ getNodeNo )
Q_PROPERTY(int WWPortNumber READ getPortNo )
Q_PROPERTY(bool AutoActive READ getAuto )
public:
CFCImplicit(QObject*);
~CFCImplicit();
QString getType();
QString getStat();
int getPortID();
int getPortNo();
int getNodeNo();
bool getAuto();
};
FCinterface.h is the header of the "FCASM" node.
The issue is that only the first property is displayed, as seen in the second picture. Is there a reason why this is happening? Am I supposed to add something to the constructor or a new function?
The constructor for the Implicit class is
CFCImplicit::CFCImplicit(QObject* parent) : CResourceItem(parent)
{
fnSetProperty("objectName", QString("Implicit"));
((CResourceItem*)parent)->fnAddResources(this);
}
EDIT
This is what the whole thing looks like 12474