simlyfy
This commit is contained in:
1 parent
849ce31e2f
commit
a55d1c58ed
272 files changed
+41866
-261
No files matched your search
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
class DbcTreeModel : public QAbstractItemModel {
|
||||
public:
|
||||
/** @brief Display columns for frame and signal metadata. */
|
||||
enum Column { Name,
|
||||
CanId,
|
||||
PayloadLength,
|
||||
@@ -21,6 +22,7 @@ public:
|
||||
Comment,
|
||||
ColumnCount };
|
||||
// Metadata roles apply on every column; inapplicable roles return invalid QVariant.
|
||||
/** @brief Typed metadata roles in addition to Qt display roles. */
|
||||
enum Role { NodeTypeRole = Qt::UserRole + 1,
|
||||
CanIdRole,
|
||||
PayloadLengthRole,
|
||||
@@ -33,14 +35,23 @@ public:
|
||||
ValueDescriptionsRole,
|
||||
ExtendedRole };
|
||||
|
||||
/** @brief Create an empty read-only model. */
|
||||
explicit DbcTreeModel(QObject *parent = nullptr);
|
||||
/** @brief Replace the tree and invalidate indexes; reject roots with a parent or non-root type. */
|
||||
void SetTree(std::unique_ptr<TreeNode> root);
|
||||
/** @brief Return a child index; only column zero can have children. */
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
/** @brief Return the parent in column zero, or an invalid index for frames. */
|
||||
QModelIndex parent(const QModelIndex &child) const override;
|
||||
/** @brief Return the child count, capped at the Qt integer limit. */
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
/** @brief Return the fixed metadata column count for this model. */
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
/** @brief Return display text or typed metadata for an index. */
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
/** @brief Return horizontal display column titles. */
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
/** @brief Allow selecting and enabling valid indexes without editing. */
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user