Skip to content

Commit

Permalink
Fix initial positioning of floating widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and 3nids committed Jan 16, 2018
1 parent df90fef commit 05c7132
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions python/gui/qgsfloatingwidget.sip
Expand Up @@ -120,6 +120,8 @@ Emitted when the anchor widget point changes

virtual void paintEvent( QPaintEvent *e );

virtual void resizeEvent( QResizeEvent *e );


};

Expand Down
8 changes: 7 additions & 1 deletion src/gui/qgsfloatingwidget.cpp
Expand Up @@ -85,8 +85,8 @@ void QgsFloatingWidget::setAnchorWidgetPoint( QgsFloatingWidget::AnchorPoint poi

void QgsFloatingWidget::showEvent( QShowEvent *e )
{
onAnchorPointChanged();
QWidget::showEvent( e );
onAnchorPointChanged();
}

void QgsFloatingWidget::paintEvent( QPaintEvent *e )
Expand All @@ -98,6 +98,12 @@ void QgsFloatingWidget::paintEvent( QPaintEvent *e )
style()->drawPrimitive( QStyle::PE_Widget, &opt, &p, this );
}

void QgsFloatingWidget::resizeEvent( QResizeEvent *e )
{
QWidget::resizeEvent( e );
onAnchorPointChanged();
}

void QgsFloatingWidget::onAnchorPointChanged()
{
if ( !parentWidget() )
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsfloatingwidget.h
Expand Up @@ -120,6 +120,7 @@ class GUI_EXPORT QgsFloatingWidget: public QWidget
protected:
void showEvent( QShowEvent *e ) override;
void paintEvent( QPaintEvent *e ) override;
void resizeEvent( QResizeEvent *e ) override;

private slots:

Expand Down

0 comments on commit 05c7132

Please sign in to comment.