Commit 47054eaf authored by Dirk Wilden's avatar Dirk Wilden
Browse files

automatically hightlight active texture in dialog

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8395 383ad7c9-94d9-4d36-a494-682f7c89f535
parent aa042332
...@@ -99,13 +99,24 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name ...@@ -99,13 +99,24 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name
textureList->clear(); textureList->clear();
QTreeWidgetItem* activeItem = 0;
for (uint i=0; i < texData_->textures().size(); i++) for (uint i=0; i < texData_->textures().size(); i++)
if ( ! texData_->textures()[i].hidden() ) { if ( ! texData_->textures()[i].hidden() ) {
if ( texData_->textures()[i].type() != MULTITEXTURE ) { if ( texData_->textures()[i].type() != MULTITEXTURE ) {
QTreeWidgetItem* item = 0;
if ( !texData_->textures()[i].visibleName().isEmpty() ) if ( !texData_->textures()[i].visibleName().isEmpty() )
textureList->addTopLevelItem( new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].visibleName() ) ) ); item = new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].visibleName() ) );
else else
textureList->addTopLevelItem( new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].name() ) ) ); item = new QTreeWidgetItem((QTreeWidget*)0, QStringList( texData_->textures()[i].name() ) );
textureList->addTopLevelItem( item );
if (texData_->textures()[i].enabled())
activeItem = item;
} else { } else {
QTreeWidgetItem* parent = 0; QTreeWidgetItem* parent = 0;
if ( !texData_->textures()[i].visibleName().isEmpty() ) if ( !texData_->textures()[i].visibleName().isEmpty() )
...@@ -116,6 +127,9 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name ...@@ -116,6 +127,9 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name
textureList->addTopLevelItem( parent ) ; textureList->addTopLevelItem( parent ) ;
for ( int j = 0 ; j < texData_->textures()[i].multiTextureList.size() ; ++j ) for ( int j = 0 ; j < texData_->textures()[i].multiTextureList.size() ; ++j )
textureList->addTopLevelItem( new QTreeWidgetItem(parent, QStringList(texData_->textures()[i].multiTextureList[j] )) ); textureList->addTopLevelItem( new QTreeWidgetItem(parent, QStringList(texData_->textures()[i].multiTextureList[j] )) );
if (texData_->textures()[i].enabled())
activeItem = parent;
} }
} }
...@@ -133,9 +147,16 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name ...@@ -133,9 +147,16 @@ void texturePropertiesWidget::show(TextureData* _texData, int _id, QString _name
propChanged_ = false; propChanged_ = false;
if (activeItem == 0){
textureList->setCurrentItem( textureList->topLevelItem(0) ); textureList->setCurrentItem( textureList->topLevelItem(0) );
textureChanged( textureList->topLevelItem(0), 0 ); textureChanged( textureList->topLevelItem(0), 0 );
} else {
textureList->setCurrentItem( activeItem );
textureChanged( activeItem, 0 );
}
QDialog::show(); QDialog::show();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment