refs #264, QPixmap enable list model base to simplify columns with icons

* new constructor in column class
* removed overridden data method, no longer needed
* added icons for ATC station views
* QPixmap comparison for such columns (free functions)
This commit is contained in:
Klaus Basan
2014-06-10 02:05:44 +02:00
parent 9ea1fd86ef
commit 56430c860a
9 changed files with 59 additions and 34 deletions

View File

@@ -10,11 +10,18 @@
namespace BlackGui
{
CColumn::CColumn(const QString &headerName, int propertyIndex, int alignment, bool editable) :
m_columnName(headerName), m_alignment(alignment), m_propertyIndex(propertyIndex), m_editable(editable)
m_columnName(headerName), m_alignment(alignment), m_propertyIndex(propertyIndex),
m_editable(editable), m_icon(false)
{}
CColumn::CColumn(const QString &headerName, int propertyIndex, bool editable) :
m_columnName(headerName), m_alignment(-1), m_propertyIndex(propertyIndex), m_editable(editable)
m_columnName(headerName), m_alignment(-1), m_propertyIndex(propertyIndex),
m_editable(editable), m_icon(false)
{}
CColumn::CColumn(int propertyIndex, bool isIcon) :
m_alignment(-1), m_propertyIndex(propertyIndex),
m_editable(false), m_icon(isIcon)
{}
const char *CColumn::getTranslationContextChar() const
@@ -137,6 +144,15 @@ namespace BlackGui
return this->m_columns.at(index.column()).isEditable();
}
/*
* Is icon?
*/
bool CColumns::isIcon(const QModelIndex &index) const
{
if (index.column() < 0 || index.column() >= this->m_columns.size()) return false;
return this->m_columns.at(index.column()).isIcon();
}
/*
* Aligment as QVariant
*/