NDEVR
API Documentation
QCustomTreeWidget.h
1#pragma once
2#include "DLLInfo.h"
3#include <QTreeWidget>
4#include <NDEVR/String.h>
5#include <NDEVR/TranslatedString.h>
6#include <NDEVR/Dictionary.h>
7namespace NDEVR
8{
14 {
15 public:
19 AlocatingAlignedBuffer<QCustomTreeNode, 0> children;
20 };
21
27 class NDEVR_WIDGETS_API QCustomTreeWidget : public QTreeWidget
28 {
29 Q_OBJECT
30 public:
35 QCustomTreeWidget(QWidget* parent = nullptr);
40 void setup(const Buffer<QCustomTreeNode>& children);
46 bool event(QEvent* event);
50 void clear();
55 void setTitle(const TranslatedString& title);
61 signals:
72 void itemClickedSignal(String id, int column);
78 void itemDoubleClickedSignal(String id, int column);
84 void itemActivatedSignal(String id, int column);
90 void itemEnteredSignal(String id, int column);
96 void itemChangedSignal(String id, int column);
111 private slots:
115 void itemPressedSlot(QTreeWidgetItem* item, int column);
119 void itemClickedSlot(QTreeWidgetItem* item, int column);
123 void itemDoubleClickedSlot(QTreeWidgetItem* item, int column);
127 void itemActivatedSlot(QTreeWidgetItem* item, int column);
131 void itemEnteredSlot(QTreeWidgetItem* item, int column);
135 void itemChangedSlot(QTreeWidgetItem* item, int column);
139 void itemExpandedSlot(QTreeWidgetItem* item);
143 void itemCollapsedSlot(QTreeWidgetItem* item);
144 private:
150 String getID(QTreeWidgetItem* item) const;
156 void setup(QTreeWidgetItem* item, const QCustomTreeNode& node);
160 void refreshAll();
164 void refreshText();
168 void refreshIcons();
172 void refreshTitle();
173 private:
176 TranslatedString m_title;
177 };
178}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
Represents a single node in a tree structure, containing a title, ID, icon, and any child nodes.
AlocatingAlignedBuffer< QCustomTreeNode, 0 > children
The child nodes of this tree node.
String icon
The icon resource name for the tree node.
String id
The unique identifier for the tree node.
TranslatedString title
The display title of the tree node.
void itemEnteredSignal(String id, int column)
Signal emitted when the mouse enters a tree item.
void setup(const Buffer< QCustomTreeNode > &children)
Sets up the tree with the given root-level nodes and their children.
void itemDoubleClickedSignal(String id, int column)
Signal emitted when a tree item is double-clicked.
void itemPressedSignal(String id)
Signal emitted when a tree item is pressed.
void clear()
Removes all items from the tree widget.
void itemActivatedSignal(String id, int column)
Signal emitted when a tree item is activated (e.g., by Enter key).
void itemExpandedSignal(String id)
Signal emitted when a tree item is expanded.
void itemCollapsedSignal(String id)
Signal emitted when a tree item is collapsed.
void itemClickedSignal(String id, int column)
Signal emitted when a tree item is clicked.
Buffer< String > selectedIDs() const
Returns the IDs of all currently selected tree items.
void setTitle(const TranslatedString &title)
Sets the header title for the tree widget.
void selectionEditedSignal()
Signal emitted when the item selection changes.
bool event(QEvent *event)
Handles events including palette changes to refresh icons and text.
void itemChangedSignal(String id, int column)
Signal emitted when a tree item's data changes.
QCustomTreeWidget(QWidget *parent=nullptr)
Constructs a tree widget.
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.