Skip to content
Snippets Groups Projects
Commit 0639d174 authored by ck's avatar ck
Browse files

Clarify the meaning of an empty dependencies view.

When there is only one project in a session, it is now more obvious
that the dependency view is supposed to show other projects from
the session.

Reviewed-by: con
parent 0274828b
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ void DependenciesModel::resetModel() ...@@ -84,7 +84,7 @@ void DependenciesModel::resetModel()
int DependenciesModel::rowCount(const QModelIndex &index) const int DependenciesModel::rowCount(const QModelIndex &index) const
{ {
return index.isValid() ? 0 : m_projects.size(); return index.isValid() ? 0 : m_projects.isEmpty() ? 1 : m_projects.size();
} }
int DependenciesModel::columnCount(const QModelIndex &index) const int DependenciesModel::columnCount(const QModelIndex &index) const
...@@ -94,6 +94,11 @@ int DependenciesModel::columnCount(const QModelIndex &index) const ...@@ -94,6 +94,11 @@ int DependenciesModel::columnCount(const QModelIndex &index) const
QVariant DependenciesModel::data(const QModelIndex &index, int role) const QVariant DependenciesModel::data(const QModelIndex &index, int role) const
{ {
if (m_projects.isEmpty())
return role == Qt::DisplayRole
? tr("<No other projects in this session>")
: QVariant();
const Project *p = m_projects.at(index.row()); const Project *p = m_projects.at(index.row());
switch (role) { switch (role) {
...@@ -135,6 +140,9 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value, ...@@ -135,6 +140,9 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value,
Qt::ItemFlags DependenciesModel::flags(const QModelIndex &index) const Qt::ItemFlags DependenciesModel::flags(const QModelIndex &index) const
{ {
if (m_projects.isEmpty())
return Qt::NoItemFlags;
Qt::ItemFlags rc = QAbstractListModel::flags(index); Qt::ItemFlags rc = QAbstractListModel::flags(index);
if (index.column() == 0) if (index.column() == 0)
rc |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable; rc |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment