-
Notifications
You must be signed in to change notification settings - Fork 42
/
ZDLWidget.cpp
108 lines (88 loc) · 2.94 KB
/
ZDLWidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* This file is part of qZDL
* Copyright (C) 2007-2010 Cody Harris
*
* qZDL is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <QtWidgets>
#include <QApplication>
#include "ZDLWidget.h"
#include <QMetaObject>
ZDLWidget::ZDLWidget(ZDLWidget *parent):QWidget(parent){
setZParent(parent);
//std::cout << "Using ZDLWidget as parent" << std::endl;
setContentsMargins(0,0,0,0);
}
void ZDLWidget::setZParent(ZDLWidget *parent){
zparent = parent;
connect(parent, &ZDLWidget::buildChildren, this, &ZDLWidget::notifyFromParent);
connect(this, &ZDLWidget::buildParent, parent, &ZDLWidget::notifyFromChild);
connect(parent, &ZDLWidget::readChildren, this, &ZDLWidget::readFromParent);
connect(this, &ZDLWidget::readParent, parent, &ZDLWidget::readFromChild);
}
ZDLWidget::ZDLWidget(){
setContentsMargins(0,0,0,0);
zparent = NULL;
//std::cout << "Using QWidget as parent" << std::endl;
}
ZDLWidget::ZDLWidget(QWidget *parent):QWidget(parent){
setContentsMargins(0,0,0,0);
zparent = NULL;
//std::cout << "Using QWidget as parent" << std::endl;
}
void ZDLWidget::notifyFromChild(ZDLWidget *origin){
if (origin != this){
emit buildChildren(origin);
emit buildParent(origin);
//fromDownstream(origin);
rebuild();
//const QMetaObject * qmo = metaObject();
//std::cout << "Notify from child (I am " << qmo->className() << ")" << std::endl;
}
}
void ZDLWidget::notifyFromParent(ZDLWidget *origin){
if (origin != this){
emit buildChildren(origin);
//fromUpstream(origin);
rebuild();
//const QMetaObject * qmo = metaObject();
//std::cout << "Notify from parent (I am " << qmo->className() << ")" << std::endl;
}
}
void ZDLWidget::readFromChild(ZDLWidget *origin){
if (origin != this){
emit readChildren(origin);
emit readParent(origin);
newConfig();
//const QMetaObject * qmo = metaObject();
//std::cout << "Notify from child (of new config) (I am " << qmo->className() << ")" << std::endl;
}
}
void ZDLWidget::readFromParent(ZDLWidget *origin){
if (origin != this){
emit readChildren(origin);
newConfig();
//const QMetaObject * qmo = metaObject();
//std::cout << "Notify from parent (of new config) (I am " << qmo->className() << ")" << std::endl;
}
}
//void ZDLWidget::fromDownstream(ZDLWidget *origin){
//}
//void ZDLWidget::fromUpstream(ZDLWidget *origin){
//}
void ZDLWidget::rebuild(){
}
void ZDLWidget::newConfig(){
}