Skip to content

Commit

Permalink
Switch to currentChanged signal
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Sep 20, 2023
1 parent 2da2eed commit 5ede226
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions avogadro/qtplugins/insertfragment/insertfragmentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ InsertFragmentDialog::InsertFragmentDialog(QWidget* aParent, QString directory,
connect(m_ui->filterLineEdit, SIGNAL(textChanged(const QString&)), this,
SLOT(filterTextChanged(const QString&)));

connect(m_ui->directoryTreeView, SIGNAL(clicked(const QModelIndex&)), this,
SLOT(clicked(const QModelIndex&)));
connect(m_ui->directoryTreeView->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex &)), this,
SLOT(currentChanged(const QModelIndex&, const QModelIndex &)));
}

InsertFragmentDialog::~InsertFragmentDialog()
Expand All @@ -181,8 +181,9 @@ QString InsertFragmentDialog::fileName()
return selected.first().data(QFileSystemModel::FilePathRole).toString();
}

void InsertFragmentDialog::clicked(const QModelIndex& selected)
void InsertFragmentDialog::currentChanged(const QModelIndex& selected, const QModelIndex& deselected)
{
Q_UNUSED(deselected)
if (m_implementation == nullptr || m_implementation->model == nullptr)
return;

Expand Down
3 changes: 2 additions & 1 deletion avogadro/qtplugins/insertfragment/insertfragmentdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public Q_SLOTS:

void activated();

void clicked(const QModelIndex& selected);
void currentChanged(const QModelIndex& selected,
const QModelIndex& deselected);

Q_SIGNALS:
void performInsert(const QString& fileName, bool crystal);
Expand Down

0 comments on commit 5ede226

Please sign in to comment.