Created new painter bug.
This commit is contained in:
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <bcsliderstyle.h>
|
#include <bcsliderstyle.h>
|
||||||
|
#include <bcvalueeditor.h>
|
||||||
|
|
||||||
|
|
||||||
BCSliderStyle::BCSliderStyle()
|
BCSliderStyle::BCSliderStyle()
|
||||||
: QProxyStyle()
|
: QProxyStyle()
|
||||||
@@ -71,9 +73,11 @@ QRect BCSliderStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
|
|||||||
QRect rect = slider->rect;
|
QRect rect = slider->rect;
|
||||||
int handleSize = 16;
|
int handleSize = 16;
|
||||||
|
|
||||||
if (sc == SC_SliderHandle) {
|
if (sc == SC_SliderHandle)
|
||||||
|
{
|
||||||
// Handle Position korrekt berechnen
|
// Handle Position korrekt berechnen
|
||||||
if (slider->orientation == Qt::Horizontal) {
|
if (slider->orientation == Qt::Horizontal)
|
||||||
|
{
|
||||||
int range = slider->maximum - slider->minimum;
|
int range = slider->maximum - slider->minimum;
|
||||||
int pos = slider->sliderPosition - slider->minimum;
|
int pos = slider->sliderPosition - slider->minimum;
|
||||||
int pixelRange = rect.width() - handleSize;
|
int pixelRange = rect.width() - handleSize;
|
||||||
@@ -82,7 +86,9 @@ QRect BCSliderStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
|
|||||||
return QRect(rect.x() + pixelPos,
|
return QRect(rect.x() + pixelPos,
|
||||||
rect.center().y() - handleSize / 2,
|
rect.center().y() - handleSize / 2,
|
||||||
handleSize, handleSize);
|
handleSize, handleSize);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int range = slider->maximum - slider->minimum;
|
int range = slider->maximum - slider->minimum;
|
||||||
int pos = slider->sliderPosition - slider->minimum;
|
int pos = slider->sliderPosition - slider->minimum;
|
||||||
int pixelRange = rect.height() - handleSize;
|
int pixelRange = rect.height() - handleSize;
|
||||||
@@ -125,7 +131,13 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
|
|||||||
const QColor& bgColor) const
|
const QColor& bgColor) const
|
||||||
{
|
{
|
||||||
QRect groove = slider->rect;
|
QRect groove = slider->rect;
|
||||||
|
QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, nullptr);
|
||||||
|
|
||||||
|
qDebug() << " ---WTF: " << groove;
|
||||||
|
|
||||||
|
|
||||||
|
BCValueEditor::paintSliderIndicator(painter, groove, 0.5 );
|
||||||
|
/*
|
||||||
int grooveHeight = 4;
|
int grooveHeight = 4;
|
||||||
// Track sollte im Widget-Zentrum sein, nicht im groove-Zentrum
|
// Track sollte im Widget-Zentrum sein, nicht im groove-Zentrum
|
||||||
int grooveY = groove.center().y() - grooveHeight / 2;
|
int grooveY = groove.center().y() - grooveHeight / 2;
|
||||||
@@ -143,6 +155,10 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
|
|||||||
QRect activeTrack(groove.left(), grooveY, activeWidth, grooveHeight);
|
QRect activeTrack(groove.left(), grooveY, activeWidth, grooveHeight);
|
||||||
painter->setBrush(activeColor);
|
painter->setBrush(activeColor);
|
||||||
painter->drawRoundedRect(activeTrack, grooveHeight / 2, grooveHeight / 2);
|
painter->drawRoundedRect(activeTrack, grooveHeight / 2, grooveHeight / 2);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Handle (Thumb) - Fluent style is more subtle
|
// Handle (Thumb) - Fluent style is more subtle
|
||||||
int handleSize = 16;
|
int handleSize = 16;
|
||||||
@@ -160,6 +176,8 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
|
|||||||
handle.center().y() - glowSize / 2,
|
handle.center().y() - glowSize / 2,
|
||||||
glowSize, glowSize);
|
glowSize, glowSize);
|
||||||
painter->drawEllipse(glow);
|
painter->drawEllipse(glow);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thumb
|
// Thumb
|
||||||
@@ -179,25 +197,3 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BCSliderStyle::drawSliderIndicator( QPainter* painter, QRect& groove )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
int grooveHeight = 4;
|
|
||||||
// Track sollte im Widget-Zentrum sein, nicht im groove-Zentrum
|
|
||||||
int grooveY = groove.center().y() - grooveHeight / 2;
|
|
||||||
|
|
||||||
// Full background track
|
|
||||||
QRect fullTrack(groove.left(), grooveY, groove.width(), grooveHeight);
|
|
||||||
painter->setPen(Qt::NoPen);
|
|
||||||
painter->setBrush(inactiveColor.lighter(150));
|
|
||||||
painter->drawRoundedRect(fullTrack, grooveHeight / 2, grooveHeight / 2);
|
|
||||||
|
|
||||||
QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, nullptr);
|
|
||||||
|
|
||||||
// Active track (filled portion)
|
|
||||||
int activeWidth = handle.center().x() - groove.left();
|
|
||||||
QRect activeTrack(groove.left(), grooveY, activeWidth, grooveHeight);
|
|
||||||
painter->setBrush(activeColor);
|
|
||||||
painter->drawRoundedRect(activeTrack, grooveHeight / 2, grooveHeight / 2);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ public:
|
|||||||
const QColor& inactiveColor,
|
const QColor& inactiveColor,
|
||||||
const QColor& bgColor) const;
|
const QColor& bgColor) const;
|
||||||
|
|
||||||
|
static void paintSliderIndicator(QPainter* painter, const QRect& rect, double ratio );
|
||||||
static void drawSliderIndicator( QPainter* painter, QRect& groove );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
12
bcvalue.cpp
12
bcvalue.cpp
@@ -207,9 +207,9 @@ double BCValue::calcMinMaxRatio() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BCValue::valuesForSlider( int& value, int& min, int& max ) const
|
bool BCValue::valuesForSlider(ValueRange& valueRange) const
|
||||||
{
|
{
|
||||||
value = min = max = 0;
|
valueRange.value = valueRange.min = valueRange.max = 0;
|
||||||
|
|
||||||
// min & max sind vorraussetzung für den slider
|
// min & max sind vorraussetzung für den slider
|
||||||
if( !_optMin.has_value() || !_optMax.has_value() )
|
if( !_optMin.has_value() || !_optMax.has_value() )
|
||||||
@@ -219,10 +219,10 @@ bool BCValue::valuesForSlider( int& value, int& min, int& max ) const
|
|||||||
// und max liegt weil wir das schon bei setRawValue
|
// und max liegt weil wir das schon bei setRawValue
|
||||||
// überprüft haben.
|
// überprüft haben.
|
||||||
|
|
||||||
value = _rawValue * _factor;
|
valueRange.value = _rawValue * _factor;
|
||||||
min = _optMin.value();
|
valueRange.min = _optMin.value();
|
||||||
max = _optMax.value();
|
valueRange.max = _optMax.value();
|
||||||
|
valueRange.ratio = calcMinMaxRatio();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
10
bcvalue.h
10
bcvalue.h
@@ -108,6 +108,14 @@ public:
|
|||||||
//QMEMBER _PROPERTY(OptDouble MEMBER _optMin)
|
//QMEMBER _PROPERTY(OptDouble MEMBER _optMin)
|
||||||
//QMEMBER _PROPERTY(OptDouble MEMBER _optMax)
|
//QMEMBER _PROPERTY(OptDouble MEMBER _optMax)
|
||||||
|
|
||||||
|
struct ValueRange
|
||||||
|
{
|
||||||
|
int value{0};
|
||||||
|
int min{0};
|
||||||
|
int max{0};
|
||||||
|
double ratio{1};
|
||||||
|
};
|
||||||
|
|
||||||
BCValue( BCDevice::ID deviceID, BC::ID registerID );
|
BCValue( BCDevice::ID deviceID, BC::ID registerID );
|
||||||
|
|
||||||
QString formatValue() const;
|
QString formatValue() const;
|
||||||
@@ -133,7 +141,7 @@ public:
|
|||||||
QString label() const;
|
QString label() const;
|
||||||
QString unitLabel() const;
|
QString unitLabel() const;
|
||||||
|
|
||||||
bool valuesForSlider( int& value, int& min, int& max ) const;
|
bool valuesForSlider( ValueRange& valueRange ) const;
|
||||||
|
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
|
|||||||
|
|
||||||
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
||||||
|
|
||||||
BCValueEditorParams params;
|
BCValue::ValueRange params;
|
||||||
bool hasData = bcValue.valuesForSlider( params.value, params.min, params.max );
|
bool hasData = bcValue.valuesForSlider( params );
|
||||||
if( !hasData )
|
if( !hasData )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@@ -123,25 +123,26 @@ void BCValueDelegate::paint(QPainter *painter, const QStyleOptionViewItem& optio
|
|||||||
QStyledItemDelegate::paint(painter, option, index);
|
QStyledItemDelegate::paint(painter, option, index);
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
|
|
||||||
if( index.column() == 1 )
|
if( index.column() != 1 )
|
||||||
|
return;
|
||||||
|
if( row<0 || row >= _valueList.size() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
||||||
|
if( !bcValue.isReadOnly() )
|
||||||
{
|
{
|
||||||
if( row>-1 && row <= _valueList.size() )
|
if( bcValue.valueType() == BCValue::ValueType::Bool )
|
||||||
|
paintButtonIndicator(painter, option, bcValue);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
qDebug() << " ---WTF1: " <<option.rect;
|
||||||
if( !bcValue.isReadOnly() )
|
BCValueEditor::paintSliderIndicator(painter, option.rect, bcValue.calcMinMaxRatio() );
|
||||||
{
|
|
||||||
if( bcValue.valueType() == BCValue::ValueType::Bool )
|
|
||||||
paintButtonIndicator(painter,option,bcValue);
|
|
||||||
else
|
|
||||||
paintSliderIndicator(painter,option,bcValue);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_rowOpacities.contains(row))
|
|
||||||
paintHighlightRow(painter,option,index.row());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_rowOpacities.contains(row))
|
||||||
|
paintHighlightRow(painter,option,index.row());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -175,17 +176,10 @@ void BCValueDelegate::paintHighlightRow(QPainter* painter, const QStyleOptionVie
|
|||||||
|
|
||||||
void BCValueDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex& index) const
|
void BCValueDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_UNUSED(index)
|
Q_UNUSED(index)
|
||||||
|
|
||||||
QRect sliderRect = option.rect.adjusted(
|
QRect sliderRect = BCValueEditor::updateEditorRect( option.rect );
|
||||||
option.rect.width() - cTextBlockOffset, // Von rechts: cTextBlockOffset (==130) px (Breite der Progress Bar)
|
|
||||||
0, // Oben: kein Offset
|
|
||||||
-cPaddingRight, // Rechts: 8px Padding
|
|
||||||
0 // Unten: kein Offset
|
|
||||||
);
|
|
||||||
editor->setGeometry(sliderRect); // Slider nur über Progress Bar
|
editor->setGeometry(sliderRect); // Slider nur über Progress Bar
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BCValueDelegate::paintButtonIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const
|
void BCValueDelegate::paintButtonIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const
|
||||||
@@ -193,79 +187,6 @@ void BCValueDelegate::paintButtonIndicator(QPainter* painter, const QStyleOption
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BCValueDelegate::paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const
|
|
||||||
{
|
|
||||||
double ratio = bcValue.calcMinMaxRatio();
|
|
||||||
|
|
||||||
int value,min,max;
|
|
||||||
bcValue.valuesForSlider( value, min, max );
|
|
||||||
|
|
||||||
qDebug() << " --- paint: " << bcValue.label() << " value: " << value << " min: " << min << " max: " << max << " ratio:" << ratio*100.0 << '%';
|
|
||||||
|
|
||||||
// Text und kleiner Slider-Indikator zeichnen
|
|
||||||
painter->save();
|
|
||||||
painter->setRenderHint(QPainter::Antialiasing);
|
|
||||||
|
|
||||||
int adjX = option.rect.width() - cTextBlockOffset;
|
|
||||||
|
|
||||||
// Mini Progress Bar: der Gesamtbereich
|
|
||||||
QRect barRect = option.rect.adjusted( adjX, 12, -10-24, -12 );
|
|
||||||
painter->setPen(Qt::NoPen);
|
|
||||||
painter->setBrush(QColor(0xE0E0E0));
|
|
||||||
painter->drawRoundedRect(barRect, 2, 2);
|
|
||||||
|
|
||||||
// Mini Progress Bar: der Wertebereich
|
|
||||||
barRect.setWidth( ratio * barRect.width() );
|
|
||||||
painter->setBrush(QColor(0x0078D4));
|
|
||||||
painter->drawRoundedRect(barRect, 2, 2);
|
|
||||||
|
|
||||||
painter->restore();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Zeichnet eine passiven Slider, um den möglichen Wertebereich des übergebenen BCValue anzuzeigen.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void BCValueDelegate::paintSliderIndicatorXX(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const
|
|
||||||
{
|
|
||||||
// Text und kleiner Slider-Indikator zeichnen
|
|
||||||
painter->save();
|
|
||||||
painter->setRenderHint(QPainter::Antialiasing);
|
|
||||||
|
|
||||||
int newX = option.rect.width() - cTextBlockOffset;
|
|
||||||
|
|
||||||
QRect barRect = option.rect.adjusted( newX,
|
|
||||||
option.rect.height() / 2 + 1,
|
|
||||||
- option.rect.width() + cTextBlockOffset + 117 - 18,
|
|
||||||
-option.rect.height() / 2 - 3);
|
|
||||||
|
|
||||||
|
|
||||||
double ratio = bcValue.calcMinMaxRatio();
|
|
||||||
qDebug() << " --- paint: " << bcValue.label() << ":" << ratio;
|
|
||||||
if(ratio)
|
|
||||||
{
|
|
||||||
// Mini Progress Bar: der Gesamtbereich
|
|
||||||
painter->setPen(Qt::NoPen);
|
|
||||||
painter->setBrush(QColor(0xE0E0E0));
|
|
||||||
//QColor disabledText = option.palette.color(QPalette::Disabled, QPalette::Text);
|
|
||||||
//painter->setBrush(disabledText);
|
|
||||||
painter->drawRoundedRect(barRect, 2, 2);
|
|
||||||
|
|
||||||
QRect fillRect = barRect;
|
|
||||||
// ein wert darf näturlich nie über 100% eingestellt werden
|
|
||||||
ratio = qBound(0.0,ratio,1.0);
|
|
||||||
|
|
||||||
fillRect.setWidth(barRect.width() * ratio);
|
|
||||||
painter->setBrush(QColor(0x0078D4));
|
|
||||||
painter->drawRoundedRect(fillRect, 2, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
painter->restore();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Startet die Animation für die übergebene Zeile
|
* @brief Startet die Animation für die übergebene Zeile
|
||||||
|
|||||||
@@ -69,9 +69,7 @@ protected:
|
|||||||
|
|
||||||
void updateRow(int row);
|
void updateRow(int row);
|
||||||
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, int row) const;
|
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, int row) const;
|
||||||
void paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const;
|
void paintSliderIndicator(QPainter* painter, const QRect &rect, double ratio) const;
|
||||||
void paintSliderIndicatorXX(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const;
|
|
||||||
|
|
||||||
void paintButtonIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const;
|
void paintButtonIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const;
|
||||||
|
|
||||||
// Das ist ein Quickhack, der Delegate sollte
|
// Das ist ein Quickhack, der Delegate sollte
|
||||||
@@ -86,9 +84,6 @@ protected:
|
|||||||
QHash<int, qreal> _rowOpacities;
|
QHash<int, qreal> _rowOpacities;
|
||||||
QHash<int, QVariantAnimation*> _rowAnimations;
|
QHash<int, QVariantAnimation*> _rowAnimations;
|
||||||
|
|
||||||
static constexpr int cTextBlockOffset = 130;
|
|
||||||
static constexpr int cPaddingRight = 8;
|
|
||||||
static constexpr int cSliderWidth = 117;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
#include <bcsliderstyle.h>
|
#include <bcsliderstyle.h>
|
||||||
#include <bcvalueeditor.h>
|
#include <bcvalueeditor.h>
|
||||||
#include <bcvalue.h>
|
|
||||||
|
|
||||||
|
|
||||||
BCValueEditor::BCValueEditor( QWidget *parent )
|
BCValueEditor::BCValueEditor( QWidget *parent )
|
||||||
@@ -38,9 +37,7 @@ int BCValueEditor::value() const
|
|||||||
return _slider->value();
|
return _slider->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BCValueEditor::setValueAndRange( const BCValue::ValueRange& params )
|
||||||
|
|
||||||
void BCValueEditor::setValueAndRange( const BCValueEditorParams& params )
|
|
||||||
{
|
{
|
||||||
_slider->setRange( params.min, params.max);
|
_slider->setRange( params.min, params.max);
|
||||||
// Block Signals verhindern Endlosschleifen, falls das Model
|
// Block Signals verhindern Endlosschleifen, falls das Model
|
||||||
@@ -53,3 +50,41 @@ void BCValueEditor::setValueAndRange( const BCValueEditorParams& params )
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Zeichnet eine passiven Slider, um den möglichen Wertebereich des übergebenen BCValue anzuzeigen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void BCValueEditor::paintSliderIndicator(QPainter* painter, const QRect& rect, double ratio )
|
||||||
|
{
|
||||||
|
// Kleinen Slider-Indikator zeichnen
|
||||||
|
painter->save();
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
|
int adjX = rect.width() - cTextBlockOffset;
|
||||||
|
|
||||||
|
// Mini Progress Bar: der Gesamtbereich
|
||||||
|
QRect barRect = rect.adjusted( adjX, 12, -10-24, -12 );
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
painter->setBrush(QColor(0xE0E0E0));
|
||||||
|
painter->drawRoundedRect(barRect, 2, 2);
|
||||||
|
|
||||||
|
// Mini Progress Bar: der Wertebereich
|
||||||
|
barRect.setWidth( ratio * barRect.width() );
|
||||||
|
painter->setBrush(QColor(0x0078D4));
|
||||||
|
painter->drawRoundedRect(barRect, 2, 2);
|
||||||
|
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRect BCValueEditor::updateEditorRect( const QRect& rect)
|
||||||
|
{
|
||||||
|
return rect.adjusted(
|
||||||
|
rect.width() - cTextBlockOffset, // Von rechts: cTextBlockOffset (==130) px (Breite der Progress Bar)
|
||||||
|
0, // Oben: kein Offset
|
||||||
|
-cPaddingRight, // Rechts: 8px Padding
|
||||||
|
0 // Unten: kein Offset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,19 +3,14 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <bcvalue.h>
|
||||||
#include <ui_bcvalueeditor.h>
|
#include <ui_bcvalueeditor.h>
|
||||||
|
|
||||||
class QSlider;
|
class QSlider;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class BCValue;
|
class BCValue;
|
||||||
|
|
||||||
struct BCValueEditorParams
|
|
||||||
{
|
|
||||||
int value{0};
|
|
||||||
int min{0};
|
|
||||||
int max{0};
|
|
||||||
};
|
|
||||||
|
|
||||||
class BCValueEditor : public QWidget, private Ui::BCValueEditor
|
class BCValueEditor : public QWidget, private Ui::BCValueEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -25,13 +20,24 @@ public:
|
|||||||
explicit BCValueEditor(QWidget *parent = nullptr);
|
explicit BCValueEditor(QWidget *parent = nullptr);
|
||||||
|
|
||||||
int value() const;
|
int value() const;
|
||||||
void setValueAndRange( const BCValueEditorParams& params );
|
void setValueAndRange( const BCValue::ValueRange& params );
|
||||||
|
|
||||||
|
// helper functions
|
||||||
|
static QRect updateEditorRect( const QRect& rect);
|
||||||
|
static void paintSliderIndicator(QPainter* painter, const QRect& rect, double ratio );
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void valueChanged(int value);
|
void valueChanged(int value);
|
||||||
void valueCommited(int value);
|
void valueCommited(int value);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
static constexpr int cTextBlockOffset = 130;
|
||||||
|
static constexpr int cPaddingRight = 8;
|
||||||
|
static constexpr int cSliderWidth = 117;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BCValueEditor_H
|
#endif // BCValueEditor_H
|
||||||
|
|||||||
Reference in New Issue
Block a user