mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
MixerCurve, add support for node background image.
This commit is contained in:
parent
d2c99fefaf
commit
cb66f5000a
@ -109,6 +109,8 @@ void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
painter->setBrush(gradient);
|
painter->setBrush(gradient);
|
||||||
painter->setPen(QPen(Qt::black, 0));
|
painter->setPen(QPen(Qt::black, 0));
|
||||||
painter->drawEllipse(boundingRect());
|
painter->drawEllipse(boundingRect());
|
||||||
|
if (!image.isNull())
|
||||||
|
painter->drawImage(boundingRect().adjusted(1,1,-1,-1), image);
|
||||||
|
|
||||||
painter->setPen(QPen(Qt::white, 0));
|
painter->setPen(QPen(Qt::white, 0));
|
||||||
if (cmdNode) {
|
if (cmdNode) {
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
|
|
||||||
void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00") { posColor0 = color0; posColor1 = color1; }
|
void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00") { posColor0 = color0; posColor1 = color1; }
|
||||||
void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000") { negColor0 = color0; negColor1 = color1; }
|
void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000") { negColor0 = color0; negColor1 = color1; }
|
||||||
|
void setImage(QImage img) { image = img; }
|
||||||
|
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
QPainterPath shape() const;
|
QPainterPath shape() const;
|
||||||
@ -89,6 +90,7 @@ private:
|
|||||||
QString posColor1;
|
QString posColor1;
|
||||||
QString negColor0;
|
QString negColor0;
|
||||||
QString negColor1;
|
QString negColor1;
|
||||||
|
QImage image;
|
||||||
|
|
||||||
bool vertical;
|
bool vertical;
|
||||||
QString cmdName;
|
QString cmdName;
|
||||||
|
@ -92,13 +92,22 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
|
|||||||
node = getCommandNode(1);
|
node = getCommandNode(1);
|
||||||
node->setName("Linear");
|
node->setName("Linear");
|
||||||
node->setToolTip("Generate a Linear Curve");
|
node->setToolTip("Generate a Linear Curve");
|
||||||
|
QImage img = QImage(":/core/images/curve_linear.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
node->commandText("/");
|
node->commandText("/");
|
||||||
|
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
// log
|
// log
|
||||||
node = getCommandNode(2);
|
node = getCommandNode(2);
|
||||||
node->setName("Log");
|
node->setName("Log");
|
||||||
node->setToolTip("Generate a Logarithmic Curve");
|
node->setToolTip("Generate a Logarithmic Curve");
|
||||||
|
img = QImage(":/core/images/curve_log.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
node->commandText("(");
|
node->commandText("(");
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
@ -106,6 +115,10 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
|
|||||||
node = getCommandNode(3);
|
node = getCommandNode(3);
|
||||||
node->setName("Exp");
|
node->setName("Exp");
|
||||||
node->setToolTip("Generate an Exponential Curve");
|
node->setToolTip("Generate an Exponential Curve");
|
||||||
|
img = QImage(":/core/images/curve_exp.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
node->commandText(")");
|
node->commandText(")");
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
@ -113,6 +126,10 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
|
|||||||
node = getCommandNode(4);
|
node = getCommandNode(4);
|
||||||
node->setName("Flat");
|
node->setName("Flat");
|
||||||
node->setToolTip("Generate a Flat Curve");
|
node->setToolTip("Generate a Flat Curve");
|
||||||
|
img = QImage(":/core/images/curve_flat.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
node->commandText("--");
|
node->commandText("--");
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
@ -120,6 +137,10 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
|
|||||||
node = getCommandNode(5);
|
node = getCommandNode(5);
|
||||||
node->setName("Step");
|
node->setName("Step");
|
||||||
node->setToolTip("Generate a Stepped Curve");
|
node->setToolTip("Generate a Stepped Curve");
|
||||||
|
img = QImage(":/core/images/curve_step.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
node->commandText("z");
|
node->commandText("z");
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
@ -128,55 +149,83 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
|
|||||||
node = getCommandNode(6);
|
node = getCommandNode(6);
|
||||||
node->setName("MinPlus");
|
node->setName("MinPlus");
|
||||||
node->setToolTip("Increase Curve Minimum");
|
node->setToolTip("Increase Curve Minimum");
|
||||||
|
img = QImage(":/core/images/curve_plus.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
|
node->commandText("+");
|
||||||
node->setToggle(false);
|
node->setToggle(false);
|
||||||
node->setPositiveColor("#00aa00", "#00aa00"); //green
|
node->setPositiveColor("#00aa00", "#00aa00"); //green
|
||||||
node->setNegativeColor("#00aa00", "#00aa00");
|
node->setNegativeColor("#00aa00", "#00aa00");
|
||||||
node->commandText("+");
|
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
node = getCommandNode(7);
|
node = getCommandNode(7);
|
||||||
node->setName("MinMinus");
|
node->setName("MinMinus");
|
||||||
node->setToolTip("Decrease Curve Minimum");
|
node->setToolTip("Decrease Curve Minimum");
|
||||||
|
img = QImage(":/core/images/curve_minus.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
|
node->commandText("-");
|
||||||
|
|
||||||
node->setToggle(false);
|
node->setToggle(false);
|
||||||
node->setPositiveColor("#aa0000", "#aa0000"); //red
|
node->setPositiveColor("#aa0000", "#aa0000"); //red
|
||||||
node->setNegativeColor("#aa0000", "#aa0000");
|
node->setNegativeColor("#aa0000", "#aa0000");
|
||||||
node->commandText("-");
|
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
node = getCommandNode(8);
|
node = getCommandNode(8);
|
||||||
node->setName("MaxPlus");
|
node->setName("MaxPlus");
|
||||||
node->setToolTip("Increase Curve Maximum");
|
node->setToolTip("Increase Curve Maximum");
|
||||||
|
img = QImage(":/core/images/curve_plus.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
|
node->commandText("+");
|
||||||
|
|
||||||
node->setToggle(false);
|
node->setToggle(false);
|
||||||
node->setPositiveColor("#00aa00", "#00aa00"); //green
|
node->setPositiveColor("#00aa00", "#00aa00"); //green
|
||||||
node->setNegativeColor("#00aa00", "#00aa00");
|
node->setNegativeColor("#00aa00", "#00aa00");
|
||||||
node->commandText("+");
|
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
node = getCommandNode(9);
|
node = getCommandNode(9);
|
||||||
node->setName("MaxMinus");
|
node->setName("MaxMinus");
|
||||||
node->setToolTip("Decrease Curve Maximum");
|
node->setToolTip("Decrease Curve Maximum");
|
||||||
|
img = QImage(":/core/images/curve_plus.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
|
node->commandText("-");
|
||||||
|
|
||||||
node->setToggle(false);
|
node->setToggle(false);
|
||||||
node->setPositiveColor("#aa0000", "#aa0000"); //red
|
node->setPositiveColor("#aa0000", "#aa0000"); //red
|
||||||
node->setNegativeColor("#aa0000", "#aa0000");
|
node->setNegativeColor("#aa0000", "#aa0000");
|
||||||
node->commandText("-");
|
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
node = getCommandNode(10);
|
node = getCommandNode(10);
|
||||||
node->setName("StepPlus");
|
node->setName("StepPlus");
|
||||||
node->setToolTip("Increase Step/Power Value");
|
node->setToolTip("Increase Step/Power Value");
|
||||||
|
img = QImage(":/core/images/curve_plus.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
|
node->commandText("+");
|
||||||
node->setToggle(false);
|
node->setToggle(false);
|
||||||
node->setPositiveColor("#00aa00", "#00aa00"); //green
|
node->setPositiveColor("#00aa00", "#00aa00"); //green
|
||||||
node->setNegativeColor("#00aa00", "#00aa00");
|
node->setNegativeColor("#00aa00", "#00aa00");
|
||||||
node->commandText("+");
|
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
node = getCommandNode(11);
|
node = getCommandNode(11);
|
||||||
node->setName("StepMinus");
|
node->setName("StepMinus");
|
||||||
node->setToolTip("Decrease Step/Power Value");
|
node->setToolTip("Decrease Step/Power Value");
|
||||||
|
img = QImage(":/core/images/curve_minus.png");
|
||||||
|
if (!img.isNull())
|
||||||
|
node->setImage(img);
|
||||||
|
else
|
||||||
|
node->commandText("-");
|
||||||
|
|
||||||
node->setToggle(false);
|
node->setToggle(false);
|
||||||
node->setPositiveColor("#aa0000", "#aa0000"); //red
|
node->setPositiveColor("#aa0000", "#aa0000"); //red
|
||||||
node->setNegativeColor("#aa0000", "#aa0000");
|
node->setNegativeColor("#aa0000", "#aa0000");
|
||||||
node->commandText("-");
|
|
||||||
scene->addItem(node);
|
scene->addItem(node);
|
||||||
|
|
||||||
node = getCommandNode(12);
|
node = getCommandNode(12);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user