projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ced0548
)
TimeMarker: Added get_text
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 30 Nov 2014 15:31:10 +0000
(15:31 +0000)
committer
Uwe Hermann
<uwe@hermann-uwe.de>
Wed, 10 Dec 2014 17:06:15 +0000
(18:06 +0100)
pv/view/cursor.cpp
patch
|
blob
|
history
pv/view/cursor.hpp
patch
|
blob
|
history
pv/view/logicsignal.cpp
patch
|
blob
|
history
pv/view/timemarker.cpp
patch
|
blob
|
history
pv/view/timemarker.hpp
patch
|
blob
|
history
diff --git
a/pv/view/cursor.cpp
b/pv/view/cursor.cpp
index d5b0a641f075a5b9c5d7f4ddd0cb511102aee08a..6a4733112fbb6882edf3d281aed570cd5f19f538 100644
(file)
--- a/
pv/view/cursor.cpp
+++ b/
pv/view/cursor.cpp
@@
-45,6
+45,11
@@
Cursor::Cursor(View &view, double time) :
{
}
{
}
+QString Cursor::get_text() const
+{
+ return pv::util::format_time(time_, view_.tick_prefix(), 2);
+}
+
QRectF Cursor::get_label_rect(const QRect &rect) const
{
const shared_ptr<Cursor> other(get_other_cursor());
QRectF Cursor::get_label_rect(const QRect &rect) const
{
const shared_ptr<Cursor> other(get_other_cursor());
@@
-53,8
+58,7
@@
QRectF Cursor::get_label_rect(const QRect &rect) const
const float x = (time_ - view_.offset()) / view_.scale();
QFontMetrics m(QApplication::font());
const float x = (time_ - view_.offset()) / view_.scale();
QFontMetrics m(QApplication::font());
- QSize text_size = m.boundingRect(
- pv::util::format_time(time_, view_.tick_prefix(), 2)).size();
+ QSize text_size = m.boundingRect(get_text()).size();
const QSizeF label_size(
text_size.width() + View::LabelPadding.width() * 2,
const QSizeF label_size(
text_size.width() + View::LabelPadding.width() * 2,
diff --git
a/pv/view/cursor.hpp
b/pv/view/cursor.hpp
index 9f0adeddbd8eb0bdd20e16ded2fd16d6036533cc..fab7497e18830c53128277be14a801742105afb4 100644
(file)
--- a/
pv/view/cursor.hpp
+++ b/
pv/view/cursor.hpp
@@
-48,6
+48,11
@@
public:
Cursor(View &view, double time);
public:
Cursor(View &view, double time);
public:
+ /**
+ * Gets the text to show in the marker.
+ */
+ QString get_text() const;
+
/**
* Gets the marker label rectangle.
* @param rect The rectangle of the ruler client area.
/**
* Gets the marker label rectangle.
* @param rect The rectangle of the ruler client area.
diff --git
a/pv/view/logicsignal.cpp
b/pv/view/logicsignal.cpp
index 48d2debcf2a9df1ccd204d71b6ad486bc335d585..4a8939d14eadaa6f298aa5f1e682c783685f9ffb 100644
(file)
--- a/
pv/view/logicsignal.cpp
+++ b/
pv/view/logicsignal.cpp
@@
-246,15
+246,15
@@
void LogicSignal::paint_fore(QPainter &p, const RowItemPaintParams &pp)
if (!pixmap)
continue;
if (!pixmap)
continue;
- const
int pad = TriggerMarkerPadding
;
+ const
float pad = TriggerMarkerPadding - 0.5f
;
const QSize size = pixmap->size();
const QPoint point(
pp.right() - size.width() - pad * 2,
y - (SignalHeight + size.height()) / 2);
const QSize size = pixmap->size();
const QPoint point(
pp.right() - size.width() - pad * 2,
y - (SignalHeight + size.height()) / 2);
- p.setPen(QPen(
Qt::NoPen
));
+ p.setPen(QPen(
TriggerMarkerBackgroundColour.darker()
));
p.setBrush(TriggerMarkerBackgroundColour);
p.setBrush(TriggerMarkerBackgroundColour);
- p.drawRoundedRect(QRect(point, size).adjusted(
+ p.drawRoundedRect(QRect
F
(point, size).adjusted(
-pad, -pad, pad, pad), pad, pad);
p.drawPixmap(point, *pixmap);
-pad, -pad, pad, pad), pad, pad);
p.drawPixmap(point, *pixmap);
diff --git
a/pv/view/timemarker.cpp
b/pv/view/timemarker.cpp
index d4bd7140e92fba17cdf300495c35331cfa24ac1f..7e23806896d5ed010d090412b03cd9fc877daac8 100644
(file)
--- a/
pv/view/timemarker.cpp
+++ b/
pv/view/timemarker.cpp
@@
-31,7
+31,6
@@
#include <QFontMetrics>
#include <QPainter>
#include <QFontMetrics>
#include <QPainter>
-#include <pv/util.hpp>
#include <pv/widgets/popup.hpp>
using std::max;
#include <pv/widgets/popup.hpp>
using std::max;
@@
-93,8
+92,7
@@
QRectF TimeMarker::get_label_rect(const QRect &rect) const
const float x = (time_ - view_.offset()) / view_.scale();
QFontMetrics m(QApplication::font());
const float x = (time_ - view_.offset()) / view_.scale();
QFontMetrics m(QApplication::font());
- QSize text_size = m.boundingRect(
- pv::util::format_time(time_, view_.tick_prefix(), 2)).size();
+ QSize text_size = m.boundingRect(get_text()).size();
const QSizeF label_size(
text_size.width() + View::LabelPadding.width() * 2,
const QSizeF label_size(
text_size.width() + View::LabelPadding.width() * 2,
@@
-152,8
+150,7
@@
void TimeMarker::paint_label(QPainter &p, const QRect &rect)
p.drawPolygon(points, countof(points));
p.setPen(select_text_colour(colour_));
p.drawPolygon(points, countof(points));
p.setPen(select_text_colour(colour_));
- p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter,
- pv::util::format_time(time_, view_.tick_prefix(), 2));
+ p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter, get_text());
}
pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent)
}
pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent)
diff --git
a/pv/view/timemarker.hpp
b/pv/view/timemarker.hpp
index ae54749e4e58055e5c73db88cbf0b28526f4511b..93c7dc90940928c74f208784b290c6a50b3b5b77 100644
(file)
--- a/
pv/view/timemarker.hpp
+++ b/
pv/view/timemarker.hpp
@@
-79,6
+79,11
@@
public:
*/
virtual void paint(QPainter &p, const QRect &rect);
*/
virtual void paint(QPainter &p, const QRect &rect);
+ /**
+ * Gets the text to show in the marker.
+ */
+ virtual QString get_text() const = 0;
+
/**
* Gets the marker label rectangle.
* @param rect The rectangle of the ruler client area.
/**
* Gets the marker label rectangle.
* @param rect The rectangle of the ruler client area.