Skip to content
Permalink
Browse files
fix disabling buttons
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 12, 2022
1 parent 33f070f commit 6fc734c64f779997ce79c4ef7f8ad9b9863568d5
Showing with 11 additions and 4 deletions.
  1. +10 −3 src/app/3d/qgs3dviewsmanagerdialog.cpp
  2. +1 −1 src/app/3d/qgs3dviewsmanagerdialog.h
@@ -44,9 +44,11 @@ Qgs3DViewsManagerDialog::Qgs3DViewsManagerDialog( QWidget *parent, Qt::WindowFla
mShowButton->setEnabled( false );
mHideButton->setEnabled( false );

connect( m3DViewsListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &Qgs3DViewsManagerDialog::showHideButtonStateChanged );
connect( m3DViewsListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &Qgs3DViewsManagerDialog::currentChanged );

connect( QgsProject::instance()->views3DManager(), &Qgs3DViewsManager::viewsListChanged, this, &Qgs3DViewsManagerDialog::onViewsListChanged );
m3DViewsListView->selectionModel()->setCurrentIndex( m3DViewsListView->model()->index( 0, 0 ), QItemSelectionModel::Select );
currentChanged( m3DViewsListView->selectionModel()->currentIndex(), m3DViewsListView->selectionModel()->currentIndex() );
}

void Qgs3DViewsManagerDialog::onViewsListChanged()
@@ -73,7 +75,7 @@ void Qgs3DViewsManagerDialog::showClicked()
widget->show();
QgsProject::instance()->setDirty();
}

currentChanged( m3DViewsListView->selectionModel()->currentIndex(), m3DViewsListView->selectionModel()->currentIndex() );
}

void Qgs3DViewsManagerDialog::hideClicked()
@@ -90,6 +92,7 @@ void Qgs3DViewsManagerDialog::hideClicked()
}

QgsProject::instance()->setDirty();
currentChanged( m3DViewsListView->selectionModel()->currentIndex(), m3DViewsListView->selectionModel()->currentIndex() );
}

void Qgs3DViewsManagerDialog::duplicateClicked()
@@ -148,9 +151,13 @@ void Qgs3DViewsManagerDialog::renameClicked()
QgsProject::instance()->setDirty();
}

void Qgs3DViewsManagerDialog::showHideButtonStateChanged( const QModelIndex &current, const QModelIndex &previous )
void Qgs3DViewsManagerDialog::currentChanged( const QModelIndex &current, const QModelIndex &previous )
{
Q_UNUSED( previous );

mRenameButton->setEnabled( current.isValid() );
mRemoveButton->setEnabled( current.isValid() );
mDuplicateButton->setEnabled( current.isValid() );
if ( !current.isValid() )
{
mShowButton->setEnabled( false );
@@ -40,7 +40,7 @@ class Qgs3DViewsManagerDialog : public QDialog, private Ui::Qgs3DViewsManagerDia
void removeClicked();
void renameClicked();

void showHideButtonStateChanged( const QModelIndex &current, const QModelIndex &previous );
void currentChanged( const QModelIndex &current, const QModelIndex &previous );

void onViewsListChanged();
private:

0 comments on commit 6fc734c

Please sign in to comment.