painter.end();
}
-void Header::mouseLeftReleaseEvent(QMouseEvent *event)
-{
- assert(event);
-
- const bool ctrl_pressed =
- QApplication::keyboardModifiers() & Qt::ControlModifier;
-
- // Unselect everything if control is not pressed
- const shared_ptr<ViewItem> mouse_over =
- get_mouse_over_item(event->pos());
-
- for (auto &r : view_)
- r->drag_release();
-
- if (dragging_)
- view_.restack_all_row_items();
- else
- {
- if (!ctrl_pressed) {
- for (shared_ptr<RowItem> r : view_)
- if (mouse_down_item_ != r)
- r->select(false);
-
- if (mouse_down_item_)
- show_popup(mouse_down_item_);
- }
- }
-
- dragging_ = false;
-}
-
-void Header::mouseReleaseEvent(QMouseEvent *event)
-{
- assert(event);
- if (event->button() & Qt::LeftButton)
- mouseLeftReleaseEvent(event);
-
- mouse_down_item_ = nullptr;
-}
-
void Header::mouseMoveEvent(QMouseEvent *event)
{
assert(event);
void paintEvent(QPaintEvent *event);
private:
- void mouseLeftReleaseEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
-
void mouseMoveEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
update();
}
+void MarginWidget::mouse_left_release_event(QMouseEvent *event)
+{
+ assert(event);
+
+ auto items = this->items();
+ const bool ctrl_pressed =
+ QApplication::keyboardModifiers() & Qt::ControlModifier;
+
+ // Unselect everything if control is not pressed
+ const shared_ptr<ViewItem> mouse_over =
+ get_mouse_over_item(event->pos());
+
+ for (auto &i : items)
+ i->drag_release();
+
+ if (dragging_)
+ view_.restack_all_row_items();
+ else
+ {
+ if (!ctrl_pressed) {
+ for (shared_ptr<ViewItem> i : items)
+ if (mouse_down_item_ != i)
+ i->select(false);
+
+ if (mouse_down_item_)
+ show_popup(mouse_down_item_);
+ }
+ }
+
+ dragging_ = false;
+}
+
void MarginWidget::mousePressEvent(QMouseEvent *event)
{
assert(event);
mouse_left_press_event(event);
}
+void MarginWidget::mouseReleaseEvent(QMouseEvent *event)
+{
+ assert(event);
+ if (event->button() & Qt::LeftButton)
+ mouse_left_release_event(event);
+
+ mouse_down_item_ = nullptr;
+}
+
void MarginWidget::leaveEvent(QEvent*)
{
mouse_point_ = QPoint(-1, -1);
*/
void mouse_left_press_event(QMouseEvent *event);
+ /**
+ * Handles left mouse button release events.
+ * @param event the mouse event that triggered this handler.
+ */
+ void mouse_left_release_event(QMouseEvent *event);
+
protected:
void mousePressEvent(QMouseEvent * event);
+ void mouseReleaseEvent(QMouseEvent *event);
void leaveEvent(QEvent *event);
i->drag_by(delta);
}
-void Ruler::mouseReleaseEvent(QMouseEvent *)
-{
- using pv::widgets::Popup;
-
- if (!dragging_ && mouse_down_item_)
- show_popup(mouse_down_item_);
-
- dragging_ = false;
- mouse_down_item_.reset();
-
- const vector< shared_ptr<TimeItem> > items(view_.time_items());
- for (auto &i : items)
- i->drag_release();
-}
-
void Ruler::mouseDoubleClickEvent(QMouseEvent *e)
{
view_.add_flag(view_.offset() + ((double)e->x() + 0.5) * view_.scale());
void paintEvent(QPaintEvent *event);
void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *);
void mouseDoubleClickEvent(QMouseEvent *e);