#include <QPainter>
#include <QTextStream>
+#include <pv/widgets/popup.h>
+
using namespace boost;
using namespace std;
void Ruler::mouseReleaseEvent(QMouseEvent *)
{
+ using pv::widgets::Popup;
+
+ if (!_dragging)
+ if (shared_ptr<TimeMarker> m = _grabbed_marker.lock()) {
+ Popup *const p = m->create_popup(&_view);
+ p->set_position(mapToGlobal(QPoint(m->get_x(),
+ height())), Popup::Bottom);
+ p->show();
+ }
+
_dragging = false;
_grabbed_marker.reset();
}
class QWidget;
namespace pv {
+
+namespace widgets {
+class Popup;
+}
+
namespace view {
class SelectableItem : public QObject
public:
virtual QMenu* create_context_menu(QWidget *parent);
+ virtual pv::widgets::Popup* create_popup(QWidget *parent) = 0;
+
protected:
static QPen highlight_pen();
#include <QPainter>
+#include <pv/widgets/popup.h>
+
using namespace std;
namespace pv {
p.drawLine(QPointF(x, rect.top()), QPointF(x, rect.bottom()));
}
+pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent)
+{
+ using pv::widgets::Popup;
+
+ Popup *const popup = new Popup(parent);
+ QFormLayout *const form = new QFormLayout(popup);
+ popup->setLayout(form);
+
+ _value_widget = new QDoubleSpinBox(parent);
+ _value_widget->setValue(_time);
+ _value_widget->setDecimals(6);
+ _value_widget->setSuffix("s");
+ _value_widget->setSingleStep(1e-6);
+
+ connect(_value_widget, SIGNAL(valueChanged(double)),
+ this, SLOT(on_value_changed(double)));
+
+ form->addRow(tr("Time"), _value_widget);
+
+ return popup;
+}
+
void TimeMarker::on_value_changed(double value)
{
if (!_updating_value_widget) {
virtual void paint_label(QPainter &p, const QRect &rect,
unsigned int prefix) = 0;
+ pv::widgets::Popup* create_popup(QWidget *parent);
+
private slots:
void on_value_changed(double value);