projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MainWindow, View::View: Fix two memory errors reported by valgrind
[pulseview.git]
/
pv
/
view
/
marginwidget.cpp
diff --git
a/pv/view/marginwidget.cpp
b/pv/view/marginwidget.cpp
index 8716439e6f74e294505489f148e8d3e31c7af7f1..4c3728710551bfceef85fad0234bffc51f44a119 100644
(file)
--- a/
pv/view/marginwidget.cpp
+++ b/
pv/view/marginwidget.cpp
@@
-30,16
+30,19
@@
using std::shared_ptr;
namespace pv {
using std::shared_ptr;
namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
MarginWidget::MarginWidget(View &parent) :
MarginWidget::MarginWidget(View &parent) :
- QWidget(&parent),
- view_(parent),
- dragging_(false)
+ ViewWidget(parent)
{
setAttribute(Qt::WA_NoSystemBackground, true);
{
setAttribute(Qt::WA_NoSystemBackground, true);
- setFocusPolicy(Qt::ClickFocus);
- setMouseTracking(true);
+}
+
+void MarginWidget::item_clicked(const shared_ptr<ViewItem> &item)
+{
+ if (item && item->enabled())
+ show_popup(item);
}
void MarginWidget::show_popup(const shared_ptr<ViewItem> &item)
}
void MarginWidget::show_popup(const shared_ptr<ViewItem> &item)
@@
-49,12
+52,6
@@
void MarginWidget::show_popup(const shared_ptr<ViewItem> &item)
p->show();
}
p->show();
}
-void MarginWidget::leaveEvent(QEvent*)
-{
- mouse_point_ = QPoint(-1, -1);
- update();
-}
-
void MarginWidget::contextMenuEvent(QContextMenuEvent *event)
{
const shared_ptr<ViewItem> r = get_mouse_over_item(mouse_point_);
void MarginWidget::contextMenuEvent(QContextMenuEvent *event)
{
const shared_ptr<ViewItem> r = get_mouse_over_item(mouse_point_);
@@
-66,9
+63,18
@@
void MarginWidget::contextMenuEvent(QContextMenuEvent *event)
menu->exec(event->globalPos());
}
menu->exec(event->globalPos());
}
-void MarginWidget::
clear_selection(
)
+void MarginWidget::
keyPressEvent(QKeyEvent *event
)
{
{
+ assert(event);
+
+ if (event->key() == Qt::Key_Delete) {
+ const auto items = this->items();
+ for (auto &i : items)
+ if (i->selected())
+ i->delete_pressed();
+ }
}
}
-} // namespace view
+} // namespace TraceView
+} // namespace views
} // namespace pv
} // namespace pv