File indexing completed on 2024-06-16 04:51:16

0001 /*
0002   This file is part of KOrganizer.
0003 
0004   SPDX-FileCopyrightText: 2008 Thomas Thrainer <tom_t@gmx.at>
0005 
0006   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QTimer>
0012 #include <QTreeView>
0013 
0014 class KDatePickerPopup;
0015 class QMenu;
0016 
0017 class TodoViewView : public QTreeView
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     explicit TodoViewView(QWidget *parent = nullptr);
0023 
0024     [[nodiscard]] bool isEditing(const QModelIndex &index) const;
0025 
0026     [[nodiscard]] bool eventFilter(QObject *watched, QEvent *event) override;
0027     [[nodiscard]] KDatePickerPopup *startPopupMenu();
0028 
0029 protected:
0030     QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
0031     void mousePressEvent(QMouseEvent *) override;
0032     void mouseReleaseEvent(QMouseEvent *) override;
0033     void mouseMoveEvent(QMouseEvent *) override;
0034 
0035 private:
0036     QModelIndex getNextEditableIndex(const QModelIndex &cur, int inc);
0037 
0038     QMenu *mHeaderPopup = nullptr;
0039     QList<QAction *> mColumnActions;
0040     QTimer mExpandTimer;
0041     bool mIgnoreNextMouseRelease = false;
0042 
0043     // TODO KF6: move this next to TodoView::mMovePopupMenu.
0044     KDatePickerPopup *mStartPopupMenu = nullptr;
0045 
0046 Q_SIGNALS:
0047     void visibleColumnCountChanged();
0048 
0049 private Q_SLOTS:
0050     void toggleColumnHidden(QAction *action);
0051     void expandParent();
0052 };