Commit a167021b authored by Don Gagne's avatar Don Gagne

Disabled state only draws border

Plus a few API tweaks
parent cd907cde
......@@ -70,9 +70,11 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event)
painter.setBrush(Qt::SolidPattern);
//draw the text value of the widget, and its label
QString valStr = QString::number(m_value);
painter.setPen(QColor::fromRgb(255,255,255));
painter.drawText((width()/2.0) - (painter.fontMetrics().width(m_name)/2.0),((height()-3) - (fontHeight*1)),m_name);
if (isEnabled()) {
QString valStr = QString::number(m_value);
painter.drawText((width()/2.0) - (painter.fontMetrics().width(valStr)/2.0),((height()-3) - (fontHeight * 0)),valStr);
painter.setPen(QColor::fromRgb(128,128,64));
......@@ -109,6 +111,7 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event)
}
}
}
else //horizontal orientation
{
QLinearGradient hGradientBrush(0, 0, this->width(), this->height());
......@@ -123,10 +126,11 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event)
//draw the value string
painter.setPen(QColor::fromRgb(255,255,255));
QString valstr = QString::number(m_value);
painter.drawText((width()/2.0) - (painter.fontMetrics().width(m_name)/2.0),((height()-3) - (fontHeight*1)),m_name);
painter.drawText((width()/2.0) - (painter.fontMetrics().width(valstr)/2.0),((height()-3) - (fontHeight * 0)),valstr);
if (isEnabled()) {
QString valstr = QString::number(m_value);
painter.drawText((width()/2.0) - (painter.fontMetrics().width(valstr)/2.0),((height()-3) - (fontHeight * 0)),valstr);
painter.setPen(QColor::fromRgb(0,128,0));
painter.setBrush(hGradientBrush);
......@@ -154,6 +158,7 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event)
painter.drawText((width() * ((float)m_max / 3000.0)) - (painter.fontMetrics().width(maxstr)/2.0),((height()-3) - (painter.fontMetrics().height() * 0)),maxstr);
}
}
}
}
void QGCRadioChannelDisplay::setValue(int value)
......@@ -173,9 +178,9 @@ void QGCRadioChannelDisplay::setValue(int value)
update();
}
void QGCRadioChannelDisplay::showMinMax()
void QGCRadioChannelDisplay::showMinMax(bool show)
{
m_showMinMax = true;
m_showMinMax = show;
update();
}
......
......@@ -10,8 +10,9 @@ public:
explicit QGCRadioChannelDisplay(QWidget *parent = 0);
void setOrientation(Qt::Orientation orient);
void setValue(int value);
void showMinMax();
void showMinMax(bool show = true);
void hideMinMax();
bool isMinMaxShown() { return m_showMinMax; }
void setValueAndRange(int val, int min, int max);
void setMinMax(int min, int max);
void setMin(int value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment