mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-29 11:50:56 +00:00
A little refactoring.
This commit is contained in:
parent
dd193e3d51
commit
93fa8d3e3b
2 changed files with 21 additions and 13 deletions
|
@ -573,13 +573,7 @@ void TileEditorMainWindow::onActionAddTile(int tabId)
|
||||||
|
|
||||||
QModelIndex rootIdx = model->index( tabId, 0, m_ui->tileSetLV->currentIndex());
|
QModelIndex rootIdx = model->index( tabId, 0, m_ui->tileSetLV->currentIndex());
|
||||||
|
|
||||||
QListView *lv = NULL;
|
QListView *lv = getListViewByTab( tabId );
|
||||||
|
|
||||||
switch( tabId )
|
|
||||||
{
|
|
||||||
case TAB_128: lv = m_ui->listView128; break;
|
|
||||||
case TAB_256: lv = m_ui->listView256; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lv->reset();
|
lv->reset();
|
||||||
lv->setRootIndex( rootIdx );
|
lv->setRootIndex( rootIdx );
|
||||||
|
@ -588,12 +582,7 @@ void TileEditorMainWindow::onActionAddTile(int tabId)
|
||||||
|
|
||||||
void TileEditorMainWindow::onActionDeleteTile( int tabId )
|
void TileEditorMainWindow::onActionDeleteTile( int tabId )
|
||||||
{
|
{
|
||||||
QListView *lv = NULL;
|
QListView *lv = getListViewByTab( tabId );
|
||||||
switch( tabId )
|
|
||||||
{
|
|
||||||
case TAB_128: lv = m_ui->listView128; break;
|
|
||||||
case TAB_256: lv = m_ui->listView256; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex idx = lv->currentIndex();
|
QModelIndex idx = lv->currentIndex();
|
||||||
if( !idx.isValid() )
|
if( !idx.isValid() )
|
||||||
|
@ -671,3 +660,21 @@ void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, cons
|
||||||
//m_ui->listViewTransition->reset();
|
//m_ui->listViewTransition->reset();
|
||||||
//m_ui->listViewDisplacement->reset();
|
//m_ui->listViewDisplacement->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QListView* TileEditorMainWindow::getListViewByTab( int tab ) const
|
||||||
|
{
|
||||||
|
QListView *lv = NULL;
|
||||||
|
|
||||||
|
switch( tab )
|
||||||
|
{
|
||||||
|
case TAB_128: lv = m_ui->listView128; break;
|
||||||
|
case TAB_256: lv = m_ui->listView256; break;
|
||||||
|
case TAB_TRANSITION: lv = m_ui->listViewTransition; break;
|
||||||
|
case TAB_DISPLACEMENT: lv = m_ui->listViewDisplacement; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ private:
|
||||||
void onActionAddTile(int tabId);
|
void onActionAddTile(int tabId);
|
||||||
void onActionDeleteTile(int tabId);
|
void onActionDeleteTile(int tabId);
|
||||||
TileModel* createTileModel();
|
TileModel* createTileModel();
|
||||||
|
QListView* getListViewByTab( int tab ) const;
|
||||||
|
|
||||||
Ui::TileEditorMainWindow *m_ui;
|
Ui::TileEditorMainWindow *m_ui;
|
||||||
QUndoStack *m_undoStack;
|
QUndoStack *m_undoStack;
|
||||||
|
|
Loading…
Reference in a new issue