pv::widgets::Popup* Flag::create_popup(QWidget *parent)
{
- pv::widgets::Popup *const popup = TimeMarker::create_popup(parent);
+ using pv::widgets::Popup;
+
+ Popup *const popup = TimeMarker::create_popup(parent);
+ popup->set_position(parent->mapToGlobal(
+ point(parent->rect())), Popup::Bottom);
+
QFormLayout *const form = (QFormLayout*)popup->layout();
QLineEdit *const text_edit = new QLineEdit(popup);
update();
}
-void Header::show_popup(const shared_ptr<RowItem> &item)
-{
- using pv::widgets::Popup;
-
- Popup *const p = item->create_popup(&view_);
- if (!p)
- return;
-
- const QPoint pt(width() - BaselineOffset, item->get_visual_y());
- p->set_position(mapToGlobal(pt), Popup::Right);
- p->show();
-}
-
void Header::paintEvent(QPaintEvent*)
{
// The trace labels are not drawn with the arrows exactly on the
void clear_selection();
- void show_popup(const std::shared_ptr<RowItem> &item);
-
private:
void paintEvent(QPaintEvent *event);
#include "marginwidget.hpp"
+#include <pv/widgets/popup.hpp>
+
+using std::shared_ptr;
+
namespace pv {
namespace view {
setMouseTracking(true);
}
+void MarginWidget::show_popup(const shared_ptr<ViewItem> &item)
+{
+ pv::widgets::Popup *const p = item->create_popup(this);
+ if (p)
+ p->show();
+}
+
void MarginWidget::clear_selection()
{
}
#ifndef PULSEVIEW_PV_MARGINWIDGET_H
#define PULSEVIEW_PV_MARGINWIDGET_H
+#include <memory>
+
#include <QPoint>
#include <QWidget>
namespace view {
class View;
+class ViewItem;
class MarginWidget : public QWidget
{
*/
virtual QSize extended_size_hint() const = 0;
+protected:
+ /**
+ * Shows the popup of a the specified @c ViewItem .
+ * @param item The item to show the popup for.
+ */
+ void show_popup(const std::shared_ptr<ViewItem> &item);
+
public Q_SLOTS:
virtual void clear_selection();
#include "view.hpp"
#include <pv/util.hpp>
-#include <pv/widgets/popup.hpp>
using namespace Qt;
{
using pv::widgets::Popup;
- if (!dragging_ && mouse_down_item_) {
- Popup *const p = mouse_down_item_->create_popup(&view_);
- if (p) {
- const QPoint arrpos(mouse_down_item_->get_x(),
- height() - ViewItem::HighlightRadius);
- p->set_position(mapToGlobal(arrpos), Popup::Bottom);
- p->show();
- }
- }
+ if (!dragging_ && mouse_down_item_)
+ show_popup(mouse_down_item_);
dragging_ = false;
mouse_down_item_.reset();
QPoint TimeMarker::point(const QRect &rect) const
{
- return QPoint(get_x(), rect.right());
+ return QPoint(get_x(), rect.bottom());
}
QRectF TimeMarker::label_rect(const QRectF &rect) const
using pv::widgets::Popup;
Popup *const popup = new Popup(parent);
+ popup->set_position(parent->mapToGlobal(
+ point(parent->rect())), Popup::Bottom);
+
QFormLayout *const form = new QFormLayout(popup);
popup->setLayout(form);
using pv::widgets::Popup;
popup_ = new Popup(parent);
+ popup_->set_position(parent->mapToGlobal(
+ point(parent->rect())), Popup::Right);
create_popup_form();