File indexing completed on 2024-12-22 05:01:09

0001 /*
0002 This file is part of KMail, the KDE mail client.
0003 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0004 
0005 SPDX-License-Identifier: GPL-2.0-only
0006 */
0007 #pragma once
0008 
0009 #include "kmail_private_export.h"
0010 #include <QTreeView>
0011 
0012 class KMAILTESTS_TESTS_EXPORT CollectionSwitcherTreeView : public QTreeView
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit CollectionSwitcherTreeView(QWidget *parent = nullptr);
0017     ~CollectionSwitcherTreeView() override;
0018 
0019     [[nodiscard]] int sizeHintWidth() const;
0020     void resizeColumnsToContents();
0021 
0022 Q_SIGNALS:
0023     void collectionSelected(const QModelIndex &index);
0024 
0025 protected:
0026     void keyPressEvent(QKeyEvent *event) override;
0027     void showEvent(QShowEvent *event) override;
0028     void keyReleaseEvent(QKeyEvent *event) override;
0029 };