Commit 0639d174 authored by ck's avatar ck

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
......@@ -84,7 +84,7 @@ void DependenciesModel::resetModel()
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
......@@ -94,6 +94,11 @@ int DependenciesModel::columnCount(const QModelIndex &index) 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());
switch (role) {
......@@ -135,6 +140,9 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value,
Qt::ItemFlags DependenciesModel::flags(const QModelIndex &index) const
{
if (m_projects.isEmpty())
return Qt::NoItemFlags;
Qt::ItemFlags rc = QAbstractListModel::flags(index);
if (index.column() == 0)
rc |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment