mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-13 10:49:05 +00:00
No need to store the loaded image data after passing it to the label.
This commit is contained in:
parent
249c082e9f
commit
7574fe4c26
2 changed files with 4 additions and 9 deletions
|
@ -12,13 +12,10 @@ QDialog( parent )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
setupConnections();
|
setupConnections();
|
||||||
data = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureChooser::~TextureChooser()
|
TextureChooser::~TextureChooser()
|
||||||
{
|
{
|
||||||
delete data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,10 +58,7 @@ void TextureChooser::onCurrentRowChanged( int row )
|
||||||
|
|
||||||
uint32 size = bm.getSize() * ( 32 / 8 ); // should be depth, but CBitmap always uses 32 bit to store the image
|
uint32 size = bm.getSize() * ( 32 / 8 ); // should be depth, but CBitmap always uses 32 bit to store the image
|
||||||
|
|
||||||
if( data != NULL )
|
uint8 *data = new uint8[ size ];
|
||||||
delete data;
|
|
||||||
|
|
||||||
data = new uint8[ size ];
|
|
||||||
bm.getData( data );
|
bm.getData( data );
|
||||||
|
|
||||||
/// Convert from ABGR to ARGB
|
/// Convert from ABGR to ARGB
|
||||||
|
@ -86,6 +80,9 @@ void TextureChooser::onCurrentRowChanged( int row )
|
||||||
QImage img( data, bm.getWidth(), bm.getHeight(), QImage::Format_ARGB32 );
|
QImage img( data, bm.getWidth(), bm.getHeight(), QImage::Format_ARGB32 );
|
||||||
label->setPixmap( QPixmap::fromImage( img ) );
|
label->setPixmap( QPixmap::fromImage( img ) );
|
||||||
|
|
||||||
|
delete data;
|
||||||
|
data = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@ private Q_SLOTS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
|
|
||||||
unsigned char *data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue