diff --git a/src/widgets/3dview/bedproperties.cpp b/src/widgets/3dview/bedproperties.cpp
index b311936..b698731 100644
--- a/src/widgets/3dview/bedproperties.cpp
+++ b/src/widgets/3dview/bedproperties.cpp
@@ -1,78 +1,74 @@
/* Atelier KDE Printer Host for 3D Printing
Copyright (C) <2018>
Author: Kevin Ottens - ervin@kde.org
This program 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 any later version accepted by the membership of
KDE e.V. (or its successor approved by the membership of KDE
e.V.), which shall act as a proxy defined in Section 14 of
version 3 of the license.
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 .
*/
#include "bedproperties.h"
#include "viewer3d.h"
#include
#include
BedProperties::BedProperties(QObject *parent)
: QObject(parent)
, m_width(200)
, m_depth(200)
{
QTimer::singleShot(0, [ = ] {
auto context = qmlContext(this);
if (!context)
{
return;
}
auto viewer = context->contextProperty("viewer3d").value();
if (!viewer)
{
return;
}
updateBedSize(viewer->bedSize());
connect(viewer, &Viewer3D::bedSizeChanged,
this, &BedProperties::updateBedSize);
});
}
-BedProperties::~BedProperties()
-{
-}
-
int BedProperties::width() const
{
return m_width;
}
int BedProperties::depth() const
{
return m_depth;
}
void BedProperties::updateBedSize(const QSize &size)
{
if (size.width() != m_width) {
m_width = size.width();
emit widthChanged(m_width);
}
if (size.height() != m_depth) {
m_depth = size.height();
emit depthChanged(m_depth);
}
}
diff --git a/src/widgets/3dview/bedproperties.h b/src/widgets/3dview/bedproperties.h
index a14a225..a781447 100644
--- a/src/widgets/3dview/bedproperties.h
+++ b/src/widgets/3dview/bedproperties.h
@@ -1,47 +1,47 @@
/* Atelier KDE Printer Host for 3D Printing
Copyright (C) <2018>
Author: Kevin Ottens - ervin@kde.org
This program 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 any later version accepted by the membership of
KDE e.V. (or its successor approved by the membership of KDE
e.V.), which shall act as a proxy defined in Section 14 of
version 3 of the license.
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 .
*/
#pragma once
#include
class BedProperties : public QObject
{
Q_OBJECT
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int depth READ depth NOTIFY depthChanged)
public:
explicit BedProperties(QObject *parent = nullptr);
- ~BedProperties();
+ ~BedProperties() = default;
int width() const;
int depth() const;
signals:
void widthChanged(int width);
void depthChanged(int depth);
private:
void updateBedSize(const QSize &size);
int m_width;
int m_depth;
};