Make enum DataMeaning an enum class
This commit is contained in:
parent
dc97fa63e1
commit
db2594a87c
6 changed files with 11 additions and 11 deletions
|
|
@ -14,9 +14,9 @@ enum class ReferencedType {
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
enum DataMeaning {
|
enum class DataMeaning {
|
||||||
DataMeaningNormal,
|
Normal,
|
||||||
DataMeaningBytes ///< the value represents bytes pretty print in KiB, MiB, GiB, TiB, PiB, EiB
|
Bytes ///< the value represents bytes pretty print in KiB, MiB, GiB, TiB, PiB, EiB
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CustomDataRole {
|
enum CustomDataRole {
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,5 @@ QVariant BaseTableModel::data(const QModelIndex &index, int role) const
|
||||||
|
|
||||||
QVariant BaseTableModel::getDataMeaning(const QModelIndex &) const
|
QVariant BaseTableModel::getDataMeaning(const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return static_cast<int>(DataMeaningNormal);
|
return static_cast<int>(DataMeaning::Normal);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ QVariant DatabasesTableModel::getDataMeaning(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.column() == SizeCol)
|
if (index.column() == SizeCol)
|
||||||
{
|
{
|
||||||
return static_cast<int>(DataMeaningBytes);
|
return static_cast<int>(DataMeaning::Bytes);
|
||||||
}
|
}
|
||||||
return BaseTableModel::getDataMeaning(index);
|
return BaseTableModel::getDataMeaning(index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,9 +133,9 @@ QVariant IndexModel::data(const QModelIndex &index, int role) const
|
||||||
else if (role == CustomDataMeaningRole) {
|
else if (role == CustomDataMeaningRole) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case SizeCol:
|
case SizeCol:
|
||||||
return static_cast<int>(DataMeaningBytes);
|
return static_cast<int>(DataMeaning::Bytes);
|
||||||
default:
|
default:
|
||||||
return static_cast<int>(DataMeaningNormal);
|
return static_cast<int>(DataMeaning::Normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
|
|
||||||
|
|
@ -200,9 +200,9 @@ QVariant TablesTableModel::data(const QModelIndex &index, int role) const
|
||||||
case TableSizeCol:
|
case TableSizeCol:
|
||||||
case IndexSizeCol:
|
case IndexSizeCol:
|
||||||
case ToastSizeCol:
|
case ToastSizeCol:
|
||||||
return static_cast<int>(DataMeaningBytes);
|
return static_cast<int>(DataMeaning::Bytes);
|
||||||
default:
|
default:
|
||||||
return static_cast<int>(DataMeaningNormal);
|
return static_cast<int>(DataMeaning::Normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ void PgLabItemDelegate::initStyleOption(QStyleOptionViewItem *option,
|
||||||
value = index.data(CustomDataMeaningRole);
|
value = index.data(CustomDataMeaningRole);
|
||||||
DataMeaning meaning = value.isValid()
|
DataMeaning meaning = value.isValid()
|
||||||
? static_cast<DataMeaning>(value.toInt())
|
? static_cast<DataMeaning>(value.toInt())
|
||||||
: DataMeaningNormal;
|
: DataMeaning::Normal;
|
||||||
|
|
||||||
value = index.data(Qt::DisplayRole);
|
value = index.data(Qt::DisplayRole);
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ void PgLabItemDelegate::initStyleOption(QStyleOptionViewItem *option,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
forground_color = GetDefaultColorForType(oid);
|
forground_color = GetDefaultColorForType(oid);
|
||||||
if (meaning == DataMeaningBytes) {
|
if (meaning == DataMeaning::Bytes) {
|
||||||
QString suffix;
|
QString suffix;
|
||||||
auto s = value.toLongLong();
|
auto s = value.toLongLong();
|
||||||
double val;
|
double val;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue