14 #include <QtGui/QBitmap>
15 #include <QtGui/QColor>
16 #include <QtGui/QToolTip>
17 #include <QtGui/QVBoxLayout>
18 #include <QtGui/QPaintEvent>
27 setObjectName(QString::fromUtf8(name));
30 setObjectName(
"CQTSSATimeScaleWidget");
35 mpSlider =
new QSlider(Qt::Horizontal,
this);
41 mpPaintWidget->setStyleSheet(QString(
mpPaintWidget->metaObject()->className()) +
" {background-color:" + QColor(Qt::white).name() +
";}");
42 mpPaintWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
43 mpSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
45 mpSlider->setToolTip(
"move Slider to set focus on prefered time scale");
60 if (vector.
size() > 0)
99 : QWidget(parent, fl),
102 setObjectName(QString::fromUtf8(name));
105 setObjectName(
"PaintWidget");
132 int maxScaleValue = -1000;
133 int minScaleValue = 1000;
138 if (fabs(
mVector[j]) == std::numeric_limits<C_FLOAT64>::infinity())
141 if ((
int)(log10(fabs(
mVector[j])) + 1) > maxScaleValue)
142 maxScaleValue = (int)(log10(fabs(
mVector[j])) + 1);
144 if ((
int)(log10(fabs(
mVector[j])) - 1) < minScaleValue)
145 minScaleValue = (int)(log10(fabs(
mVector[j])) - 1);
148 int scaleValueRange = maxScaleValue - minScaleValue;
150 QPainter paint(
this);
154 QRect v = paint.viewport();
159 paint.setPen(QPen(QColor(180, 0, 0), 5));
160 paint.drawLine(space, space, space, space + 10);
161 paint.setPen(QPen(QColor(0, 0, 0), 1));
162 paint.drawText(space + 5, space + 10,
" - negative time scale values");
164 paint.setPen(QPen(QColor(0, 180, 0), 5));
165 paint.drawLine(space, space + 20, space, space + 30);
166 paint.setPen(QPen(QColor(0, 0, 0), 1));
167 paint.drawText(space + 5, space + 30,
" - positive time scale values");
170 paint.setPen(QPen(QColor(100, 100, 100), 1));
171 int yCentre = v.bottom() - space - 30;
172 int scaleBegin = space;
173 int scaleEnd = v.right() - space;
174 int axisLength = scaleEnd - scaleBegin;
175 paint.drawLine(scaleBegin, yCentre, scaleEnd, yCentre);
180 for (i = 0; i <= scaleValueRange; i++)
182 position = scaleBegin + (int)(i * axisLength / scaleValueRange);
183 paint.drawLine(position, yCentre + 10, position, yCentre);
184 paint.drawText(position - 5, yCentre + 30, QString::number(minScaleValue + i));
187 paint.setPen(QPen(QColor(0, 180, 0), 1));
190 int yTop = yCentre - 50;
191 int xText = v.right() - space - 230;
192 int yText = space + 30;
196 position = scaleBegin + (int)((log10(fabs(
mVector[j])) - minScaleValue) * axisLength / scaleValueRange);
201 paint.setPen(QPen(QColor(180, 20, 20), 4));
203 paint.setPen(QPen(QColor(20, 180, 20), 4));
205 paint.drawLine(position, yCentre - 1, position, yTop);
206 paint.setPen(QPen(QColor(200, 200, 200), 1));
208 paint.drawLine(xText, yText, position + 1, yTop - 1);
209 paint.drawLine(xText, yText, scaleEnd, yText);
210 paint.setPen(QPen(QColor(0, 0, 0), 1));
213 paint.drawText(xText + 1, yText - 15,
" log10 (|" + QString::number(
mVector[j]) +
"|) = " + QString::number(log10(fabs(
mVector[j]))));
215 paint.drawText(xText + 1, yText - 15,
" log10 (" + QString::number(fabs(
mVector[j])) +
") = " + QString::number(log10(fabs(
mVector[j]))));
217 paint.drawText(scaleBegin + scaleEnd / 2 - 50, yCentre + 50,
" log timescale");
222 paint.setPen(QPen(QColor(180, 20, 20), 2));
224 paint.setPen(QPen(QColor(20, 180, 20), 2));
226 paint.drawLine(position, yCentre - 1, position, yTop);
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)