change: change code style to Linux style except indent.
This commit is contained in:
+50
-50
@@ -22,87 +22,87 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
PointGizmo::PointGizmo(const Shape &shape, bool smaller, QObject *parent) :
|
||||
DraggableGizmo{parent},
|
||||
shape_(shape),
|
||||
smaller_(smaller)
|
||||
PointGizmo::PointGizmo(const Shape &shape, bool smaller, QObject *parent)
|
||||
: DraggableGizmo{ parent }
|
||||
, shape_(shape)
|
||||
, smaller_(smaller)
|
||||
{
|
||||
}
|
||||
|
||||
PointGizmo::PointGizmo(const Shape &shape, QObject *parent) :
|
||||
PointGizmo(shape, false, parent)
|
||||
PointGizmo::PointGizmo(const Shape &shape, QObject *parent)
|
||||
: PointGizmo(shape, false, parent)
|
||||
{
|
||||
}
|
||||
|
||||
PointGizmo::PointGizmo(QObject *parent) :
|
||||
PointGizmo(kSquare, parent)
|
||||
PointGizmo::PointGizmo(QObject *parent)
|
||||
: PointGizmo(kSquare, parent)
|
||||
{
|
||||
}
|
||||
|
||||
void PointGizmo::Draw(QPainter *p) const
|
||||
{
|
||||
QRectF rect = GetDrawingRect(p->transform(), GetStandardRadius());
|
||||
QRectF rect = GetDrawingRect(p->transform(), GetStandardRadius());
|
||||
|
||||
if (shape_ != kAnchorPoint) {
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->setBrush(Qt::white);
|
||||
}
|
||||
if (shape_ != kAnchorPoint) {
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->setBrush(Qt::white);
|
||||
}
|
||||
|
||||
switch (shape_) {
|
||||
case kSquare:
|
||||
p->drawRect(rect);
|
||||
break;
|
||||
case kCircle:
|
||||
p->drawEllipse(rect);
|
||||
break;
|
||||
case kAnchorPoint:
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
switch (shape_) {
|
||||
case kSquare:
|
||||
p->drawRect(rect);
|
||||
break;
|
||||
case kCircle:
|
||||
p->drawEllipse(rect);
|
||||
break;
|
||||
case kAnchorPoint:
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
|
||||
p->drawEllipse(rect);
|
||||
p->drawLines({QPointF(rect.left(), rect.center().y()),
|
||||
QPointF(rect.right(), rect.center().y()),
|
||||
QPointF(rect.center().x(), rect.top()),
|
||||
QPointF(rect.center().x(), rect.bottom())});
|
||||
break;
|
||||
}
|
||||
p->drawEllipse(rect);
|
||||
p->drawLines({ QPointF(rect.left(), rect.center().y()),
|
||||
QPointF(rect.right(), rect.center().y()),
|
||||
QPointF(rect.center().x(), rect.top()),
|
||||
QPointF(rect.center().x(), rect.bottom()) });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QRectF PointGizmo::GetClickingRect(const QTransform &t) const
|
||||
{
|
||||
return GetDrawingRect(t, GetStandardRadius());
|
||||
return GetDrawingRect(t, GetStandardRadius());
|
||||
}
|
||||
|
||||
double PointGizmo::GetStandardRadius()
|
||||
{
|
||||
return QFontMetrics(qApp->font()).height() * 0.25;
|
||||
return QFontMetrics(qApp->font()).height() * 0.25;
|
||||
}
|
||||
|
||||
QRectF PointGizmo::GetDrawingRect(const QTransform &transform, double radius) const
|
||||
QRectF PointGizmo::GetDrawingRect(const QTransform &transform,
|
||||
double radius) const
|
||||
{
|
||||
QRectF r(0,0, radius, radius);
|
||||
QRectF r(0, 0, radius, radius);
|
||||
|
||||
r = transform.inverted().mapRect(r);
|
||||
r = transform.inverted().mapRect(r);
|
||||
|
||||
double width = r.width();
|
||||
double height = r.height();
|
||||
double width = r.width();
|
||||
double height = r.height();
|
||||
|
||||
if (shape_ == kAnchorPoint) {
|
||||
width *= 2;
|
||||
height *= 2;
|
||||
}
|
||||
if (shape_ == kAnchorPoint) {
|
||||
width *= 2;
|
||||
height *= 2;
|
||||
}
|
||||
|
||||
if (smaller_) {
|
||||
width *= 0.5;
|
||||
height *= 0.5;
|
||||
}
|
||||
if (smaller_) {
|
||||
width *= 0.5;
|
||||
height *= 0.5;
|
||||
}
|
||||
|
||||
return QRectF(point_.x() - width,
|
||||
point_.y() - height,
|
||||
2*width,
|
||||
2*height);
|
||||
return QRectF(point_.x() - width, point_.y() - height, 2 * width,
|
||||
2 * height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user