trigger updates on eometry changes (

https://github.com/uwerat/qskinny/issues/379 )
This commit is contained in:
Uwe Rathmann 2024-02-01 11:24:12 +01:00
parent 2e34bfd4c6
commit 9117ccce1d
2 changed files with 22 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include "QskGraphicProvider.h" #include "QskGraphicProvider.h"
#include "QskSkinManager.h" #include "QskSkinManager.h"
#include "QskSkin.h" #include "QskSkin.h"
#include "QskEvent.h"
QSK_SUBCONTROL( QskGraphicLabel, Panel ) QSK_SUBCONTROL( QskGraphicLabel, Panel )
QSK_SUBCONTROL( QskGraphicLabel, Graphic ) QSK_SUBCONTROL( QskGraphicLabel, Graphic )
@ -305,6 +306,25 @@ QSizeF QskGraphicLabel::effectiveSourceSize() const
return sz; return sz;
} }
void QskGraphicLabel::geometryChangeEvent( QskGeometryChangeEvent* event )
{
/*
textures will finally be scaled into a target rectangle in integer
coordinates. This rectangle might have a different size - depending
on how its coordinates are rounded ( ceiled/floored ) - even if
the site in floating point coordinates is the same.
So we always trigger updates - even for translations.
Note that an update triggers the checks, that are needed to decide if
the texture needs to be recreated - it does not necessarily
result in actually doing it.
*/
update();
Inherited::geometryChangeEvent( event );
}
void QskGraphicLabel::changeEvent( QEvent* event ) void QskGraphicLabel::changeEvent( QEvent* event )
{ {
if ( event->type() == QEvent::StyleChange ) if ( event->type() == QEvent::StyleChange )

View File

@ -105,7 +105,9 @@ class QSK_EXPORT QskGraphicLabel : public QskControl
void setGraphic( const QskGraphic& ); void setGraphic( const QskGraphic& );
protected: protected:
void geometryChangeEvent( QskGeometryChangeEvent* ) override;
void changeEvent( QEvent* ) override; void changeEvent( QEvent* ) override;
void updateResources() override; void updateResources() override;
virtual QskGraphic loadSource( const QUrl& ) const; virtual QskGraphic loadSource( const QUrl& ) const;