Files
Renderive/YSGraphic_Core/base/MutiSelectRect.cpp
T
2026-07-23 11:10:17 +08:00

71 lines
2.3 KiB
C++

#include "MutiSelectRect_p.h"
namespace YSG {
Q_Ptr_cpp(MutiSelectRect)
MutiSelectRect::Builder::Builder(AbsAxis* keyAxis, AbsAxis* valueAxis) {
ASSERT(keyAxis->mPlot != nullptr, "Afterglow build error! keyAxis->mPlot == nullptr");
ASSERT(keyAxis->mPlot == valueAxis->mPlot, "Afterglow build error! keyAxis->mPlot != valueAxis->mPlot");
plot = keyAxis->mPlot;
this->keyAxis = keyAxis;
this->valueAxis = valueAxis;
}
MutiSelectRect* MutiSelectRect::Builder::build() {
auto ret = new MutiSelectRect();
ret->init(plot, layerName);
MutiSelectRectPrivate* pd = ret->d();
MutiSelectRectRenderState* sc = reinterpret_cast<MutiSelectRectRenderState*>(pd->state(State_Edit));
sc->mHorizontalAxis = keyAxis;
sc->mVerticalAxis = valueAxis;
sc->mFont = font;
sc->mFontPen = fontPen;
sc->mRectBrush = rectBrush;
sc->mBorderPen = borderPen;
return ret;
}
void MutiSelectRect::setHorizontalAxis(AbsAxis* axis) {
INIT_SET(MutiSelectRect)
sc->mHorizontalAxis = axis;
}
void MutiSelectRect::setVerticalAxis(AbsAxis* axis) {
INIT_SET(MutiSelectRect)
sc->mVerticalAxis = axis;
}
QFont MutiSelectRect::font(SRC src) {
INIT_GET(MutiSelectRect)
return renderState->mFont;
}
QPen MutiSelectRect::fontPen(SRC src) {
INIT_GET(MutiSelectRect)
return renderState->mFontPen;
}
QBrush MutiSelectRect::rectBrush(SRC src) {
INIT_GET(MutiSelectRect)
return renderState->mRectBrush;
}
QPen MutiSelectRect::borderPen(SRC src) {
INIT_GET(MutiSelectRect)
return renderState->mBorderPen;
}
void MutiSelectRect::setFont(const QFont& font){
INIT_SET(MutiSelectRect)
sc->mFont = font;
}
void MutiSelectRect::setFontPen(const QPen& pen){
INIT_SET(MutiSelectRect)
sc->mFontPen = pen.color().isValid() ? pen : Qt::NoPen;
}
void MutiSelectRect::setRectBrush(const QBrush& brush) {
INIT_SET(MutiSelectRect)
sc->mRectBrush = brush.color().isValid() ? brush : Qt::NoBrush;
}
void MutiSelectRect::setBorderPen(const QPen& pen) {
INIT_SET(MutiSelectRect)
sc->mBorderPen = pen.color().isValid() ? pen : Qt::NoPen;
}
}