SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
An interactive legend to control what is displayed in a qtDiagram. More...
#include <qtDiagramLegend.h>
Public Types | |
enum | Column { Group, Symbol, Description } |
An enumerant describing the columns of the legend's model. More... | |
using | EntriesByType = std::unordered_map< smtk::string::Token, qtDiagramLegendEntry * > |
using | GroupedEntries = std::unordered_map< smtk::string::Token, EntriesByType > |
Public Member Functions | |
smtkSuperclassMacro (QGroupBox) | |
qtDiagramLegend (const QString &title, qtDiagram *parent=nullptr) | |
const EntriesByType & | typesInGroup (smtk::string::Token group) const |
bool | addEntry (qtDiagramLegendEntry *entry) |
Add an entry to the legend. | |
bool | removeEntry (qtDiagramLegendEntry *entry) |
Remove an entry from the legend. | |
qtDiagram * | diagram () const |
Return the diagram this summary widget belongs to. | |
Protected Slots | |
void | legendUpdated () |
This is called when model changes or user interactions requires a relayout. More... | |
Protected Member Functions | |
void | eraseIndex (qtDiagramLegendEntry *entry) |
Called by removeEntry() to update m_index so entry is no longer indexed. | |
Protected Attributes | |
QPointer< qtDiagram > | m_diagram |
Watch m_view's mouse events to tell m_symbolDelegate where to draw controls for visibility. More... | |
QStandardItemModel * | m_keys { nullptr } |
The unsorted model, in order of insertion. | |
QSortFilterProxyModel * | m_sortModel { nullptr } |
A sorted version of m_keys. | |
QTableView * | m_view { nullptr } |
The view of m_sortModel. | |
GroupedEntries | m_index |
An index of legend entries. | |
qtLegendDelegate * | m_symbolDelegate |
The delegate used to render the Symbol column of m_view. | |
An interactive legend to control what is displayed in a qtDiagram.
Each qtDiagramGenerator may add entries to the legend for the types of nodes and arcs it presents. Users may then toggle the visibility of these via the legend.
|
protectedslot |
This is called when model changes or user interactions requires a relayout.
Specifically, when (1) rows are inserted, (2) rows are modified, or (3) the user changes a column width, this method is invoked. This method calls resizeRowsToContents() so that word-wrapping is performed and re-sorts the model as needed. Note that we do not display the horizontal header (with its sort indicators) because we always sort by two columns (description then group) so that entries for the same types of things (arcs, nodes, etc.) are kept together.
|
protected |
Watch m_view's mouse events to tell m_symbolDelegate where to draw controls for visibility.
The parent qtResourceDiagram