Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+92
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaModel
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Norbert Thoden, NLE, 2020-06-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tgt_participant_handler.h"
|
||||
#include <TargetManagement/tgt_dtc.h>
|
||||
#include <TargetManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace TargetManagement
|
||||
{
|
||||
|
||||
// Forward:
|
||||
class ParticipantHandler;
|
||||
|
||||
// --------------------------------------------------------
|
||||
// AreaModel
|
||||
// --------------------------------------------------------
|
||||
class AreaModel final : public LtsWidgets::LtsAbstractTableModel<TargetManagement::ShootbackArea>
|
||||
{
|
||||
Q_OBJECT
|
||||
using BaseClass = LtsWidgets::LtsAbstractTableModel<TargetManagement::ShootbackArea>;
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Name,
|
||||
|
||||
// main config
|
||||
Center,
|
||||
Width,
|
||||
Height
|
||||
};
|
||||
|
||||
explicit AreaModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(const std::shared_ptr<Interface::Dtc> &tgtDtc);
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override final;
|
||||
QVariant data(const QModelIndex &, int) const override;
|
||||
|
||||
const QVector<ShootbackArea> &getData() const { return m_vecData; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void signalAreaNamesChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onShootbackAreaChanged(const TargetManagement::ShootbackArea &data,
|
||||
const DataModification modType);
|
||||
void updateColumnFilter();
|
||||
|
||||
private:
|
||||
friend class AreaProxyModel;
|
||||
std::shared_ptr<TargetManagement::Interface::Dtc> m_tgt_dtc;
|
||||
|
||||
// column filter
|
||||
QSet<QString> m_usedNames;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------
|
||||
// AreaProxyModel
|
||||
// --------------------------------------------------------
|
||||
class AreaProxyModel : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
using BaseClass = LtsWidgets::LtsColumnFilterProxyModel;
|
||||
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
|
||||
protected:
|
||||
AreaModel *m_sourceModel{nullptr};
|
||||
};
|
||||
|
||||
} //namespace TargetManagement
|
||||
Reference in new issue
Block a user