change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
+52 -50
View File
@@ -27,73 +27,75 @@
#include "nodeviewitem.h"
namespace olive {
NodeViewItemConnector::NodeViewItemConnector(bool is_output, QGraphicsItem *parent) :
QGraphicsPolygonItem(parent),
output_(is_output)
namespace olive
{
QColor c = qApp->palette().text().color();
setPen(QPen(c, NodeViewItem::DefaultItemBorder()));
setBrush(c);
NodeViewItemConnector::NodeViewItemConnector(bool is_output,
QGraphicsItem *parent)
: QGraphicsPolygonItem(parent)
, output_(is_output)
{
QColor c = qApp->palette().text().color();
setPen(QPen(c, NodeViewItem::DefaultItemBorder()));
setBrush(c);
}
void NodeViewItemConnector::SetFlowDirection(NodeViewCommon::FlowDirection dir)
{
QFont f;
QFontMetricsF fm(f);
QFont f;
QFontMetricsF fm(f);
int triangle_sz = fm.height()/2;
int triangle_sz_half = triangle_sz / 2;
int triangle_sz = fm.height() / 2;
int triangle_sz_half = triangle_sz / 2;
QPolygonF p;
p.resize(3);
QPolygonF p;
p.resize(3);
switch (dir) {
case NodeViewCommon::kLeftToRight:
// Triangle pointing right
p[0] = QPointF(0, -triangle_sz_half);
p[1] = QPointF(triangle_sz_half, 0);
p[2] = QPointF(0, triangle_sz_half);
break;
case NodeViewCommon::kTopToBottom:
// Triangle pointing down
p[0] = QPointF(-triangle_sz_half, 0);
p[1] = QPointF(0, triangle_sz_half);
p[2] = QPointF(triangle_sz_half, 0);
break;
case NodeViewCommon::kBottomToTop:
// Triangle pointing up
p[0] = QPointF(-triangle_sz_half, 0);
p[1] = QPointF(0, -triangle_sz_half);
p[2] = QPointF(triangle_sz_half, 0);
break;
case NodeViewCommon::kRightToLeft:
// Triangle pointing left
p[0] = QPointF(0, -triangle_sz_half);
p[1] = QPointF(-triangle_sz_half, 0);
p[2] = QPointF(0, triangle_sz_half);
break;
case NodeViewCommon::kInvalidDirection:
break;
}
switch (dir) {
case NodeViewCommon::kLeftToRight:
// Triangle pointing right
p[0] = QPointF(0, -triangle_sz_half);
p[1] = QPointF(triangle_sz_half, 0);
p[2] = QPointF(0, triangle_sz_half);
break;
case NodeViewCommon::kTopToBottom:
// Triangle pointing down
p[0] = QPointF(-triangle_sz_half, 0);
p[1] = QPointF(0, triangle_sz_half);
p[2] = QPointF(triangle_sz_half, 0);
break;
case NodeViewCommon::kBottomToTop:
// Triangle pointing up
p[0] = QPointF(-triangle_sz_half, 0);
p[1] = QPointF(0, -triangle_sz_half);
p[2] = QPointF(triangle_sz_half, 0);
break;
case NodeViewCommon::kRightToLeft:
// Triangle pointing left
p[0] = QPointF(0, -triangle_sz_half);
p[1] = QPointF(-triangle_sz_half, 0);
p[2] = QPointF(0, triangle_sz_half);
break;
case NodeViewCommon::kInvalidDirection:
break;
}
setPolygon(p);
setPolygon(p);
}
QPainterPath NodeViewItemConnector::shape() const
{
// Yes, we skip QGraphicsPolygonItem because it adds the polygon. QGraphicsItem adds the
// boundingRect which we modify below
return QGraphicsItem::shape(); // clazy:exclude=skipped-base-method
// Yes, we skip QGraphicsPolygonItem because it adds the polygon. QGraphicsItem adds the
// boundingRect which we modify below
return QGraphicsItem::shape(); // clazy:exclude=skipped-base-method
}
QRectF NodeViewItemConnector::boundingRect() const
{
QRectF b = this->polygon().boundingRect();
const int radius = QFontMetrics(QFont()).height()/2;
b.adjust(-radius, -radius, radius, radius);
return b;
QRectF b = this->polygon().boundingRect();
const int radius = QFontMetrics(QFont()).height() / 2;
b.adjust(-radius, -radius, radius, radius);
return b;
}
}