Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
a9b6c249
Commit
a9b6c249
authored
Nov 20, 2018
by
Leander Schulten
Browse files
Moving Polygon, MapView and MapEditor in GUI namespace to avoid duplicated names
parent
aca3e6ba
Changes
8
Hide whitespace changes
Inline
Side-by-side
applicationdata.cpp
View file @
a9b6c249
...
...
@@ -54,7 +54,7 @@ QByteArray saveData(){
o
.
insert
(
"ControlPanel"
,
u
);
}{
QJsonObject
u
;
MapView
::
getLastCreated
()
->
writeJsonObject
(
u
);
GUI
::
MapView
::
getLastCreated
()
->
writeJsonObject
(
u
);
o
.
insert
(
"MapView"
,
u
);
}{
QJsonObject
u
;
...
...
@@ -110,7 +110,7 @@ std::function<void()> loadData(QByteArray data){
password
=
QCryptographicHash
::
hash
(
QString
(
"admin"
).
toLatin1
(),
QCryptographicHash
::
Sha3_256
);
return
[
=
](){
ControlPanel
::
getLastCreated
()
->
loadFromJsonObject
(
o
[
"ControlPanel"
].
toObject
());
MapView
::
getLastCreated
()
->
loadFromJsonObject
(
o
[
"MapView"
].
toObject
());
GUI
::
MapView
::
getLastCreated
()
->
loadFromJsonObject
(
o
[
"MapView"
].
toObject
());
Modules
::
ProgramBlockManager
::
readFromJsonObject
(
o
[
"ProgramBlockManager"
].
toObject
());
};
...
...
main.cpp
View file @
a9b6c249
...
...
@@ -91,8 +91,8 @@ int main(int argc, char *argv[])
ProgramBlockEditor
::
engine
=
&
engine
;
//qmlRegisterType<const ChannelVector*>("my.models",1,0,"ChannelVector");
qmlRegisterType
<
ChannelProgrammEditor
>
(
"custom.licht"
,
1
,
0
,
"ChannelProgrammEditor"
);
qmlRegisterType
<
MapView
>
(
"custom.licht"
,
1
,
0
,
"MapView"
);
qmlRegisterType
<
MapEditor
>
(
"custom.licht"
,
1
,
0
,
"MapEditor"
);
qmlRegisterType
<
GUI
::
MapView
>
(
"custom.licht"
,
1
,
0
,
"MapView"
);
qmlRegisterType
<
GUI
::
MapEditor
>
(
"custom.licht"
,
1
,
0
,
"MapEditor"
);
qmlRegisterType
<
ControlPanel
>
(
"custom.licht"
,
1
,
0
,
"ControlPanel"
);
qmlRegisterType
<
Graph
>
(
"custom.licht"
,
1
,
0
,
"Graph"
);
qmlRegisterType
<
Oscillogram
>
(
"custom.licht"
,
1
,
0
,
"Oscillogram"
);
...
...
mapeditor.cpp
View file @
a9b6c249
#include "mapeditor.h"
namespace
GUI
{
MapEditor
::
MapEditor
()
{
setAcceptedMouseButtons
(
Qt
::
AllButtons
);
...
...
@@ -24,3 +26,5 @@ void MapEditor::mouseMoveEvent(QMouseEvent *event){
event
->
accept
();
}
}
}
mapeditor.h
View file @
a9b6c249
...
...
@@ -3,10 +3,12 @@
#include "mapview.h"
namespace
GUI
{
class
MapEditor
:
public
MapView
{
private:
Polygon
::
Point
*
currentPressedPoint
=
nullptr
;
GUI
::
Polygon
::
Point
*
currentPressedPoint
=
nullptr
;
public:
MapEditor
();
...
...
@@ -15,4 +17,6 @@ protected:
virtual
void
mousePressEvent
(
QMouseEvent
*
event
)
override
;
};
}
#endif // MAPEDITOR_H
mapview.cpp
View file @
a9b6c249
#include "mapview.h"
#include <QJsonArray>
namespace
GUI
{
MapView
*
MapView
::
lastCreated
=
nullptr
;
...
...
@@ -48,3 +49,5 @@ void MapView::writeJsonObject(QJsonObject &o) const{
}
o
.
insert
(
"polygons"
,
a
);
}
}
mapview.h
View file @
a9b6c249
...
...
@@ -4,14 +4,16 @@
#include "polygon.h"
#include "gridbackground.h"
namespace
GUI
{
class
MapView
:
public
GridBackground
{
Q_OBJECT
static
MapView
*
lastCreated
;
protected:
std
::
vector
<
Polygon
*>
polygons
;
Polygon
*
stonework
;
Polygon
*
surfaces
;
std
::
vector
<
GUI
::
Polygon
*>
polygons
;
GUI
::
Polygon
*
stonework
;
GUI
::
Polygon
*
surfaces
;
public:
MapView
();
static
MapView
*
getLastCreated
(){
return
lastCreated
;}
...
...
@@ -22,4 +24,6 @@ signals:
public
slots
:
};
}
#endif // MAPVIEW_H
polygon.cpp
View file @
a9b6c249
...
...
@@ -9,6 +9,8 @@
#include <corecrt_math_defines.h>
#endif
namespace
GUI
{
Polygon
::
Polygon
(
QString
name
)
:
name
(
name
)
{
setFlag
(
ItemHasContents
);
...
...
@@ -288,3 +290,6 @@ void Polygon::addRectangle(Point p1, Point p2, Point p3, Point p4){
triangles
.
emplace_back
(
i1
,
i2
,
i3
);
triangles
.
emplace_back
(
i2
,
i3
,
i4
);
}
}
polygon.h
View file @
a9b6c249
...
...
@@ -9,6 +9,10 @@
#include <corecrt_math_defines.h>
#endif
namespace
GUI
{
class
Polygon
;
}
namespace
Primitives
{
...
...
@@ -57,7 +61,7 @@ class Arc{
public:
Indextype
left
,
mid
,
right
;
public:
friend
class
Polygon
;
friend
class
GUI
::
Polygon
;
typedef
Indextype
index_type
;
Arc
(
Indextype
left
,
Indextype
mid
,
Indextype
right
)
:
left
(
left
),
mid
(
mid
),
right
(
right
){}
Arc
(
const
QJsonObject
&
o
)
:
left
(
o
[
"left"
].
toInt
()),
mid
(
o
[
"mid"
].
toInt
()),
right
(
o
[
"right"
].
toInt
()){}
...
...
@@ -104,6 +108,9 @@ public:
}
namespace
GUI
{
/**
* @brief The Polygon class holds an Polygon. Its contains multiple Points that con be combined to Triangles and Arcs
*/
...
...
@@ -227,4 +234,6 @@ public:
QSGNode
*
updatePaintNode
(
QSGNode
*
,
UpdatePaintNodeData
*
)
override
;
};
}
#endif // POLYGON_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment