Skip to content
Permalink
Browse files

Fix initial positioning of floating widgets

  • Loading branch information
nyalldawson authored and 3nids committed Jan 16, 2018
1 parent df90fef commit 05c71325182fe07675020929f3f3eae94e4c7512
Showing with 10 additions and 1 deletion.
  1. +2 −0 python/gui/qgsfloatingwidget.sip
  2. +7 −1 src/gui/qgsfloatingwidget.cpp
  3. +1 −0 src/gui/qgsfloatingwidget.h
@@ -120,6 +120,8 @@ Emitted when the anchor widget point changes

virtual void paintEvent( QPaintEvent *e );

virtual void resizeEvent( QResizeEvent *e );


};

@@ -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 )
@@ -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() )
@@ -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:

0 comments on commit 05c7132

Please sign in to comment.
You can’t perform that action at this time.