component type: QWidget *
So it's a pointer to a QWidget but it usually points to some specific widget like for example QSlider, QPushButton or anything that is inherited from QWidget.
The widget gets initialized at the another class (xml parser) and pointer to that widget is then passed on to the "component" with setter function.
void ServiceDescriptionParser::readComponentType(GUIComponent *component)
{
Q_ASSERT(isStartElement() && name() == "type");
if(type == "slider") {
component->setComponent(slider);
qDebug() << "GUI Element Type: " << type;
}
else if (type == "button") {
component->setComponent(button);
qDebug() << "GUI Element Type: " << type;
}
}
void ServiceDescriptionParser::readComponentType(GUIComponent *component)
{
Q_ASSERT(isStartElement() && name() == "type");
QString type = readElementText();
if(type == "slider") {
QSlider *slider = new QSlider();
component->setComponent(slider);
qDebug() << "GUI Element Type: " << type;
}
else if (type == "button") {
QPushButton *button = new QPushButton();
component->setComponent(button);
qDebug() << "GUI Element Type: " << type;
}
}
To copy to clipboard, switch view to plain text mode
And the setter function...
void GUIComponent
::setComponent(QWidget *component
) {
this->component = component;
parentService->addWidget(this->component);
}
void GUIComponent::setComponent(QWidget *component)
{
this->component = component;
parentService->addWidget(this->component);
}
To copy to clipboard, switch view to plain text mode
Bookmarks