Files
MARTe-Integrated-Components/Client/streamhub-qt/SourceSidebar.h
T
2026-06-26 09:11:10 +02:00

45 lines
1.0 KiB
C++

/**
* @file SourceSidebar.h
* @brief Source browser sidebar: tree of sources → signals with drag-to-plot.
*
* Mirrors the ImGui SourcePanel. Each signal leaf is draggable; the drag
* payload is the mime type "application/x-shq-signal" carrying two qint32
* values {sourceIdx, signalIdx}, consumed by PlotWidget's drop handler.
*/
#pragma once
#include <QWidget>
class QTreeWidget;
class QTreeWidgetItem;
namespace shq {
class Hub;
/** MIME type carried by a signal drag: payload = qint32[2] {srcIdx,sigIdx}. */
extern const char* const kMimeSignal;
class SourceSidebar : public QWidget {
Q_OBJECT
public:
explicit SourceSidebar(Hub* hub, QWidget* parent = nullptr);
public Q_SLOTS:
/** Rebuild the tree from the current model (sources/config changes). */
void refresh();
Q_SIGNALS:
/** User clicked "Add Source" (MainWindow opens the dialog). */
void addSourceRequested();
private:
void onContextMenu(const QPoint& pos);
Hub* hub_;
QTreeWidget* tree_ = nullptr;
};
} /* namespace shq */