Skip to content

Commit

Permalink
Remove unused LineEditWithButton::simulateReturnPressed() (#1040)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
ahcorde authored Aug 17, 2023
1 parent ebf5435 commit 384d9c6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ class RVIZ_COMMON_PUBLIC LineEditWithButton : public QLineEdit
protected:
virtual void resizeEvent(QResizeEvent * event);

/** @brief Send key events to mimic the "return" key being pressed and
* released. Useful ending an edit session and sending the data on
* out. */
void simulateReturnPressed();

protected Q_SLOTS:
/** @brief Override this to do something when the button is clicked. */
virtual void onButtonClick() {}
Expand Down
16 changes: 0 additions & 16 deletions rviz_common/src/rviz_common/properties/line_edit_with_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,5 @@ void LineEditWithButton::resizeEvent(QResizeEvent * event)
width() - button_width - padding, padding,
button_width, button_height);
}

void LineEditWithButton::simulateReturnPressed()
{
// I couldn't find a way to directly tell the editor that I was
// done with it here. "Q_EMIT returnPressed()", "Q_EMIT
// editingFinished()" etc did nothing. So instead, here I
// simulate the user pressing and releasing the "Return" key,
// which does indeed make it act like I want: when you select a
// topic from the dialog and the dialog closes, the property's
// Setter is called and this editor closes.
QKeyEvent * event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
QApplication::postEvent(this, event);
event = new QKeyEvent(QEvent::KeyRelease, Qt::Key_Return, Qt::NoModifier);
QApplication::postEvent(this, event);
}

} // namespace properties
} // namespace rviz_common

0 comments on commit 384d9c6

Please sign in to comment.