mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 21:05:34 +08:00
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:
@@ -236,7 +236,8 @@ namespace BlackMisc
|
||||
/*
|
||||
* Frequency
|
||||
*/
|
||||
void CAtcStation::setFrequency(const CFrequency &frequency) {
|
||||
void CAtcStation::setFrequency(const CFrequency &frequency)
|
||||
{
|
||||
this->m_frequency = frequency;
|
||||
this->m_frequency.setUnit(CFrequencyUnit::MHz());
|
||||
}
|
||||
@@ -318,6 +319,8 @@ namespace BlackMisc
|
||||
return QVariant(this->m_callsign.asString());
|
||||
case IndexCallsignAsStringAsSet:
|
||||
return QVariant(this->m_callsign.getStringAsSet());
|
||||
case IndexCallsignIcon:
|
||||
return QVariant(this->m_callsign.toIcon());
|
||||
case IndexController:
|
||||
return this->m_controller.toQVariant();
|
||||
case IndexControllerRealName:
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace BlackMisc
|
||||
IndexCallsign = 0,
|
||||
IndexCallsignAsString,
|
||||
IndexCallsignAsStringAsSet,
|
||||
IndexCallsignIcon,
|
||||
IndexController,
|
||||
IndexControllerRealName,
|
||||
IndexControllerId,
|
||||
|
||||
@@ -222,6 +222,13 @@ int BlackMisc:: compareQVariants(const QVariant &v1, const QVariant &v2)
|
||||
if (t1 == t2) return 0;
|
||||
return t1 < t2 ? -1 : 1;
|
||||
}
|
||||
case QMetaType::QPixmap:
|
||||
{
|
||||
QPixmap p1 = v1.value<QPixmap>();
|
||||
QPixmap p2 = v2.value<QPixmap>();
|
||||
if (p1.width() == p2.width()) return 0;
|
||||
return p1.width() < p2.width() ? -1 : 1;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user