-
Notifications
You must be signed in to change notification settings - Fork 1
/
WeightCurveViewer.cpp
55 lines (46 loc) · 1.22 KB
/
WeightCurveViewer.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
#include "WeightCurveViewer.h"
#include <QQuickWindow>
#include <QDesktopWidget>
void WeightCurveViewer::setMaximized(bool maximized)
{
if (maximized)
window().showMaximized();
else
window().show();
}
bool WeightCurveViewer::isMaximized() const
{
return window().windowState() & Qt::WindowMaximized;
}
void WeightCurveViewer::setPosition(const QPoint& position)
{
/* if (position == QPoint(-1, -1))
{
if (isMaximized())
return;
QDesktopWidget* d = QApplication::desktop();
int ws = d->width(); // returns screen width
int h = d->height(); // returns screen height
int mw = size().width();
int mh = size().height();
int cw = (ws / 2) - (mw / 2);
int ch = (h / 2) - (mh / 2);
window().setPosition(cw, ch);
}
else*/
if (isMaximized() == false && position != QPoint(-1, -1))
window().setPosition(position);
}
QPoint WeightCurveViewer::position() const
{
return window().position();
}
void WeightCurveViewer::setSize(const QSize& size)
{
if (isMaximized() == false && size != QSize(-1, -1))
window().resize(size);
}
QSize WeightCurveViewer::size() const
{
return window().size();
}