File indexing completed on 2025-01-05 04:47:11

0001 /*
0002   SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
0003   SPDX-FileCopyrightText: 2020 Daniel Vrátil <dvratil@kde.org>
0004 
0005   SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "akonadiwidgets_export.h"
0011 
0012 // AkonadiCore
0013 #include "akonadi/tag.h"
0014 
0015 #include <QComboBox>
0016 
0017 #include <memory>
0018 
0019 namespace Akonadi
0020 {
0021 class TagSelectionComboBoxPrivate;
0022 
0023 /**
0024  * @brief The TagSelectionCombo class
0025  */
0026 class AKONADIWIDGETS_EXPORT TagSelectionComboBox : public QComboBox
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit TagSelectionComboBox(QWidget *parent = nullptr);
0031     ~TagSelectionComboBox() override;
0032 
0033     void setCheckable(bool checkable);
0034     bool checkable() const;
0035 
0036     Tag::List selection() const;
0037     QStringList selectionNames() const;
0038     void setSelection(const Tag::List &selection);
0039     void setSelection(const QStringList &selection);
0040 
0041     void hidePopup() override;
0042 
0043 protected:
0044     void keyPressEvent(QKeyEvent *event) override;
0045     bool eventFilter(QObject *receiver, QEvent *event) override;
0046 
0047 Q_SIGNALS:
0048     void selectionChanged(const Akonadi::Tag::List &selection);
0049 
0050 private:
0051     std::unique_ptr<TagSelectionComboBoxPrivate> const d;
0052 };
0053 
0054 } // namespace