mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
refs #849, new column formatter for integer
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ad0ef16ba5
commit
cb1e213c64
@@ -408,5 +408,10 @@ namespace BlackGui
|
|||||||
if (!rgbColor.isValid()) { return ""; }
|
if (!rgbColor.isValid()) { return ""; }
|
||||||
return rgbColor.hex(true);
|
return rgbColor.hex(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CVariant CIntegerFormatter::displayRole(const CVariant &expectedInteger) const
|
||||||
|
{
|
||||||
|
return QString::number(expectedInteger.toInt());
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -279,6 +279,17 @@ namespace BlackGui
|
|||||||
QString m_formatString = "yyyy-MM-dd HH:mm"; //!< how the value is displayed
|
QString m_formatString = "yyyy-MM-dd HH:mm"; //!< how the value is displayed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Formatter when column contains an integer
|
||||||
|
class CIntegerFormatter : public CDefaultFormatter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CIntegerFormatter(int alignment = alignRightVCenter()) : CDefaultFormatter(alignment, false) {}
|
||||||
|
|
||||||
|
//! \copydoc CDefaultFormatter::displayRole
|
||||||
|
virtual BlackMisc::CVariant displayRole(const BlackMisc::CVariant &expectedInteger) const override;
|
||||||
|
};
|
||||||
|
|
||||||
//! Formatter when column contains an altitude
|
//! Formatter when column contains an altitude
|
||||||
class CAltitudeFormatter : public CDefaultFormatter
|
class CAltitudeFormatter : public CDefaultFormatter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -97,6 +97,11 @@ namespace BlackGui
|
|||||||
return CColumn("#", "order", propertyIndex, new CStringFormatter(alignment));
|
return CColumn("#", "order", propertyIndex, new CStringFormatter(alignment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CColumn CColumn::standardInteger(const QString &headerName, const QString &toolTip, const CPropertyIndex &propertyIndex, int alignment)
|
||||||
|
{
|
||||||
|
return CColumn(headerName, toolTip, propertyIndex, new CIntegerFormatter(alignment));
|
||||||
|
}
|
||||||
|
|
||||||
// --------------- columns ----------------------------------------------
|
// --------------- columns ----------------------------------------------
|
||||||
|
|
||||||
CColumns::CColumns(const QString &translationContext, QObject *parent) :
|
CColumns::CColumns(const QString &translationContext, QObject *parent) :
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ namespace BlackGui
|
|||||||
//! Get a standard string object formatted column
|
//! Get a standard string object formatted column
|
||||||
static CColumn orderColumn(const BlackMisc::CPropertyIndex &propertyIndex = BlackMisc::CPropertyIndex::GlobalIndexIOrderable, int alignment = CDefaultFormatter::alignRightVCenter());
|
static CColumn orderColumn(const BlackMisc::CPropertyIndex &propertyIndex = BlackMisc::CPropertyIndex::GlobalIndexIOrderable, int alignment = CDefaultFormatter::alignRightVCenter());
|
||||||
|
|
||||||
|
//! Get a standard integer value formatted column
|
||||||
|
static CColumn standardInteger(const QString &headerName, const QString &toolTip, const BlackMisc::CPropertyIndex &propertyIndex, int alignment = CDefaultFormatter::alignRightVCenter());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_translationContext;
|
QString m_translationContext;
|
||||||
QString m_columnName;
|
QString m_columnName;
|
||||||
|
|||||||
Reference in New Issue
Block a user