mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T515, highlight by models and changed naming
This commit is contained in:
committed by
Mat Sutcliffe
parent
6acde8799f
commit
019cc6259e
@@ -173,12 +173,17 @@ namespace BlackGui
|
||||
this->endResetModel();
|
||||
}
|
||||
|
||||
void CAircraftModelListModel::setHighlightModelStrings(bool highlightModelStrings)
|
||||
void CAircraftModelListModel::setHighlightModels(const CAircraftModelList &highlightModels)
|
||||
{
|
||||
if (m_highlightModelStrings == highlightModelStrings) { return; }
|
||||
this->setHighlightModelStrings(highlightModels.getModelStringList(true));
|
||||
}
|
||||
|
||||
void CAircraftModelListModel::setHighlight(bool highlightModels)
|
||||
{
|
||||
if (m_highlightModels == highlightModels) { return; }
|
||||
|
||||
this->beginResetModel();
|
||||
m_highlightModelStrings = highlightModelStrings;
|
||||
m_highlightModels = highlightModels;
|
||||
this->endResetModel();
|
||||
}
|
||||
|
||||
@@ -201,7 +206,7 @@ namespace BlackGui
|
||||
{
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
const bool ms = highlightModelStrings() && !m_highlightStrings.isEmpty();
|
||||
const bool ms = highlightModels() && !m_highlightStrings.isEmpty();
|
||||
if (!ms) { return CListModelDbObjects::data(index, role); }
|
||||
|
||||
// the underlying model object
|
||||
@@ -226,7 +231,7 @@ namespace BlackGui
|
||||
|
||||
void CAircraftModelListModel::clearHighlighting()
|
||||
{
|
||||
m_highlightModelStrings = false;
|
||||
m_highlightModels = false;
|
||||
m_highlightStrings.clear();
|
||||
COrderableListModelDbObjects::clearHighlighting();
|
||||
}
|
||||
|
||||
@@ -64,13 +64,16 @@ namespace BlackGui
|
||||
void setHighlightModelStrings(const QStringList &modelStrings = QStringList());
|
||||
|
||||
//! Highlight models
|
||||
bool highlightModelStrings() const { return m_highlightModelStrings; }
|
||||
void setHighlightModels(const BlackMisc::Simulation::CAircraftModelList &highlightModels);
|
||||
|
||||
//! Highlight models
|
||||
void setHighlightModelStrings(bool highlightModelStrings);
|
||||
bool highlightModels() const { return m_highlightModels; }
|
||||
|
||||
//! Highlight models
|
||||
void setHighlight(bool highlightModels);
|
||||
|
||||
//! The highlight color
|
||||
void setHighlightModelStringsColor(const QBrush &brush) { m_highlightColor = brush; }
|
||||
void setHighlightColor(const QBrush &brush) { m_highlightColor = brush; }
|
||||
|
||||
//! \copydoc CListModelBaseNonTemplate::clearHighlighting
|
||||
virtual void clearHighlighting() override;
|
||||
@@ -91,10 +94,10 @@ namespace BlackGui
|
||||
virtual bool isOrderable() const override { return true; }
|
||||
|
||||
private:
|
||||
AircraftModelMode m_mode = NotSet; //!< current mode
|
||||
bool m_highlightModelStrings = false; //!< highlight if in m_highlightStrings
|
||||
QStringList m_highlightStrings; //!< model strings to highlight
|
||||
QBrush m_highlightColor{Qt::yellow}; //!< how to highlight
|
||||
AircraftModelMode m_mode = NotSet; //!< current mode
|
||||
bool m_highlightModels = false; //!< highlight if in m_highlightStrings
|
||||
QStringList m_highlightStrings; //!< model strings to highlight
|
||||
QBrush m_highlightColor{Qt::yellow}; //!< how to highlight
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user