Gui: Rework TaskCSysDragger into new Transform Dialog

This commit refactor ViewProviderDragger and TaskCSysDragger to be more
modern and to support selecting TransformOrigin.
This commit is contained in:
Kacper Donat
2024-10-27 18:39:51 +01:00
parent 72b92ce160
commit 4702c72fb8
25 changed files with 1785 additions and 389 deletions

View File

@@ -379,6 +379,8 @@ SoFrameLabel::SoFrameLabel()
SO_NODE_ADD_FIELD(name, ("Helvetica"));
SO_NODE_ADD_FIELD(size, (12));
SO_NODE_ADD_FIELD(frame, (true));
SO_NODE_ADD_FIELD(border, (true));
SO_NODE_ADD_FIELD(backgroundUseBaseColor, (false));
//SO_NODE_ADD_FIELD(image, (SbVec2s(0,0), 0, NULL));
}
@@ -397,9 +399,11 @@ void SoFrameLabel::notify(SoNotList * list)
f == &this->justification ||
f == &this->name ||
f == &this->size ||
f == &this->frame) {
f == &this->frame ||
f == &this->border) {
drawImage();
}
inherited::notify(list);
}
@@ -417,11 +421,12 @@ void SoFrameLabel::drawImage()
int w = 0;
int h = fm.height() * num;
const SbColor& b = backgroundColor.getValue();
QColor brush;
brush.setRgbF(b[0],b[1],b[2]);
QColor backgroundBrush;
backgroundBrush.setRgbF(b[0],b[1],b[2]);
const SbColor& t = textColor.getValue();
QColor front;
front.setRgbF(t[0],t[1],t[2]);
const QPen borderPen(QColor(0,0,127), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QStringList lines;
for (int i=0; i<num; i++) {
@@ -431,7 +436,7 @@ void SoFrameLabel::drawImage()
}
int padding = 5;
bool drawIcon = false;
QImage iconImg;
int widthIcon = 0;
@@ -456,15 +461,15 @@ void SoFrameLabel::drawImage()
painter.setRenderHint(QPainter::Antialiasing);
SbBool drawFrame = frame.getValue();
if (drawFrame) {
painter.setPen(QPen(QColor(0,0,127), 2, Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
painter.setBrush(QBrush(brush, Qt::SolidPattern));
SbBool drawBorder = border.getValue();
if (drawFrame || drawBorder) {
painter.setPen(drawBorder ? borderPen : QPen(Qt::transparent));
painter.setBrush(QBrush(drawFrame ? backgroundBrush : Qt::transparent));
QRectF rectangle(0.0, 0.0, widthTotal, heightTotal);
painter.drawRoundedRect(rectangle, 5, 5);
}
if (drawIcon) {
painter.drawImage(QPoint(padding, paddingIconV), iconImg);
}
@@ -493,10 +498,15 @@ void SoFrameLabel::drawImage()
*/
void SoFrameLabel::GLRender(SoGLRenderAction *action)
{
SoState * state = action->getState();
const SbColor& diffuse = SoLazyElement::getDiffuse(state, 0);
this->backgroundColor.setValue(diffuse);
if (backgroundUseBaseColor.getValue()) {
SoState* state = action->getState();
const SbColor& diffuse = SoLazyElement::getDiffuse(state, 0);
if (diffuse != this->backgroundColor.getValue()) {
this->backgroundColor.setValue(diffuse);
}
}
inherited::GLRender(action);
}