|
|
|
@ -24,22 +24,22 @@
|
|
|
|
|
// Initialize the static members
|
|
|
|
|
TileModel::TTileZoomFactor TileModel::CurrentZoomFactor;
|
|
|
|
|
|
|
|
|
|
TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
|
|
|
|
|
{
|
|
|
|
|
QVector<QVariant> rootData;
|
|
|
|
|
Q_FOREACH(QString header, headers)
|
|
|
|
|
rootData << header;
|
|
|
|
|
|
|
|
|
|
rootItem = new Node(rootData);
|
|
|
|
|
|
|
|
|
|
TileModel::CurrentZoomFactor = TileModel::TileZoom100;
|
|
|
|
|
m_indexDisplay = true;
|
|
|
|
|
m_fileDisplay = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TileModel::~TileModel()
|
|
|
|
|
{
|
|
|
|
|
delete rootItem;
|
|
|
|
|
TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
|
|
|
|
|
{
|
|
|
|
|
QVector<QVariant> rootData;
|
|
|
|
|
Q_FOREACH(QString header, headers)
|
|
|
|
|
rootData << header;
|
|
|
|
|
|
|
|
|
|
rootItem = new Node(rootData);
|
|
|
|
|
|
|
|
|
|
TileModel::CurrentZoomFactor = TileModel::TileZoom100;
|
|
|
|
|
m_indexDisplay = true;
|
|
|
|
|
m_fileDisplay = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TileModel::~TileModel()
|
|
|
|
|
{
|
|
|
|
|
delete rootItem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Node *TileModel::getItem(const QModelIndex &index) const
|
|
|
|
@ -92,33 +92,33 @@ int TileModel::columnCount(const QModelIndex &parent) const
|
|
|
|
|
return parentItem->columnCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant TileModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
{
|
|
|
|
|
if(!index.isValid())
|
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
|
|
Node *item = static_cast<Node*>(index.internalPointer());
|
|
|
|
|
|
|
|
|
|
// Translate the display role to the settings-specific role.
|
|
|
|
|
|
|
|
|
|
if(role == Qt::DisplayRole)
|
|
|
|
|
{
|
|
|
|
|
if(m_indexDisplay && m_fileDisplay)
|
|
|
|
|
role = TileFilenameIndexRole;
|
|
|
|
|
else if(m_fileDisplay)
|
|
|
|
|
role = TileFilenameRole;
|
|
|
|
|
else if(m_indexDisplay)
|
|
|
|
|
role = TileIndexRole;
|
|
|
|
|
}
|
|
|
|
|
return item->data(index.column(), role);
|
|
|
|
|
QVariant TileModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
{
|
|
|
|
|
if(!index.isValid())
|
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
|
|
Node *item = static_cast<Node*>(index.internalPointer());
|
|
|
|
|
|
|
|
|
|
// Translate the display role to the settings-specific role.
|
|
|
|
|
|
|
|
|
|
if(role == Qt::DisplayRole)
|
|
|
|
|
{
|
|
|
|
|
if(m_indexDisplay && m_fileDisplay)
|
|
|
|
|
role = TileFilenameIndexRole;
|
|
|
|
|
else if(m_fileDisplay)
|
|
|
|
|
role = TileFilenameRole;
|
|
|
|
|
else if(m_indexDisplay)
|
|
|
|
|
role = TileIndexRole;
|
|
|
|
|
}
|
|
|
|
|
return item->data(index.column(), role);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
|
|
|
|
|
{
|
|
|
|
|
if(!index.isValid())
|
|
|
|
|
return Qt::ItemIsEnabled;
|
|
|
|
|
|
|
|
|
|
return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
|
|
|
|
|
Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
|
|
|
|
|
{
|
|
|
|
|
if(!index.isValid())
|
|
|
|
|
return Qt::ItemIsEnabled;
|
|
|
|
|
|
|
|
|
|
return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant TileModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|
|
|
|