ORE Studio 0.0.4
Loading...
Searching...
No Matches
TagSelectorWidget.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_TAG_SELECTOR_WIDGET_HPP
21#define ORES_QT_TAG_SELECTOR_WIDGET_HPP
22
23#include <QWidget>
24#include <QHBoxLayout>
25#include <QToolButton>
26#include <QMenu>
27#include <vector>
28#include <boost/uuid/uuid.hpp>
29#include "ores.connections/domain/tag.hpp"
30
31namespace ores::connections::service {
32class connection_manager;
33}
34
35namespace ores::qt {
36
43class TagSelectorWidget : public QWidget {
44 Q_OBJECT
45
46public:
48 QWidget* parent = nullptr);
49
53 void setSelectedTags(const std::vector<connections::domain::tag>& tags);
54
58 std::vector<boost::uuids::uuid> selectedTagIds() const;
59
60signals:
65
66private slots:
67 void onAddTagClicked();
68 void onTagActionTriggered(QAction* action);
69 void removeTag(const boost::uuids::uuid& tagId);
70
71private:
72 void rebuildTagDisplay();
73 void populateTagMenu();
74 QColor colorForTag(const QString& name) const;
75
77 QHBoxLayout* layout_;
78 QToolButton* addButton_;
79 QMenu* tagMenu_;
80
81 std::vector<connections::domain::tag> selectedTags_;
82};
83
84}
85
86#endif
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
High-level service for managing server connections.
Definition connection_manager.hpp:48
Widget for selecting and displaying tags as pill badges.
Definition TagSelectorWidget.hpp:43
void selectionChanged()
Emitted when the selection changes.
void setSelectedTags(const std::vector< connections::domain::tag > &tags)
Set the currently selected tags.
Definition TagSelectorWidget.cpp:71
std::vector< boost::uuids::uuid > selectedTagIds() const
Get the currently selected tag IDs.
Definition TagSelectorWidget.cpp:76