mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
refs #745, removed unused hover code
(this was a trial to highlight the drop position, the callback function was kept)
This commit is contained in:
@@ -197,19 +197,6 @@ namespace BlackGui
|
|||||||
return m_modelDestroyed;
|
return m_modelDestroyed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CListModelBaseNonTemplate::setHoveredRow(int row)
|
|
||||||
{
|
|
||||||
if (this->m_hoverRow == row) { return; }
|
|
||||||
this->m_hoverRow = row;
|
|
||||||
const int columns = columnCount();
|
|
||||||
if (columns < 1) { return; }
|
|
||||||
if (row < 0) { return; }
|
|
||||||
|
|
||||||
const QModelIndex topLeft(createIndex(row, 0));
|
|
||||||
const QModelIndex bottomRight(createIndex(row, columns - 1));
|
|
||||||
emit this->dataChanged(topLeft, bottomRight);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CListModelBaseNonTemplate::clearHighlighting()
|
void CListModelBaseNonTemplate::clearHighlighting()
|
||||||
{
|
{
|
||||||
// can be overridden to delete highlighting
|
// can be overridden to delete highlighting
|
||||||
@@ -245,20 +232,6 @@ namespace BlackGui
|
|||||||
connect(this, &CListModelBaseNonTemplate::dataChanged, this, &CListModelBaseNonTemplate::ps_onDataChanged);
|
connect(this, &CListModelBaseNonTemplate::dataChanged, this, &CListModelBaseNonTemplate::ps_onDataChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CListModelBaseNonTemplate::isHoveredRow(int row) const
|
|
||||||
{
|
|
||||||
if (this->m_hoverRow < 0) { return false; }
|
|
||||||
if (row < 0) { return false; }
|
|
||||||
return row == this->m_hoverRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CListModelBaseNonTemplate::isHoveredRow(const QModelIndex &modelIndex) const
|
|
||||||
{
|
|
||||||
if (this->m_hoverRow < 0) { return false; }
|
|
||||||
if (!modelIndex.isValid()) { return false; }
|
|
||||||
return modelIndex.row() == this->m_hoverRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ObjectType, typename ContainerType, bool UseCompare>
|
template <typename ObjectType, typename ContainerType, bool UseCompare>
|
||||||
CListModelBase<ObjectType, ContainerType, UseCompare>::CListModelBase(const QString &translationContext, QObject *parent)
|
CListModelBase<ObjectType, ContainerType, UseCompare>::CListModelBase(const QString &translationContext, QObject *parent)
|
||||||
: CListModelBaseNonTemplate(translationContext, parent)
|
: CListModelBaseNonTemplate(translationContext, parent)
|
||||||
@@ -316,16 +289,9 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
// check / init
|
// check / init
|
||||||
if (!this->isValidIndex(index)) { return QVariant(); }
|
if (!this->isValidIndex(index)) { return QVariant(); }
|
||||||
const int row = index.row();
|
|
||||||
const int col = index.column();
|
|
||||||
|
|
||||||
// Hover effect
|
|
||||||
if (role == Qt::BackgroundRole)
|
if (role == Qt::BackgroundRole)
|
||||||
{
|
{
|
||||||
if (this->isHoveredRow(row))
|
|
||||||
{
|
|
||||||
return QBrush(Qt::red);
|
|
||||||
}
|
|
||||||
return CListModelBaseNonTemplate::data(index, role);
|
return CListModelBaseNonTemplate::data(index, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +303,8 @@ namespace BlackGui
|
|||||||
if (!formatter || !formatter->supportsRole(role)) { return CListModelBaseNonTemplate::data(index, role); }
|
if (!formatter || !formatter->supportsRole(role)) { return CListModelBaseNonTemplate::data(index, role); }
|
||||||
|
|
||||||
// index, updront checking
|
// index, updront checking
|
||||||
|
const int row = index.row();
|
||||||
|
const int col = index.column();
|
||||||
const BlackMisc::CPropertyIndex propertyIndex = this->columnToPropertyIndex(col);
|
const BlackMisc::CPropertyIndex propertyIndex = this->columnToPropertyIndex(col);
|
||||||
if (static_cast<int>(CPropertyIndex::GlobalIndexLineNumber) == propertyIndex.frontCasted<int>())
|
if (static_cast<int>(CPropertyIndex::GlobalIndexLineNumber) == propertyIndex.frontCasted<int>())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,9 +108,6 @@ namespace BlackGui
|
|||||||
//! Model about to be destroyed?
|
//! Model about to be destroyed?
|
||||||
bool isModelDestroyed();
|
bool isModelDestroyed();
|
||||||
|
|
||||||
//! Hovered role
|
|
||||||
void setHoveredRow(int row);
|
|
||||||
|
|
||||||
//! Remove all highlighting
|
//! Remove all highlighting
|
||||||
virtual void clearHighlighting();
|
virtual void clearHighlighting();
|
||||||
|
|
||||||
@@ -167,14 +164,7 @@ namespace BlackGui
|
|||||||
//! Helper method with template free signature
|
//! Helper method with template free signature
|
||||||
virtual int performUpdateContainer(const BlackMisc::CVariant &variant, bool sort) = 0;
|
virtual int performUpdateContainer(const BlackMisc::CVariant &variant, bool sort) = 0;
|
||||||
|
|
||||||
//! Row to be hovered?
|
|
||||||
bool isHoveredRow(int row) const;
|
|
||||||
|
|
||||||
//! Row to be hovered?
|
|
||||||
bool isHoveredRow(const QModelIndex &modelIndex) const;
|
|
||||||
|
|
||||||
CColumns m_columns; //!< columns metadata
|
CColumns m_columns; //!< columns metadata
|
||||||
int m_hoverRow = -1; //!< hovered row number
|
|
||||||
int m_sortedColumn; //!< currently sorted column
|
int m_sortedColumn; //!< currently sorted column
|
||||||
bool m_modelDestroyed = false; //!< model is about to be destroyed
|
bool m_modelDestroyed = false; //!< model is about to be destroyed
|
||||||
Qt::SortOrder m_sortOrder; //!< sort order (asc/desc)
|
Qt::SortOrder m_sortOrder; //!< sort order (asc/desc)
|
||||||
|
|||||||
@@ -1172,15 +1172,9 @@ namespace BlackGui
|
|||||||
template <class ModelClass, class ContainerType, class ObjectType>
|
template <class ModelClass, class ContainerType, class ObjectType>
|
||||||
void CViewBase<ModelClass, ContainerType, ObjectType>::mouseOverCallback(const QModelIndex &index, bool mouseOver)
|
void CViewBase<ModelClass, ContainerType, ObjectType>::mouseOverCallback(const QModelIndex &index, bool mouseOver)
|
||||||
{
|
{
|
||||||
if (mouseOver && index.isValid())
|
// void
|
||||||
{
|
Q_UNUSED(index);
|
||||||
const int row = index.row();
|
Q_UNUSED(mouseOver);
|
||||||
this->m_model->setHoveredRow(row);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// this->m_model->setHoveredRow(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ModelClass, class ContainerType, class ObjectType>
|
template <class ModelClass, class ContainerType, class ObjectType>
|
||||||
|
|||||||
@@ -465,6 +465,13 @@ namespace BlackMisc
|
|||||||
return this->m_modelType == TypeManuallySet && this->hasModelString();
|
return this->m_modelType == TypeManuallySet && this->hasModelString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CAircraftModel::hasDescription(bool ignoreAutoGenerated) const
|
||||||
|
{
|
||||||
|
if (this->m_description.isEmpty()) { return false; }
|
||||||
|
if (!ignoreAutoGenerated) { return true; }
|
||||||
|
return (!this->getDescription().startsWith(autoGenerated(), Qt::CaseInsensitive));
|
||||||
|
}
|
||||||
|
|
||||||
bool CAircraftModel::hasValidSimulator() const
|
bool CAircraftModel::hasValidSimulator() const
|
||||||
{
|
{
|
||||||
return m_simulator.isAnySimulator();
|
return m_simulator.isAnySimulator();
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ namespace BlackMisc
|
|||||||
bool hasModelString() const { return !m_modelString.isEmpty(); }
|
bool hasModelString() const { return !m_modelString.isEmpty(); }
|
||||||
|
|
||||||
//! Description
|
//! Description
|
||||||
bool hasDescription() const { return !m_description.isEmpty(); }
|
bool hasDescription(bool ignoreAutoGenerated = false) const;
|
||||||
|
|
||||||
//! Valid simulator
|
//! Valid simulator
|
||||||
bool hasValidSimulator() const;
|
bool hasValidSimulator() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user