File indexing completed on 2024-12-01 04:36:37

0001 /*
0002    SPDX-FileCopyrightText: 2020 David Faure <faure@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_private_export.h"
0010 #include <QListView>
0011 
0012 /**
0013  * Completion popup for nicks, channels, etc.
0014  * QCompleter does the filtering itself... so we need to implement our own popup, instead.
0015  */
0016 class LIBRUQOLAWIDGETS_TESTS_EXPORT CompletionListView : public QListView
0017 {
0018     Q_OBJECT
0019 public:
0020     CompletionListView();
0021     ~CompletionListView() override;
0022 
0023     void setTextWidget(QWidget *textWidget);
0024 
0025     void setModel(QAbstractItemModel *model) override;
0026 
0027     void slotCompletionAvailable();
0028 
0029 Q_SIGNALS:
0030     void complete(const QModelIndex &currentIndex);
0031 
0032 protected:
0033     void keyPressEvent(QKeyEvent *event) override;
0034     bool event(QEvent *event) override;
0035 
0036 private:
0037     QWidget *mTextWidget = nullptr;
0038 };