refs #525, specialized model class for DB entities and improved funtions in view base class

* will allow to highlight entities
* nested custom menus
* moved displayAutomatically() menus in view base class
* fixed which menus are displayed for aircraft models
* also changed to QStandardItem model to see if this is causing any trouble (the real bigger changes will follow in #530)
This commit is contained in:
Klaus Basan
2015-12-02 01:29:20 +01:00
parent 88f14f150d
commit 8e852b19ae
11 changed files with 362 additions and 108 deletions

View File

@@ -14,7 +14,7 @@
#include "blackgui/blackguiexport.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackgui/models/listmodelbase.h"
#include "blackgui/models/modelswithdbkey.h"
#include <QAbstractItemModel>
namespace BlackGui
@@ -23,7 +23,7 @@ namespace BlackGui
{
//! Aircraft model list model
class BLACKGUI_EXPORT CAircraftModelListModel :
public CListModelBase<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList, true>
public CModelsWithDbKeysBase<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList, int, true>
{
public:
//! How to display
@@ -34,7 +34,8 @@ namespace BlackGui
OwnSimulatorModel, ///< model existing with my sim
MappedModel, ///< Model based on mapping operation
Database, ///< Database entry
VPilotRuleModel ///< vPilot rule turned into model
VPilotRuleModel, ///< vPilot rule turned into model
StashModel ///< stashed models
};
//! Constructor
@@ -55,6 +56,12 @@ namespace BlackGui
//! Highlight the DB models
void setHighlightDbData(bool highlightDbData) { m_highlightDbData = highlightDbData; }
//! Highlight stashed models
bool highlightStashedModels() const { return m_highlightStashedData; }
//! Highlight stashed models
void setHighlightStashedModels(bool highlightStashedModels) { m_highlightStashedData = highlightStashedModels; }
protected:
//! \copydoc QAbstractItemModel::data
virtual QVariant data(const QModelIndex &index, int role) const override;
@@ -62,6 +69,7 @@ namespace BlackGui
private:
AircraftModelMode m_mode = NotSet; //!< current mode
bool m_highlightDbData = false;
bool m_highlightStashedData = false;
};
} // ns
} // ns