Implemented tile image replace.
This commit is contained in:
parent
2f6faf05c1
commit
aef9f58242
2 changed files with 26 additions and 0 deletions
|
@ -220,6 +220,7 @@ void TileEditorMainWindow::onActionDeleteTile(bool triggered)
|
|||
|
||||
void TileEditorMainWindow::onActionReplaceImage(bool triggered)
|
||||
{
|
||||
onActionReplaceImage(m_ui->tileViewTabWidget->currentIndex());
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onActionDeleteImage(bool triggered)
|
||||
|
@ -619,6 +620,30 @@ void TileEditorMainWindow::onActionDeleteImage( int tabId )
|
|||
n->setTileFilename( TileModel::TileDiffuse, "" );
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onActionReplaceImage( int tabId )
|
||||
{
|
||||
QListView *lv = getListViewByTab( tabId );
|
||||
|
||||
QModelIndex idx = lv->currentIndex();
|
||||
if( !idx.isValid() )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "Replacing tile image" ),
|
||||
tr( "No tile selected!" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName( this,
|
||||
tr( "Select tile image" ),
|
||||
"",
|
||||
tr( "PNG files (*.png)" ) );
|
||||
if( fileName.isEmpty() )
|
||||
return;
|
||||
|
||||
TileItemNode *n = reinterpret_cast< TileItemNode* >( idx.internalPointer() );
|
||||
n->setTileFilename( TileModel::TileDiffuse, fileName );
|
||||
}
|
||||
|
||||
TileModel* TileEditorMainWindow::createTileModel()
|
||||
{
|
||||
QStringList headers;
|
||||
|
|
|
@ -71,6 +71,7 @@ private:
|
|||
void onActionAddTile(int tabId);
|
||||
void onActionDeleteTile(int tabId);
|
||||
void onActionDeleteImage(int tabId);
|
||||
void onActionReplaceImage(int tabId);
|
||||
|
||||
|
||||
TileModel* createTileModel();
|
||||
|
|
Loading…
Reference in a new issue