From: Uwe Hermann Date: Wed, 10 Feb 2016 20:45:37 +0000 (+0100) Subject: Standardize on 'event' as name for all Qt events. X-Git-Tag: pulseview-0.4.0~336 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d9ea96280ab1128427143660ae375c30b19aa0cb;p=pulseview.git Standardize on 'event' as name for all Qt events. Use 'event' consistently across the whole code-base as variable name for Qt events (previously 'e' or 'evt' was also used). --- diff --git a/pv/popups/channels.cpp b/pv/popups/channels.cpp index 1a042da8..c3388581 100644 --- a/pv/popups/channels.cpp +++ b/pv/popups/channels.cpp @@ -209,9 +209,9 @@ QGridLayout* Channels::create_channel_group_grid( return grid; } -void Channels::showEvent(QShowEvent *e) +void Channels::showEvent(QShowEvent *event) { - pv::widgets::Popup::showEvent(e); + pv::widgets::Popup::showEvent(event); updating_channels_ = true; diff --git a/pv/popups/channels.hpp b/pv/popups/channels.hpp index 62721ee1..5ed5d476 100644 --- a/pv/popups/channels.hpp +++ b/pv/popups/channels.hpp @@ -70,7 +70,7 @@ private: const std::vector< std::shared_ptr > sigs); private: - void showEvent(QShowEvent *e); + void showEvent(QShowEvent *event); private Q_SLOTS: void on_channel_checked(QWidget *widget); diff --git a/pv/view/header.cpp b/pv/view/header.cpp index 1977d053..ba0f9e61 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -153,15 +153,15 @@ void Header::contextMenuEvent(QContextMenuEvent *event) menu->exec(event->globalPos()); } -void Header::keyPressEvent(QKeyEvent *e) +void Header::keyPressEvent(QKeyEvent *event) { - assert(e); + assert(event); - MarginWidget::keyPressEvent(e); + MarginWidget::keyPressEvent(event); - if (e->key() == Qt::Key_G && e->modifiers() == Qt::ControlModifier) + if (event->key() == Qt::Key_G && event->modifiers() == Qt::ControlModifier) on_group(); - else if (e->key() == Qt::Key_U && e->modifiers() == Qt::ControlModifier) + else if (event->key() == Qt::Key_U && event->modifiers() == Qt::ControlModifier) on_ungroup(); } diff --git a/pv/view/header.hpp b/pv/view/header.hpp index ade6d330..deb984d0 100644 --- a/pv/view/header.hpp +++ b/pv/view/header.hpp @@ -80,7 +80,7 @@ private: private: void contextMenuEvent(QContextMenuEvent *event); - void keyPressEvent(QKeyEvent *e); + void keyPressEvent(QKeyEvent *event); private Q_SLOTS: void on_group(); diff --git a/pv/view/marginwidget.cpp b/pv/view/marginwidget.cpp index 0d657611..7e4fcdfa 100644 --- a/pv/view/marginwidget.cpp +++ b/pv/view/marginwidget.cpp @@ -62,11 +62,11 @@ void MarginWidget::contextMenuEvent(QContextMenuEvent *event) menu->exec(event->globalPos()); } -void MarginWidget::keyPressEvent(QKeyEvent *e) +void MarginWidget::keyPressEvent(QKeyEvent *event) { - assert(e); + assert(event); - if (e->key() == Qt::Key_Delete) { + if (event->key() == Qt::Key_Delete) { const auto items = this->items(); for (auto &i : items) if (i->selected()) diff --git a/pv/view/marginwidget.hpp b/pv/view/marginwidget.hpp index 963d7171..455aaf97 100644 --- a/pv/view/marginwidget.hpp +++ b/pv/view/marginwidget.hpp @@ -63,7 +63,7 @@ protected: protected: virtual void contextMenuEvent(QContextMenuEvent *event); - virtual void keyPressEvent(QKeyEvent *e); + virtual void keyPressEvent(QKeyEvent *event); }; } // namespace view diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 31ec121d..f6ec4ac7 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -225,9 +225,9 @@ Ruler::TickPositions Ruler::calculate_tick_positions( return tp; } -void Ruler::mouseDoubleClickEvent(QMouseEvent *e) +void Ruler::mouseDoubleClickEvent(QMouseEvent *event) { - view_.add_flag(view_.offset() + ((double)e->x() + 0.5) * view_.scale()); + view_.add_flag(view_.offset() + ((double)event->x() + 0.5) * view_.scale()); } void Ruler::draw_hover_mark(QPainter &p, int text_height) diff --git a/pv/view/ruler.hpp b/pv/view/ruler.hpp index aabbe486..923cceb5 100644 --- a/pv/view/ruler.hpp +++ b/pv/view/ruler.hpp @@ -122,7 +122,7 @@ private: void paintEvent(QPaintEvent *event) override; - void mouseDoubleClickEvent(QMouseEvent *e) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; /** * Draw a hover arrow under the cursor position. diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 6ad7dea0..9a46bab8 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -826,9 +826,9 @@ bool View::eventFilter(QObject *object, QEvent *event) return QObject::eventFilter(object, event); } -bool View::viewportEvent(QEvent *e) +bool View::viewportEvent(QEvent *event) { - switch (e->type()) { + switch (event->type()) { case QEvent::Paint: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: @@ -840,7 +840,7 @@ bool View::viewportEvent(QEvent *e) case QEvent::TouchEnd: return false; default: - return QAbstractScrollArea::viewportEvent(e); + return QAbstractScrollArea::viewportEvent(event); } } diff --git a/pv/view/view.hpp b/pv/view/view.hpp index 635273da..09f3c2ee 100644 --- a/pv/view/view.hpp +++ b/pv/view/view.hpp @@ -300,9 +300,9 @@ private: bool eventFilter(QObject *object, QEvent *event); - bool viewportEvent(QEvent *e); + bool viewportEvent(QEvent *event); - void resizeEvent(QResizeEvent *e); + void resizeEvent(QResizeEvent *event); public: void row_item_appearance_changed(bool label, bool content); diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 9e136664..6e07a2a8 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -202,24 +202,24 @@ void Viewport::mouseDoubleClickEvent(QMouseEvent *event) view_.zoom(-2.0, event->x()); } -void Viewport::wheelEvent(QWheelEvent *e) +void Viewport::wheelEvent(QWheelEvent *event) { - assert(e); + assert(event); - if (e->orientation() == Qt::Vertical) { - if (e->modifiers() & Qt::ControlModifier) { + if (event->orientation() == Qt::Vertical) { + if (event->modifiers() & Qt::ControlModifier) { // Vertical scrolling with the control key pressed // is intrepretted as vertical scrolling view_.set_v_offset(-view_.owner_visual_v_offset() - - (e->delta() * height()) / (8 * 120)); + (event->delta() * height()) / (8 * 120)); } else { // Vertical scrolling is interpreted as zooming in/out - view_.zoom(e->delta() / 120, e->x()); + view_.zoom(event->delta() / 120, event->x()); } - } else if (e->orientation() == Qt::Horizontal) { + } else if (event->orientation() == Qt::Horizontal) { // Horizontal scrolling is interpreted as moving left/right view_.set_scale_offset(view_.scale(), - e->delta() * view_.scale() + view_.offset()); + event->delta() * view_.scale() + view_.offset()); } } diff --git a/pv/view/viewport.hpp b/pv/view/viewport.hpp index cde9f3f5..e4c50421 100644 --- a/pv/view/viewport.hpp +++ b/pv/view/viewport.hpp @@ -92,8 +92,8 @@ private: private: void paintEvent(QPaintEvent *event); - void mouseDoubleClickEvent(QMouseEvent * event); - void wheelEvent(QWheelEvent *e); + void mouseDoubleClickEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent *event); private: boost::optional drag_offset_; diff --git a/pv/view/viewwidget.cpp b/pv/view/viewwidget.cpp index 30d96eb3..79326d2a 100644 --- a/pv/view/viewwidget.cpp +++ b/pv/view/viewwidget.cpp @@ -223,9 +223,10 @@ void ViewWidget::mouse_left_release_event(QMouseEvent *event) item_dragging_ = false; } -bool ViewWidget::touch_event(QTouchEvent *e) +bool ViewWidget::touch_event(QTouchEvent *event) { - (void)e; + (void)event; + return false; } @@ -267,16 +268,16 @@ void ViewWidget::mouseReleaseEvent(QMouseEvent *event) mouse_down_item_ = nullptr; } -void ViewWidget::mouseMoveEvent(QMouseEvent *e) +void ViewWidget::mouseMoveEvent(QMouseEvent *event) { - assert(e); - mouse_point_ = e->pos(); + assert(event); + mouse_point_ = event->pos(); - if (!e->buttons()) - item_hover(get_mouse_over_item(e->pos())); - else if (e->buttons() & Qt::LeftButton) { + if (!event->buttons()) + item_hover(get_mouse_over_item(event->pos())); + else if (event->buttons() & Qt::LeftButton) { if (!item_dragging_) { - if ((e->pos() - mouse_down_point_).manhattanLength() < + if ((event->pos() - mouse_down_point_).manhattanLength() < QApplication::startDragDistance()) return; @@ -287,7 +288,7 @@ void ViewWidget::mouseMoveEvent(QMouseEvent *e) } // Do the drag - drag_items(e->pos() - mouse_down_point_); + drag_items(event->pos() - mouse_down_point_); } } diff --git a/pv/view/viewwidget.hpp b/pv/view/viewwidget.hpp index 7051c666..fade3d28 100644 --- a/pv/view/viewwidget.hpp +++ b/pv/view/viewwidget.hpp @@ -121,14 +121,14 @@ protected: * Handles touch begin update and end events. * @param e the event that triggered this handler. */ - virtual bool touch_event(QTouchEvent *e); + virtual bool touch_event(QTouchEvent *event); protected: bool event(QEvent *event); - void mousePressEvent(QMouseEvent * event); + void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *event); void leaveEvent(QEvent *event); diff --git a/pv/widgets/colourbutton.cpp b/pv/widgets/colourbutton.cpp index 13b96738..fc9084be 100644 --- a/pv/widgets/colourbutton.cpp +++ b/pv/widgets/colourbutton.cpp @@ -90,9 +90,9 @@ void ColourButton::on_selected(int row, int col) selected(cur_colour_); } -void ColourButton::paintEvent(QPaintEvent *e) +void ColourButton::paintEvent(QPaintEvent *event) { - QPushButton::paintEvent(e); + QPushButton::paintEvent(event); QPainter p(this); diff --git a/pv/widgets/colourbutton.hpp b/pv/widgets/colourbutton.hpp index 86e8e98f..d373fc51 100644 --- a/pv/widgets/colourbutton.hpp +++ b/pv/widgets/colourbutton.hpp @@ -47,7 +47,7 @@ public: void set_palette(const QColor *const palette); private: - void paintEvent(QPaintEvent *e); + void paintEvent(QPaintEvent *event); private Q_SLOTS: void on_clicked(bool); diff --git a/pv/widgets/hidingmenubar.cpp b/pv/widgets/hidingmenubar.cpp index 0da364b1..4e50e3ba 100644 --- a/pv/widgets/hidingmenubar.cpp +++ b/pv/widgets/hidingmenubar.cpp @@ -33,18 +33,18 @@ HidingMenuBar::HidingMenuBar(QWidget *parent) : this, SLOT(item_triggered())); } -void HidingMenuBar::focusOutEvent(QFocusEvent *e) +void HidingMenuBar::focusOutEvent(QFocusEvent *event) { - if (e->reason() != Qt::PopupFocusReason) + if (event->reason() != Qt::PopupFocusReason) setHidden(true); - QMenuBar::focusOutEvent(e); + QMenuBar::focusOutEvent(event); } -void HidingMenuBar::keyPressEvent(QKeyEvent *e) +void HidingMenuBar::keyPressEvent(QKeyEvent *event) { - if (e->key() == Qt::Key_Escape) + if (event->key() == Qt::Key_Escape) setHidden(true); - QMenuBar::keyPressEvent(e); + QMenuBar::keyPressEvent(event); } void HidingMenuBar::item_triggered() diff --git a/pv/widgets/hidingmenubar.hpp b/pv/widgets/hidingmenubar.hpp index 4cf5d168..9e75e281 100644 --- a/pv/widgets/hidingmenubar.hpp +++ b/pv/widgets/hidingmenubar.hpp @@ -45,13 +45,13 @@ private: * Handles the event that the widget loses keyboard focus. * @param e the representation of the event details. */ - void focusOutEvent(QFocusEvent *e); + void focusOutEvent(QFocusEvent *event); /** * Handles the event that a key is depressed. * @param e the representation of the event details. */ - void keyPressEvent(QKeyEvent *e); + void keyPressEvent(QKeyEvent *event); private Q_SLOTS: /** diff --git a/pv/widgets/popup.cpp b/pv/widgets/popup.cpp index 17bc7191..73ddf99f 100644 --- a/pv/widgets/popup.cpp +++ b/pv/widgets/popup.cpp @@ -67,14 +67,14 @@ void Popup::set_position(const QPoint point, Position pos) MarginWidth + ((pos == Top) ? ArrowLength : 0)); } -bool Popup::eventFilter(QObject *obj, QEvent *evt) +bool Popup::eventFilter(QObject *obj, QEvent *event) { QKeyEvent *keyEvent; (void)obj; - if (evt->type() == QEvent::KeyPress) { - keyEvent = static_cast(evt); + if (event->type() == QEvent::KeyPress) { + keyEvent = static_cast(event); if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) { close(); @@ -291,13 +291,13 @@ void Popup::resizeEvent(QResizeEvent*) setMask(popup_region()); } -void Popup::mouseReleaseEvent(QMouseEvent *e) +void Popup::mouseReleaseEvent(QMouseEvent *event) { - assert(e); + assert(event); // We need our own out-of-bounds click handler because QWidget counts // the drop-shadow region as inside the widget - if (!bubble_rect().contains(e->pos())) + if (!bubble_rect().contains(event->pos())) close(); } diff --git a/pv/widgets/popup.hpp b/pv/widgets/popup.hpp index c6f931f6..84def1fe 100644 --- a/pv/widgets/popup.hpp +++ b/pv/widgets/popup.hpp @@ -52,7 +52,7 @@ public: void set_position(const QPoint point, Position pos); - bool eventFilter(QObject *obj, QEvent *evt); + bool eventFilter(QObject *obj, QEvent *event); void show(); @@ -78,10 +78,10 @@ private: void resizeEvent(QResizeEvent*); - void mouseReleaseEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *event); protected: - void showEvent(QShowEvent *e); + void showEvent(QShowEvent *); Q_SIGNALS: void closed(); diff --git a/pv/widgets/wellarray.cpp b/pv/widgets/wellarray.cpp index ad29b039..1351467a 100644 --- a/pv/widgets/wellarray.cpp +++ b/pv/widgets/wellarray.cpp @@ -49,9 +49,9 @@ namespace pv { namespace widgets { -void WellArray::paintEvent(QPaintEvent *e) +void WellArray::paintEvent(QPaintEvent *event) { - QRect r = e->rect(); + QRect r = event->rect(); int cx = r.x(); int cy = r.y(); int ch = r.height(); @@ -163,10 +163,10 @@ void WellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r) } } -void WellArray::mousePressEvent(QMouseEvent *e) +void WellArray::mousePressEvent(QMouseEvent *event) { // The current cell marker is set to the cell the mouse is pressed in - QPoint pos = e->pos(); + QPoint pos = event->pos(); setCurrent(rowAt(pos.y()), columnAt(pos.x())); } @@ -263,9 +263,9 @@ void WellArray::focusOutEvent(QFocusEvent*) /*\reimp */ -void WellArray::keyPressEvent(QKeyEvent* e) +void WellArray::keyPressEvent(QKeyEvent* event) { - switch(e->key()) { // Look at the key code + switch(event->key()) { // Look at the key code case Qt::Key_Left: // If 'left arrow'-key, if (curCol > 0) // and cr't not in leftmost col setCurrent(curRow, curCol - 1); // set cr't to next left column @@ -286,7 +286,7 @@ void WellArray::keyPressEvent(QKeyEvent* e) setSelected(curRow, curCol); break; default: // If not an interesting key, - e->ignore(); // we don't accept the event + event->ignore(); // we don't accept the event return; } diff --git a/pv/widgets/wellarray.hpp b/pv/widgets/wellarray.hpp index 8132eb00..32365a10 100644 --- a/pv/widgets/wellarray.hpp +++ b/pv/widgets/wellarray.hpp @@ -119,7 +119,7 @@ protected: void keyPressEvent(QKeyEvent*); void focusInEvent(QFocusEvent*); void focusOutEvent(QFocusEvent*); - void paintEvent(QPaintEvent *); + void paintEvent(QPaintEvent*); private: Q_DISABLE_COPY(WellArray)