mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
fix direction
This commit is contained in:
parent
c3420a8393
commit
5f37a9d8c7
@ -79,39 +79,39 @@ QString GraphicalItem::getImage(const float value)
|
|||||||
pen.setWidth(_width);
|
pen.setWidth(_width);
|
||||||
// inactive
|
// inactive
|
||||||
pen.setColor(inactive);
|
pen.setColor(inactive);
|
||||||
scene->addLine(0.5 * _width, 0.0, 0.5 * _width, _height, pen);
|
scene->addLine(0.5 * _width, -0.5 * _width, 0.5 * _width, (1.0 - percent) * _height - 0.5 * _width, pen);
|
||||||
// active
|
// active
|
||||||
pen.setColor(active);
|
pen.setColor(active);
|
||||||
scene->addLine(0.5 * _width, (1.0 - percent) * _height + 0.5 * _width, 0.5 * _width, _height + 0.5 * _width, pen);
|
scene->addLine(0.5 * _width, (1.0 - percent) * _height + 0.5 * _width, 0.5 * _width, _height + 0.5 * _width, pen);
|
||||||
// scale
|
// scale
|
||||||
scale[1] = (int)_direction;
|
scale[1] = -2 * (int)_direction + 1;
|
||||||
break;
|
break;
|
||||||
case Circle:
|
case Circle:
|
||||||
QGraphicsEllipseItem *circle;
|
QGraphicsEllipseItem *circle;
|
||||||
pen.setWidth(1.0);
|
pen.setWidth(1.0);
|
||||||
// inactive
|
// inactive
|
||||||
pen.setColor(inactive);
|
pen.setColor(inactive);
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(_inactiveColor, Qt::SolidPattern));
|
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(inactive, Qt::SolidPattern));
|
||||||
circle->setSpanAngle((1.0 - percent) * 360.0 * 16.0);
|
circle->setSpanAngle((1.0 - percent) * 360.0 * 16.0);
|
||||||
circle->setStartAngle(180.0 * 16.0 - (1.0 - percent) * 360.0 * 16.0);
|
circle->setStartAngle(180.0 * 16.0 - (1.0 - percent) * 360.0 * 16.0);
|
||||||
// active
|
// active
|
||||||
pen.setColor(active);
|
pen.setColor(active);
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(_activeColor, Qt::SolidPattern));
|
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(active, Qt::SolidPattern));
|
||||||
circle->setSpanAngle(percent * 360.0 * 16.0);
|
circle->setSpanAngle(percent * 360.0 * 16.0);
|
||||||
circle->setStartAngle(180.0 * 16.0);
|
circle->setStartAngle(180.0 * 16.0);
|
||||||
// scale
|
// scale
|
||||||
scale[0] = (int)_direction;
|
scale[0] = -2 *(int)_direction + 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pen.setWidth(_height);
|
pen.setWidth(_height);
|
||||||
// inactive
|
// inactive
|
||||||
pen.setColor(inactive);
|
pen.setColor(inactive);
|
||||||
scene->addLine(0.0, 0.5 * _height, _width, 0.5 * _height, pen);
|
scene->addLine(percent * _width + 0.5 * _height, 0.5 * _height, _width + 0.5 * _height, 0.5 * _height, pen);
|
||||||
// active
|
// active
|
||||||
pen.setColor(active);
|
pen.setColor(active);
|
||||||
scene->addLine(-0.5 * _height, 0.5 * _height, percent * _width - 0.5 * _height, 0.5 * _height, pen);
|
scene->addLine(-0.5 * _height, 0.5 * _height, percent * _width - 0.5 * _height, 0.5 * _height, pen);
|
||||||
// scale
|
// scale
|
||||||
scale[0] = (int)_direction;
|
scale[0] = -2 * (int)_direction + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ class GraphicalItem : public QDialog
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum Direction {
|
enum Direction {
|
||||||
RightToLeft = 0,
|
LeftToRight = 0,
|
||||||
LeftToRight = 1
|
RightToLeft
|
||||||
};
|
};
|
||||||
enum Type {
|
enum Type {
|
||||||
Horizontal = 0,
|
Horizontal = 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user