Public Member Functions | |
QxtStarsPrivate () | |
int | pixelPosToRangeValue (int pos) const |
int | pick (const QPoint &pt) const |
QStyleOptionSlider | getStyleOption () const |
QSize | getStarSize () const |
Public Attributes | |
int | snapBackPosition |
bool | readOnly |
QSize | starSize |
QPainterPath | star |
Friends | |
class | QxtStars |
Definition at line 32 of file qxtstars.cpp.
QxtStarsPrivate::QxtStarsPrivate | ( | ) |
Definition at line 47 of file qxtstars.cpp.
References star.
: snapBackPosition(0), readOnly(false) { star.moveTo(14.285716, -43.352104); star.lineTo(38.404536, 9.1654726); star.lineTo(95.804846, 15.875014); star.lineTo(53.310787, 55.042197); star.lineTo(64.667306, 111.7065); star.lineTo(14.285714, 83.395573); star.lineTo(-36.095881, 111.7065); star.lineTo(-24.739359, 55.042198); star.lineTo(-67.233416, 15.875009); star.lineTo(-9.8331075, 9.1654728); star.closeSubpath(); }
QSize QxtStarsPrivate::getStarSize | ( | ) | const |
Definition at line 116 of file qxtstars.cpp.
References QxtPrivate< QxtStars >::qxt_p(), and starSize.
QStyleOptionSlider QxtStarsPrivate::getStyleOption | ( | ) | const |
Definition at line 94 of file qxtstars.cpp.
References QxtPrivate< QxtStars >::qxt_p().
Referenced by pixelPosToRangeValue().
{ const QxtStars* p = &qxt_p(); QStyleOptionSlider opt; opt.initFrom(p); opt.subControls = QStyle::SC_None; opt.activeSubControls = QStyle::SC_None; opt.orientation = p->orientation(); opt.maximum = p->maximum(); opt.minimum = p->minimum(); opt.upsideDown = (p->orientation() == Qt::Horizontal) ? (p->invertedAppearance() != (opt.direction == Qt::RightToLeft)) : (!p->invertedAppearance()); opt.direction = Qt::LeftToRight; // we use the upsideDown option instead opt.sliderPosition = p->sliderPosition(); opt.sliderValue = p->value(); opt.singleStep = p->singleStep(); opt.pageStep = p->pageStep(); if (p->orientation() == Qt::Horizontal) opt.state |= QStyle::State_Horizontal; return opt; }
int QxtStarsPrivate::pick | ( | const QPoint & | pt ) | const [inline] |
Definition at line 88 of file qxtstars.cpp.
References QxtPrivate< QxtStars >::qxt_p().
{ return qxt_p().orientation() == Qt::Horizontal ? pt.x() : pt.y(); }
int QxtStarsPrivate::pixelPosToRangeValue | ( | int | pos ) | const |
Definition at line 63 of file qxtstars.cpp.
References getStyleOption(), and QxtPrivate< QxtStars >::qxt_p().
{ const QxtStars* p = &qxt_p(); QStyleOptionSlider opt = getStyleOption(); QRect gr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, p); QRect sr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, p); int sliderMin, sliderMax, sliderLength; gr.setSize(qxt_p().sizeHint()); if (p->orientation() == Qt::Horizontal) { sliderLength = sr.width(); sliderMin = gr.x(); sliderMax = gr.right() - sliderLength + 1; } else { sliderLength = sr.height(); sliderMin = gr.y(); sliderMax = gr.bottom() - sliderLength + 1; } return QStyle::sliderValueFromPosition(p->minimum(), p->maximum(), pos - sliderMin, sliderMax - sliderMin, opt.upsideDown); }
friend class QxtStars [friend] |
Definition at line 35 of file qxtstars.cpp.
Definition at line 42 of file qxtstars.cpp.
Definition at line 41 of file qxtstars.cpp.
QPainterPath QxtStarsPrivate::star |
Definition at line 44 of file qxtstars.cpp.
Referenced by QxtStarsPrivate().
Definition at line 43 of file qxtstars.cpp.
Referenced by getStarSize().