File indexing completed on 2024-05-12 12:21:06
0001 // SPDX-FileCopyrightText: 2023 Jesper K. Pedersen <jesper.pedersen@kdab.com> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 #pragma once 0006 0007 #include "AnnotationHandler.h" 0008 #include <DB/CategoryPtr.h> 0009 #include <QDialog> 0010 #include <memory> 0011 0012 namespace Ui 0013 { 0014 class SelectCategoryAndValue; 0015 } 0016 0017 class SelectCategoryAndValue : public QDialog 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 explicit SelectCategoryAndValue(const QString &title, const QString &message, const Viewer::AnnotationHandler::Assignments &assignments, QWidget *parent = nullptr); 0023 ~SelectCategoryAndValue(); 0024 QString category() const; 0025 QString value() const; 0026 int exec() override; 0027 0028 Q_SIGNALS: 0029 void helpRequest(); 0030 /** 0031 * @brief keyRemovalRequested is emitted if the user removes an item from the QTableView showing known assignments. 0032 * @param key 0033 */ 0034 void keyRemovalRequested(const QString &key); 0035 0036 private: 0037 void addNew(); 0038 void setupExistingAssignments(const Viewer::AnnotationHandler::Assignments &assignments); 0039 /** 0040 * @brief knownAssignmentsContextMenu handles the customContextMenu signal for the knownAssignments QTableView. 0041 * @param point 0042 */ 0043 void knownAssignmentsContextMenu(const QPoint &point); 0044 0045 const std::unique_ptr<Ui::SelectCategoryAndValue> ui; 0046 QString m_category; 0047 QString m_item; 0048 };