Issue #77 toIcon returns a simple enum instead of a full object

This commit is contained in:
Mat Sutcliffe
2020-10-26 22:55:10 +00:00
parent 59bbac9a1f
commit b1185eb541
61 changed files with 157 additions and 171 deletions

View File

@@ -76,7 +76,7 @@ namespace BlackGui
QPushButton *button = new QPushButton(this);
button->setText(station.getCallsignAsString());
if (m_withIcons) { button->setIcon(station.toPixmap()); }
if (m_withIcons) { button->setIcon(CIcon(station.toIcon()).toQIcon()); }
QObject::connect(button, &QPushButton::released, this, &CAtcButtonComponent::onButtonClicked);
const CVariant atcv = CVariant::fromValue(station);
layout->addWidget(button, row, col++);

View File

@@ -72,7 +72,7 @@ namespace BlackGui
else
{
ui->le_Color->setText(color.hex());
ui->lbl_ColorIcon->setPixmap(color.toPixmap());
ui->lbl_ColorIcon->setPixmap(CIcon(color.toIcon()));
m_lastColor = color;
}
emit colorChanged(color);
@@ -176,7 +176,7 @@ namespace BlackGui
mimeData->setColorData(QVariant::fromValue(c.toQColor()));
drag->setMimeData(mimeData);
drag->setPixmap(c.toPixmap());
drag->setPixmap(CIcon(c.toIcon()));
Qt::DropAction dropAction = drag->exec(Qt::CopyAction);
Q_UNUSED(dropAction);

View File

@@ -62,7 +62,7 @@ namespace BlackGui
{
ui->le_CountryIso->setText(country.getIsoCode());
ui->le_CountryName->setText(country.getName());
ui->lbl_CountryIcon->setPixmap(country.toPixmap());
ui->lbl_CountryIcon->setPixmap(CIcon(country.toIcon()));
if (country != m_currentCountry)
{
m_currentCountry = country;

View File

@@ -99,7 +99,7 @@ namespace BlackGui
}
else
{
this->addItem(country.toPixmap(), d);
this->addItem(CIcon(country.toIcon()).toPixmap(), d);
}
}
else

View File

@@ -40,7 +40,7 @@ namespace BlackGui
void CStatusMessageForm::setValue(const CStatusMessage &message)
{
ui->te_Message->setPlainText(message.getMessage());
ui->lbl_SeverityIcon->setPixmap(message.toPixmap());
ui->lbl_SeverityIcon->setPixmap(CIcon(message.toIcon()));
const QString hrc(message.getHumanReadablePattern());
if (hrc.isEmpty())
{

View File

@@ -38,7 +38,7 @@ namespace BlackGui
void CStatusMessageFormSmall::setValue(const CStatusMessage &message)
{
ui->te_Message->setPlainText(message.getMessage());
ui->lbl_SeverityIcon->setPixmap(message.toPixmap());
ui->lbl_SeverityIcon->setPixmap(CIcon(message.toIcon()));
ui->le_Categories->setText(message.getHumanOrTechnicalCategoriesAsString());
ui->le_Severity->setText(message.getSeverityAsString());
ui->le_Timestamp->setText(message.getFormattedUtcTimestampYmdhms());

View File

@@ -491,7 +491,7 @@ namespace BlackGui
if (supervisor)
{
//! \fixme hardcoded stylesheet color
bar->setTabIcon(index, callsign.toPixmap());
bar->setTabIcon(index, CIcon(callsign.toIcon()).toQIcon());
bar->setTabTextColor(index, QColor(Qt::yellow));
}
ui->tw_TextMessages->setCurrentIndex(index);

View File

@@ -106,7 +106,7 @@ namespace BlackGui
ui->cb_Platforms->clear();
for (const CPlatform &platform : platforms)
{
ui->cb_Platforms->insertItem(i++, platform.toPixmap(), platform.getPlatformName());
ui->cb_Platforms->insertItem(i++, CIcon(platform.toIcon()).toPixmap(), platform.getPlatformName());
}
if (platforms.contains(settings.last())) { ui->cb_Platforms->setCurrentText(settings.last()); }
else if (platforms.contains(CPlatform::currentPlatform().getPlatformName())) { ui->cb_Platforms->setCurrentText(CPlatform::currentPlatform().getPlatformName()); }
@@ -116,7 +116,7 @@ namespace BlackGui
ui->cb_Channels->clear();
for (const CDistribution &distribution : distributions)
{
ui->cb_Channels->insertItem(i++, distribution.getRestrictionIcon().toPixmap(), distribution.getChannel());
ui->cb_Channels->insertItem(i++, CIcon(distribution.getRestrictionIcon()).toPixmap(), distribution.getChannel());
}
if (distributions.containsChannel(settings.front())) { ui->cb_Channels->setCurrentText(settings.front()); }

View File

@@ -49,7 +49,7 @@ namespace BlackGui
this->clear();
for (const CEcosystem &e : m_systems)
{
this->addItem(e.toIcon().toPixmap(), e.getSystemString());
this->addItem(BlackMisc::CIcon(e.toIcon()).toPixmap(), e.getSystemString());
}
}
} // ns

View File

@@ -74,7 +74,7 @@ namespace BlackGui
ui->cb_Military->setChecked(icao.isMilitary());
ui->country_Selector->setCountry(icao.getCountry());
const QPixmap pm = icao.toPixmap();
const QPixmap pm = CIcon(icao.toIcon());
if (pm.width() < 125)
{
ui->lbl_AirlineIcon->setPixmap(pm);

View File

@@ -50,17 +50,17 @@ namespace BlackGui
{
CStatusMessage msg;
msg.setSeverity(CStatusMessage::SeverityError);
ui->rb_Error->setIcon(msg.toIcon().toQIcon());
ui->rb_Error->setIcon(CIcon(msg.toIcon()).toQIcon());
ui->rb_Error->setToolTip(msg.getSeverityAsString());
ui->rb_Error->setText(oneCharacterText ? msg.getSeverityAsString().left(1) : "");
msg.setSeverity(CStatusMessage::SeverityWarning);
ui->rb_Warning->setIcon(msg.toIcon().toQIcon());
ui->rb_Warning->setIcon(CIcon(msg.toIcon()).toQIcon());
ui->rb_Warning->setToolTip(msg.getSeverityAsString());
ui->rb_Warning->setText(oneCharacterText ? msg.getSeverityAsString().left(1) : "");
msg.setSeverity(CStatusMessage::SeverityInfo);
ui->rb_Info->setIcon(msg.toIcon().toQIcon());
ui->rb_Info->setIcon(CIcon(msg.toIcon()).toQIcon());
ui->rb_Info->setToolTip(msg.getSeverityAsString());
ui->rb_Info->setText(oneCharacterText ? msg.getSeverityAsString().left(1) : "");
}

View File

@@ -112,7 +112,7 @@ namespace BlackGui
this->show();
m_timerStatusBar.start(3000); // start / restart
m_statusBarIcon->setPixmap(statusMessage.toPixmap());
m_statusBarIcon->setPixmap(CIcon(statusMessage.toIcon()));
// restrict size for own status bars
const QSize size = m_statusBar->window()->size();

View File

@@ -421,7 +421,7 @@ namespace BlackGui
{
const CRgbColor rgbColor(dataCVariant.to<CRgbColor>());
if (!rgbColor.isValid()) { return emptyPixmapVariant(); }
return CVariant::fromValue(rgbColor.toPixmap());
return CVariant::fromValue(CIcon(rgbColor.toIcon()).toPixmap());
}
CVariant CColorFormatter::tooltipRole(const CVariant &dataCVariant) const