File indexing completed on 2024-05-26 04:47:03
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "texttranslator_export.h" 0010 #include <QObject> 0011 #include <QPersistentModelIndex> 0012 class QMenu; 0013 0014 namespace TextTranslator 0015 { 0016 class TEXTTRANSLATOR_EXPORT TranslatorMenu : public QObject 0017 { 0018 Q_OBJECT 0019 public: 0020 explicit TranslatorMenu(QObject *parent = nullptr); 0021 ~TranslatorMenu() override; 0022 0023 [[nodiscard]] QMenu *menu() const; 0024 0025 [[nodiscard]] bool isEmpty() const; 0026 0027 [[nodiscard]] const QPersistentModelIndex &modelIndex() const; 0028 void setModelIndex(const QPersistentModelIndex &newModelIndex); 0029 0030 void updateMenu(); 0031 0032 Q_SIGNALS: 0033 void translate(const QString &from, const QString &to, const QPersistentModelIndex &modelIndex); 0034 0035 private: 0036 QPersistentModelIndex mModelIndex; 0037 QMenu *const mMenu; 0038 }; 0039 }