Skip to content

Commit 28f7098

Browse files
committed
rviz_plugin_tutorials: failed attempt to squarify the drive widget.
1 parent e664f7f commit 28f7098

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

rviz_plugin_tutorials/src/drive_widget.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ DriveWidget::DriveWidget( QWidget* parent )
4343
, linear_max_( 10 )
4444
, angular_max_( 2 )
4545
{
46+
QSizePolicy policy = sizePolicy();
47+
policy.setHeightForWidth( true );
48+
setSizePolicy( policy );
4649
}
4750

4851
void DriveWidget::paintEvent( QPaintEvent* event )

rviz_plugin_tutorials/src/drive_widget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Q_OBJECT
4747
virtual void leaveEvent( QEvent* event );
4848

4949
virtual QSize sizeHint() const { return QSize( 150, 150 ); }
50+
virtual int heightForWidth( int width ) const { return width; } // enforce square widget
5051

5152
Q_SIGNALS:
5253
void outputVelocity( float linear, float angular );

0 commit comments

Comments
 (0)