painter.end();
}
-void Header::mouseLeftPressEvent(QMouseEvent *event)
-{
- (void)event;
-
- const bool ctrl_pressed =
- QApplication::keyboardModifiers() & Qt::ControlModifier;
-
- // Clear selection if control is not pressed and this item is unselected
- if ((!mouse_down_item_ || !mouse_down_item_->selected()) &&
- !ctrl_pressed)
- for (shared_ptr<RowItem> r : view_)
- r->select(false);
-
- // Set the signal selection state if the item has been clicked
- if (mouse_down_item_) {
- if (ctrl_pressed)
- mouse_down_item_->select(!mouse_down_item_->selected());
- else
- mouse_down_item_->select(true);
- }
-
- // Save the offsets of any signals which will be dragged
- for (const shared_ptr<RowItem> r : view_)
- if (r->selected())
- r->drag();
-
- selection_changed();
- update();
-}
-
-void Header::mousePressEvent(QMouseEvent *event)
-{
- assert(event);
-
- mouse_down_point_ = event->pos();
- mouse_down_item_ = get_mouse_over_item(event->pos());
-
- if (event->button() & Qt::LeftButton)
- mouseLeftPressEvent(event);
-}
-
void Header::mouseLeftReleaseEvent(QMouseEvent *event)
{
assert(event);
void paintEvent(QPaintEvent *event);
private:
- void mouseLeftPressEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent * event);
-
void mouseLeftReleaseEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <QApplication>
#include <QMenu>
#include <QMouseEvent>
p->show();
}
+void MarginWidget::mouse_left_press_event(QMouseEvent *event)
+{
+ (void)event;
+
+ const bool ctrl_pressed =
+ QApplication::keyboardModifiers() & Qt::ControlModifier;
+
+ // Clear selection if control is not pressed and this item is unselected
+ if ((!mouse_down_item_ || !mouse_down_item_->selected()) &&
+ !ctrl_pressed)
+ clear_selection();
+
+ // Set the signal selection state if the item has been clicked
+ if (mouse_down_item_) {
+ if (ctrl_pressed)
+ mouse_down_item_->select(!mouse_down_item_->selected());
+ else
+ mouse_down_item_->select(true);
+ }
+
+ // Save the offsets of any signals which will be dragged
+ const auto items = this->items();
+ for (auto &i : items)
+ if (i->selected())
+ i->drag();
+
+ selection_changed();
+ update();
+}
+
+void MarginWidget::mousePressEvent(QMouseEvent *event)
+{
+ assert(event);
+
+ mouse_down_point_ = event->pos();
+ mouse_down_item_ = get_mouse_over_item(event->pos());
+
+ if (event->button() & Qt::LeftButton)
+ mouse_left_press_event(event);
+}
+
void MarginWidget::leaveEvent(QEvent*)
{
mouse_point_ = QPoint(-1, -1);
*/
void show_popup(const std::shared_ptr<ViewItem> &item);
+ /**
+ * Handles left mouse button press events.
+ * @param event the mouse event that triggered this handler.
+ */
+ void mouse_left_press_event(QMouseEvent *event);
+
private:
+ void mousePressEvent(QMouseEvent * event);
+
void leaveEvent(QEvent *event);
virtual void contextMenuEvent(QContextMenuEvent *event);
i->drag_by(delta);
}
-void Ruler::mousePressEvent(QMouseEvent *e)
-{
- if (e->buttons() & Qt::LeftButton) {
- mouse_down_point_ = e->pos();
- mouse_down_item_ = get_mouse_over_item(e->pos());
-
- clear_selection();
-
- if (mouse_down_item_) {
- mouse_down_item_->select();
- mouse_down_item_->drag();
- }
-
- selection_changed();
- }
-}
-
void Ruler::mouseReleaseEvent(QMouseEvent *)
{
using pv::widgets::Popup;
void paintEvent(QPaintEvent *event);
void mouseMoveEvent(QMouseEvent *e);
- void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *);
void mouseDoubleClickEvent(QMouseEvent *e);