mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Removed all references to widgetbar
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2924 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
1b697b3828
commit
1a83f0c461
@ -25,8 +25,7 @@ HEADERS += configplugin.h \
|
||||
mixercurvepoint.h \
|
||||
mixercurveline.h \
|
||||
configccpmwidget.h \
|
||||
configstabilizationwidget.h \
|
||||
widgetbar.h
|
||||
configstabilizationwidget.h
|
||||
|
||||
SOURCES += configplugin.cpp \
|
||||
configgadgetconfiguration.cpp \
|
||||
@ -44,8 +43,7 @@ SOURCES += configplugin.cpp \
|
||||
mixercurvepoint.cpp \
|
||||
mixercurveline.cpp \
|
||||
configccpmwidget.cpp \
|
||||
configstabilizationwidget.cpp \
|
||||
widgetbar.cpp
|
||||
configstabilizationwidget.cpp
|
||||
|
||||
FORMS += settingswidget.ui \
|
||||
airframe.ui \
|
||||
|
@ -129,15 +129,6 @@ ConfigServoWidget::ConfigServoWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
<< m_config->inSlider6
|
||||
<< m_config->inSlider7;
|
||||
|
||||
// inWidgetBars << m_config->widgetBarCH0
|
||||
// << m_config->widgetBarCH1
|
||||
// << m_config->widgetBarCH2
|
||||
// << m_config->widgetBarCH3
|
||||
// << m_config->widgetBarCH4
|
||||
// << m_config->widgetBarCH5
|
||||
// << m_config->widgetBarCH6
|
||||
// << m_config->widgetBarCH7;
|
||||
|
||||
// Now connect the widget to the ManualControlCommand / Channel UAVObject
|
||||
|
||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlCommand")));
|
||||
@ -724,9 +715,6 @@ void ConfigServoWidget::requestRCInputUpdate()
|
||||
inSliders[i]->setMaximum(max.toInt());
|
||||
inSliders[i]->setMinimum(min.toInt());
|
||||
inSliders[i]->setValue(neutral.toInt());
|
||||
// inWidgetBars[i]->setMaximum(max.toInt());
|
||||
// inWidgetBars[i]->setMinimum(min.toInt());
|
||||
// inWidgetBars[i]->setValue(neutral.toInt());
|
||||
}
|
||||
|
||||
// Update receiver type
|
||||
@ -803,7 +791,6 @@ void ConfigServoWidget::sendRCInputUpdate()
|
||||
field = obj->getField(fieldName);
|
||||
for (int i = 0; i < 8; i++)
|
||||
field->setValue(inSliders[i]->value(), i);
|
||||
// field->setValue(inWidgetBars[i]->value(), i);
|
||||
|
||||
// Set RC Receiver type:
|
||||
fieldName = QString("InputMode");
|
||||
@ -1019,7 +1006,6 @@ void ConfigServoWidget::updateChannels(UAVObject* controlCommand)
|
||||
field = controlCommand->getField(QString("Channel"));
|
||||
for (int i = 0; i < 8; i++)
|
||||
updateChannelInSlider(inSliders[i], inMinLabels[i], inMaxLabels[i], reversals[i], field->getValue(i).toInt());
|
||||
// updateChannelWidgetBar(inWidgetBars[i], inMinLabels[i], inMaxLabels[i], reversals[i], field->getValue(i).toInt());
|
||||
|
||||
firstUpdate = false;
|
||||
}
|
||||
@ -1053,9 +1039,6 @@ void ConfigServoWidget::updateChannels(UAVObject* controlCommand)
|
||||
int chMin = inSliders[chIndex]->minimum();
|
||||
int chMax = inSliders[chIndex]->maximum();
|
||||
int chNeutral = inSliders[chIndex]->value();
|
||||
// int chMin = inWidgetBars[chIndex]->minimum();
|
||||
// int chMax = inWidgetBars[chIndex]->maximum();
|
||||
// int chNeutral = inWidgetBars[chIndex]->value();
|
||||
|
||||
int value = controlCommand->getField("Channel")->getValue(chIndex).toInt();
|
||||
if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral))
|
||||
@ -1118,41 +1101,3 @@ void ConfigServoWidget::updateChannelInSlider(QSlider *slider, QLabel *min, QLab
|
||||
slider->setValue(value);
|
||||
}
|
||||
}
|
||||
/*
|
||||
void ConfigServoWidget::updateChannelWidgetBar(WidgetBar *widget_bar, QLabel *min, QLabel *max, QCheckBox *rev, int value)
|
||||
{
|
||||
Q_UNUSED(rev);
|
||||
|
||||
// if (!widget_bar || !min || !max || !rev)
|
||||
if (!widget_bar || !min || !max)
|
||||
return;
|
||||
|
||||
if (firstUpdate)
|
||||
{ // Reset all the min/max values of the progress bar since we are starting the calibration.
|
||||
|
||||
widget_bar->setMaximum(value);
|
||||
widget_bar->setMinimum(value);
|
||||
widget_bar->setValue(value);
|
||||
|
||||
max->setText(QString::number(value));
|
||||
min->setText(QString::number(value));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (value > 0)
|
||||
{ // avoids glitches...
|
||||
if (value > widget_bar->maximum())
|
||||
{
|
||||
widget_bar->setMaximum(value);
|
||||
max->setText(QString::number(value));
|
||||
}
|
||||
if (value < widget_bar->minimum())
|
||||
{
|
||||
widget_bar->setMinimum(value);
|
||||
min->setText(QString::number(value));
|
||||
}
|
||||
widget_bar->setValue(value);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "uavobject.h"
|
||||
#include <QtGui/QWidget>
|
||||
#include <QList>
|
||||
#include "widgetbar.h"
|
||||
|
||||
class Ui_SettingsWidget;
|
||||
|
||||
@ -67,7 +66,6 @@ private:
|
||||
QList<QSlider> sliders;
|
||||
|
||||
void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value);
|
||||
// void updateChannelWidgetBar(WidgetBar *widget_bar, QLabel *min, QLabel *max, QCheckBox *rev, int value);
|
||||
|
||||
void assignChannel(UAVDataObject *obj, QString str);
|
||||
void assignOutputChannel(UAVDataObject *obj, QString str);
|
||||
@ -83,7 +81,6 @@ private:
|
||||
QList<QLabel*> outLabels;
|
||||
|
||||
QList<QSlider*> inSliders;
|
||||
QList<WidgetBar*> inWidgetBars;
|
||||
QList<QLabel*> inMaxLabels;
|
||||
QList<QLabel*> inMinLabels;
|
||||
QList<QLabel*> inNeuLabels;
|
||||
|
@ -82,7 +82,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>205</x>
|
||||
<y>60</y>
|
||||
<y>70</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -112,7 +112,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>205</x>
|
||||
<y>160</y>
|
||||
<y>220</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -142,7 +142,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>180</y>
|
||||
<y>250</y>
|
||||
<width>51</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -170,7 +170,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>120</y>
|
||||
<y>160</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -197,7 +197,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>205</x>
|
||||
<y>180</y>
|
||||
<y>250</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -227,7 +227,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>210</y>
|
||||
<y>280</y>
|
||||
<width>93</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
@ -243,7 +243,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>205</x>
|
||||
<y>80</y>
|
||||
<y>100</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -273,7 +273,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>160</y>
|
||||
<y>220</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -300,7 +300,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>140</y>
|
||||
<y>190</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -327,7 +327,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>100</y>
|
||||
<y>130</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -354,7 +354,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>430</x>
|
||||
<y>210</y>
|
||||
<y>280</y>
|
||||
<width>93</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
@ -371,7 +371,7 @@ Applies and Saves all settings to SD</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>120</y>
|
||||
<y>160</y>
|
||||
<width>51</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -399,7 +399,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>205</x>
|
||||
<y>120</y>
|
||||
<y>160</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -429,7 +429,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>210</y>
|
||||
<y>280</y>
|
||||
<width>93</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
@ -471,7 +471,7 @@ Be sure to set the Neutral position on all sliders before sending!</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>205</x>
|
||||
<y>100</y>
|
||||
<y>130</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -501,7 +501,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>180</y>
|
||||
<y>250</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -528,7 +528,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>80</y>
|
||||
<y>100</y>
|
||||
<width>51</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -556,7 +556,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>140</y>
|
||||
<y>190</y>
|
||||
<width>51</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -584,7 +584,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>205</x>
|
||||
<y>140</y>
|
||||
<y>190</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -614,7 +614,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>60</y>
|
||||
<y>70</y>
|
||||
<width>51</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -642,7 +642,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>160</y>
|
||||
<y>220</y>
|
||||
<width>51</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -670,7 +670,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>100</y>
|
||||
<y>130</y>
|
||||
<width>51</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -698,7 +698,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>80</y>
|
||||
<y>100</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -725,7 +725,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>60</y>
|
||||
<y>70</y>
|
||||
<width>36</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@ -782,7 +782,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<y>70</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -798,7 +798,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<y>100</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -814,7 +814,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<y>130</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -830,7 +830,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>120</y>
|
||||
<y>160</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -846,7 +846,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>140</y>
|
||||
<y>190</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -862,7 +862,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>160</y>
|
||||
<y>220</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -878,7 +878,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>180</y>
|
||||
<y>250</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -894,7 +894,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>213</y>
|
||||
<y>283</y>
|
||||
<width>181</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@ -975,7 +975,7 @@ Neutral should be put at the bottom of the slider for the throttle.</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>240</y>
|
||||
<y>310</y>
|
||||
<width>531</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -1018,7 +1018,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>60</y>
|
||||
<y>70</y>
|
||||
<width>271</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -1043,7 +1043,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>80</y>
|
||||
<y>100</y>
|
||||
<width>271</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -1068,7 +1068,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>100</y>
|
||||
<y>130</y>
|
||||
<width>271</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -1093,7 +1093,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>120</y>
|
||||
<y>160</y>
|
||||
<width>271</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -1118,7 +1118,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>140</y>
|
||||
<y>190</y>
|
||||
<width>271</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -1143,7 +1143,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>160</y>
|
||||
<y>220</y>
|
||||
<width>271</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -1168,7 +1168,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>180</y>
|
||||
<y>250</y>
|
||||
<width>271</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -1,151 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file widgetbar.cpp
|
||||
* @author Cathy Moss Copyright (C) 2011.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Configuration Plugin
|
||||
* @{
|
||||
* @brief A bar display widget
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "widgetbar.h"
|
||||
|
||||
WidgetBar::WidgetBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_maximum = 2000;
|
||||
m_minimum = 1000;
|
||||
m_value = 1500;
|
||||
|
||||
// m_orientation = Qt::Vertical;
|
||||
m_orientation = Qt::Horizontal;
|
||||
|
||||
setBackgroundRole(QPalette::Base);
|
||||
setAutoFillBackground(true);
|
||||
}
|
||||
|
||||
QSize WidgetBar::minimumSizeHint() const
|
||||
{
|
||||
return QSize(8, 8);
|
||||
}
|
||||
|
||||
QSize WidgetBar::sizeHint() const
|
||||
{
|
||||
return QSize(200, 400);
|
||||
}
|
||||
|
||||
void WidgetBar::setMaximum(int value)
|
||||
{
|
||||
m_maximum = value;
|
||||
update();
|
||||
}
|
||||
|
||||
void WidgetBar::setMinimum(int value)
|
||||
{
|
||||
m_minimum = value;
|
||||
update();
|
||||
}
|
||||
|
||||
void WidgetBar::setValue(int value)
|
||||
{
|
||||
if (value < m_minimum) value = m_minimum;
|
||||
else
|
||||
if (value > m_maximum) value = m_maximum;
|
||||
|
||||
m_value = value;
|
||||
update();
|
||||
}
|
||||
|
||||
void WidgetBar::setOrientation(Qt::Orientation orientation)
|
||||
{
|
||||
m_orientation = orientation;
|
||||
update();
|
||||
}
|
||||
|
||||
void WidgetBar::paintEvent(QPaintEvent * /* event */)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
int range = abs(m_maximum - m_minimum);
|
||||
if (range < 1) range = 1;
|
||||
|
||||
float level = (float)(m_value - m_minimum) / range; // 0 to +1
|
||||
|
||||
int length = 0;
|
||||
QRect rect;
|
||||
|
||||
switch (m_orientation)
|
||||
{
|
||||
case Qt::Horizontal:
|
||||
{
|
||||
length = (int)((width() - 5) * level + 0.5f);
|
||||
rect.setLeft(2);
|
||||
rect.setTop(2);
|
||||
rect.setWidth(length);
|
||||
rect.setHeight(height() - 5);
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Vertical:
|
||||
{
|
||||
length = (int)((height() - 5) * level + 0.5f);
|
||||
rect.setLeft(2);
|
||||
rect.setTop(height() - 3 - length);
|
||||
rect.setWidth(width() - 5);
|
||||
rect.setHeight(length);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// background
|
||||
// painter.setPen(QColor(160, 160, 160));
|
||||
// painter.setBrush(QColor(255, 255, 255));
|
||||
// painter.setPen(QColor(80, 80, 80));
|
||||
painter.setPen(QColor(160, 160, 160));
|
||||
painter.setBrush(QColor(160, 160, 160));
|
||||
painter.drawRect(QRect(0, 0, width() - 1, height() - 1));
|
||||
|
||||
if ((m_maximum - m_minimum) > 0)
|
||||
{
|
||||
// solid bar
|
||||
// painter.setPen(QColor(128, 128, 255));
|
||||
// painter.setBrush(QColor(128, 128, 255));
|
||||
// painter.drawRoundRect(rect, 3, 3);
|
||||
|
||||
// colourful bar
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
if (!(i & 1))
|
||||
painter.setPen(QColor(0, 0, 0)); // black
|
||||
else
|
||||
// painter.setPen(QColor(0, 255, 0)); // green
|
||||
painter.setPen(QColor(128, 128, 255)); // blue
|
||||
|
||||
if (m_orientation == Qt::Horizontal)
|
||||
painter.drawLine(rect.left() + i, rect.top(), rect.left() + i, rect.bottom() + 1); // horizontal bar
|
||||
else
|
||||
painter.drawLine(rect.left(), rect.bottom() + 1 - i, rect.right() + 1, rect.bottom() + 1 - i); // vertical bar
|
||||
}
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file widgetbar.h
|
||||
* @author Cathy Moss Copyright (C) 2011.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Configuration Plugin
|
||||
* @{
|
||||
* @brief A bar display widget
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef WIDGETBAR_H
|
||||
#define WIDGETBAR_H
|
||||
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
||||
QT_MODULE(Gui)
|
||||
|
||||
class WidgetBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
|
||||
Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
|
||||
Q_PROPERTY(int value READ value WRITE setValue)
|
||||
|
||||
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
|
||||
|
||||
public:
|
||||
WidgetBar(QWidget *parent = 0);
|
||||
|
||||
QSize minimumSizeHint() const;
|
||||
QSize sizeHint() const;
|
||||
|
||||
void setMaximum(int value);
|
||||
void setMinimum(int value);
|
||||
void setValue(int value);
|
||||
|
||||
int maximum() { return m_maximum; }
|
||||
int minimum() { return m_minimum; }
|
||||
int value() { return m_value; }
|
||||
|
||||
Qt::Orientation orientation() const { return m_orientation; }
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
int m_maximum;
|
||||
int m_minimum;
|
||||
int m_value;
|
||||
|
||||
Qt::Orientation m_orientation;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user