- Popup *const popup = new Popup(parent);
- QFormLayout *const form = new QFormLayout(popup);
- popup->setLayout(form);
- populate_popup_form(popup, form);
- return popup;
+
+ popup_ = new Popup(parent);
+ popup_->set_position(parent->mapToGlobal(
+ point(parent->rect())), Popup::Right);
+
+ create_popup_form();
+
+ connect(popup_, SIGNAL(closed()),
+ this, SLOT(on_popup_closed()));
+
+ return popup_;
+}
+
+QRectF Trace::label_rect(const QRectF &rect) const
+{
+ using pv::view::View;
+
+ QFontMetrics m(QApplication::font());
+ const QSize text_size(
+ m.boundingRect(QRect(), 0, name_).width(), m.height());
+ const QSizeF label_size(
+ text_size.width() + LabelPadding.width() * 2,
+ ceilf((text_size.height() + LabelPadding.height() * 2) / 2) * 2);
+ const float half_height = label_size.height() / 2;
+ return QRectF(
+ rect.right() - half_height - label_size.width() - 0.5,
+ get_visual_y() + 0.5f - half_height,
+ label_size.width() + half_height,
+ label_size.height());