From 5a0fe4d309166133c0bdd4ffd55e59398e2a0465 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 24 Jul 2014 18:39:34 +0200 Subject: [PATCH] Connect the selection model so the widgets are updated. --- .../plugins/tile_editor/tile_editor_main_window.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp index 2f3127c8e..dbd9d6407 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -96,10 +96,6 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) connect(m_ui->landEditTB, SIGNAL(clicked()), this, SLOT(onLandEdit())); connect(m_ui->landLW, SIGNAL(currentRowChanged(int)), this, SLOT(onLandRowChanged(int))); - connect(m_ui->tileSetLV->selectionModel(), - SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(changeActiveTileSet(const QModelIndex &, const QModelIndex &))); - // 128x128 List View //m_ui->listView128->setItemDelegate(m_tileItemDelegate); m_ui->listView128->addAction(m_ui->actionAddTile); @@ -427,6 +423,9 @@ void TileEditorMainWindow::onLandRowChanged( int row ) { if( row == -1 ) { + disconnect( m_ui->tileSetLV->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( changeActiveTileSet( const QModelIndex &, const QModelIndex & ) ) ); + m_ui->tileSetLV->setModel( NULL ); m_ui->listView128->setModel( NULL ); m_ui->listView256->setModel( NULL ); @@ -435,11 +434,17 @@ void TileEditorMainWindow::onLandRowChanged( int row ) } else { + //disconnect( m_ui->tileSetLV->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + // this, SLOT( changeActiveTileSet( const QModelIndex &, const QModelIndex & ) ) ); + m_ui->tileSetLV->setModel( m_tileModels[ row ] ); m_ui->listView128->setModel( m_tileModels[ row ] ); m_ui->listView256->setModel( m_tileModels[ row ] ); m_ui->listViewTransition->setModel( m_tileModels[ row ] ); m_ui->listViewDisplacement->setModel( m_tileModels[ row ] ); + + connect( m_ui->tileSetLV->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( changeActiveTileSet( const QModelIndex &, const QModelIndex & ) ) ); } m_ui->tileSetLV->reset();