|
wiRedPanda
Logic Circuit Simulator
|
Controller for the left-panel element palette, IC list, and search tab. More...
#include <ElementPalette.h>
Public Member Functions | |
| void | addElementRequested (QMimeData *mimeData) |
| Emitted when the user presses Enter in the search box. | |
| ElementPalette (MainWindowUi *ui, QObject *parent=nullptr) | |
| Constructs the palette controller. | |
| void | populate () |
| Populates all category tabs with ElementLabel widgets and sets tab icons. | |
| void | retranslateLabels () |
| Calls updateName() on every ElementLabel in the palette (on language change). | |
| void | updateEmbeddedICList (Scene *scene) |
| Refreshes the embedded-IC section of the palette from the scene's blob registry. | |
| void | updateICList (const QFileInfo ¤tFile) |
| Refreshes the IC tab to reflect .panda files next to currentFile. | |
| void | updateTheme () |
| Updates the memory tab icon and all memory-tab ElementLabel themes. | |
Static Public Member Functions | |
| static bool | nameMatchesSearch (const QString &name, const QString &query) |
Controller for the left-panel element palette, IC list, and search tab.
Owns all state and logic for the left panel: populating element category tabs with ElementLabel widgets, maintaining the IC file list, running the three-pass search, and managing the search-tab lifecycle.
The only cross-boundary action — dropping the first search result into the scene — is exposed as addElementRequested() so MainWindow can route it to the active scene without ElementPalette knowing about Scene.
Definition at line 33 of file ElementPalette.h.
|
explicit |
Constructs the palette controller.
| ui | The host window's UI descriptor (must outlive this object). |
| parent | Optional QObject parent. |
Immediately connects lineEditSearch signals to internal slots.
Definition at line 21 of file ElementPalette.cpp.
| void ElementPalette::addElementRequested | ( | QMimeData * | mimeData | ) |
Emitted when the user presses Enter in the search box.
| mimeData | MIME data of the first visible search result. MainWindow should pass this to Scene::addItem(). |
|
static |
Case-insensitive "contains" match of query against name, used by the palette search. query is a raw, user-typed string, so it is regex-escaped: metacharacters (e.g. '(' in an IC named "counter(2)", or a lone '(') match literally instead of forming an invalid pattern that would silently return zero results. Pure/static so the matching can be tested without constructing the palette (which needs a MainWindowUi).
Definition at line 36 of file ElementPalette.cpp.
| void ElementPalette::populate | ( | ) |
Populates all category tabs with ElementLabel widgets and sets tab icons.
Must be called once after the host window is fully set up.
Definition at line 46 of file ElementPalette.cpp.
| void ElementPalette::retranslateLabels | ( | ) |
Calls updateName() on every ElementLabel in the palette (on language change).
Definition at line 153 of file ElementPalette.cpp.
| void ElementPalette::updateEmbeddedICList | ( | Scene * | scene | ) |
Refreshes the embedded-IC section of the palette from the scene's blob registry.
Definition at line 110 of file ElementPalette.cpp.
References ICRegistry::blobMap(), and Scene::icRegistry().
| void ElementPalette::updateICList | ( | const QFileInfo & | currentFile | ) |
Refreshes the IC tab to reflect .panda files next to currentFile.
| currentFile | The currently open project file; the IC tab is cleared if this file does not exist. |
Definition at line 64 of file ElementPalette.cpp.
| void ElementPalette::updateTheme | ( | ) |
Updates the memory tab icon and all memory-tab ElementLabel themes.
Definition at line 161 of file ElementPalette.cpp.
References DFlipFlop::pixmapPath().