mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Support for an empty column
This commit is contained in:
@@ -73,6 +73,13 @@ namespace BlackGui
|
||||
return CColumn(headerName, toolTip, propertyIndex, new CIntegerFormatter(alignment));
|
||||
}
|
||||
|
||||
CColumn CColumn::emptyColumn()
|
||||
{
|
||||
CColumn col = CColumn("", "", CPropertyIndex::GlobalIndexEmpty, new CEmptyFormatter());
|
||||
col.setWidthPercentage(1);
|
||||
return col;
|
||||
}
|
||||
|
||||
// --------------- columns ----------------------------------------------
|
||||
|
||||
CColumns::CColumns(const QString &translationContext, QObject *parent) :
|
||||
@@ -236,6 +243,19 @@ namespace BlackGui
|
||||
return widths;
|
||||
}
|
||||
|
||||
void CColumns::insertEmptyColumn()
|
||||
{
|
||||
if (this->endsWithEmptyColumn()) { return; }
|
||||
this->addColumn(CColumn::emptyColumn());
|
||||
}
|
||||
|
||||
bool CColumns::endsWithEmptyColumn() const
|
||||
{
|
||||
if (m_columns.isEmpty()) { return false; }
|
||||
const CColumn c = m_columns.last();
|
||||
return c.getPropertyIndex() == CPropertyIndex::GlobalIndexEmpty;
|
||||
}
|
||||
|
||||
const CDefaultFormatter *CColumns::getFormatter(const QModelIndex &index) const
|
||||
{
|
||||
if (!isValidColumn(index)) { return nullptr; }
|
||||
|
||||
Reference in New Issue
Block a user