/** * @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 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 */