projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
23e7565
)
MarginWidget: Moved in create_popup
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sat, 20 Dec 2014 22:56:35 +0000
(22:56 +0000)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Mon, 29 Dec 2014 11:56:00 +0000
(11:56 +0000)
pv/view/flag.cpp
patch
|
blob
|
history
pv/view/header.cpp
patch
|
blob
|
history
pv/view/header.hpp
patch
|
blob
|
history
pv/view/marginwidget.cpp
patch
|
blob
|
history
pv/view/marginwidget.hpp
patch
|
blob
|
history
pv/view/ruler.cpp
patch
|
blob
|
history
pv/view/timemarker.cpp
patch
|
blob
|
history
pv/view/trace.cpp
patch
|
blob
|
history
diff --git
a/pv/view/flag.cpp
b/pv/view/flag.cpp
index 81cfae873eb82365f355b109c15cc54b0d390e4a..01d13670a70b87fbbb2042dcbb70c9278724e749 100644
(file)
--- a/
pv/view/flag.cpp
+++ b/
pv/view/flag.cpp
@@
-61,7
+61,12
@@
QString Flag::get_text() const
pv::widgets::Popup* Flag::create_popup(QWidget *parent)
{
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);
QFormLayout *const form = (QFormLayout*)popup->layout();
QLineEdit *const text_edit = new QLineEdit(popup);
diff --git
a/pv/view/header.cpp
b/pv/view/header.cpp
index 77ac1aa88c343498bfcaf57939b4f0995862b54a..41dffca1f92323c9ece2090893aea04e90afd30f 100644
(file)
--- a/
pv/view/header.cpp
+++ b/
pv/view/header.cpp
@@
-96,19
+96,6
@@
void Header::clear_selection()
update();
}
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 Header::paintEvent(QPaintEvent*)
{
// The trace labels are not drawn with the arrows exactly on the
diff --git
a/pv/view/header.hpp
b/pv/view/header.hpp
index 10335cf5b6faf0cafbfe96f09fcd5ef8bddf4425..48e06a7badab1ef16acc7c83a836bb44f088b670 100644
(file)
--- a/
pv/view/header.hpp
+++ b/
pv/view/header.hpp
@@
-64,8
+64,6
@@
private:
void clear_selection();
void clear_selection();
- void show_popup(const std::shared_ptr<RowItem> &item);
-
private:
void paintEvent(QPaintEvent *event);
private:
void paintEvent(QPaintEvent *event);
diff --git
a/pv/view/marginwidget.cpp
b/pv/view/marginwidget.cpp
index f8302f646f73867589e68027580fb8435e378895..6b646832690974b21d77720e858141afc9b3677f 100644
(file)
--- a/
pv/view/marginwidget.cpp
+++ b/
pv/view/marginwidget.cpp
@@
-22,6
+22,10
@@
#include "marginwidget.hpp"
#include "marginwidget.hpp"
+#include <pv/widgets/popup.hpp>
+
+using std::shared_ptr;
+
namespace pv {
namespace view {
namespace pv {
namespace view {
@@
-35,6
+39,13
@@
MarginWidget::MarginWidget(View &parent) :
setMouseTracking(true);
}
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()
{
}
void MarginWidget::clear_selection()
{
}
diff --git
a/pv/view/marginwidget.hpp
b/pv/view/marginwidget.hpp
index 6e98e4b083a3e2562835a1a111abb11284238e5b..5b6631af724f3177e5c643bda1f0674e0ad5ccad 100644
(file)
--- a/
pv/view/marginwidget.hpp
+++ b/
pv/view/marginwidget.hpp
@@
-21,6
+21,8
@@
#ifndef PULSEVIEW_PV_MARGINWIDGET_H
#define PULSEVIEW_PV_MARGINWIDGET_H
#ifndef PULSEVIEW_PV_MARGINWIDGET_H
#define PULSEVIEW_PV_MARGINWIDGET_H
+#include <memory>
+
#include <QPoint>
#include <QWidget>
#include <QPoint>
#include <QWidget>
@@
-28,6
+30,7
@@
namespace pv {
namespace view {
class View;
namespace view {
class View;
+class ViewItem;
class MarginWidget : public QWidget
{
class MarginWidget : public QWidget
{
@@
-43,6
+46,13
@@
public:
*/
virtual QSize extended_size_hint() const = 0;
*/
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();
public Q_SLOTS:
virtual void clear_selection();
diff --git
a/pv/view/ruler.cpp
b/pv/view/ruler.cpp
index 47da23a8b78e21a9e5f7725ca533f64d472897ad..7fa9987504ca5ef370b7a8bb5bafcc6758dc5eb5 100644
(file)
--- a/
pv/view/ruler.cpp
+++ b/
pv/view/ruler.cpp
@@
-29,7
+29,6
@@
#include "view.hpp"
#include <pv/util.hpp>
#include "view.hpp"
#include <pv/util.hpp>
-#include <pv/widgets/popup.hpp>
using namespace Qt;
using namespace Qt;
@@
-199,15
+198,8
@@
void Ruler::mouseReleaseEvent(QMouseEvent *)
{
using pv::widgets::Popup;
{
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();
dragging_ = false;
mouse_down_item_.reset();
diff --git
a/pv/view/timemarker.cpp
b/pv/view/timemarker.cpp
index 5b21bfd84b7012025abe59cdca5f5877491be552..894f023bf11c4d547db8649398905a8e57c8abe8 100644
(file)
--- a/
pv/view/timemarker.cpp
+++ b/
pv/view/timemarker.cpp
@@
-76,7
+76,7
@@
float TimeMarker::get_x() const
QPoint TimeMarker::point(const QRect &rect) const
{
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
}
QRectF TimeMarker::label_rect(const QRectF &rect) const
@@
-159,6
+159,9
@@
pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent)
using pv::widgets::Popup;
Popup *const popup = new Popup(parent);
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);
QFormLayout *const form = new QFormLayout(popup);
popup->setLayout(form);
diff --git
a/pv/view/trace.cpp
b/pv/view/trace.cpp
index df5a954b43a216f66d7cb11c5799464d882a3fe4..bf1c4ae511f4f507726e97ab2f726b7b95fb6dc0 100644
(file)
--- a/
pv/view/trace.cpp
+++ b/
pv/view/trace.cpp
@@
-134,6
+134,8
@@
pv::widgets::Popup* Trace::create_popup(QWidget *parent)
using pv::widgets::Popup;
popup_ = new Popup(parent);
using pv::widgets::Popup;
popup_ = new Popup(parent);
+ popup_->set_position(parent->mapToGlobal(
+ point(parent->rect())), Popup::Right);
create_popup_form();
create_popup_form();