Changeset View
Changeset View
Standalone View
Standalone View
sidebar/SidebarMode.h
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 45 | { | |||
---|---|---|---|---|---|
46 | Q_OBJECT | 46 | Q_OBJECT | ||
47 | 47 | | |||
48 | Q_PROPERTY(QAbstractItemModel *categoryModel READ categoryModel CONSTANT) | 48 | Q_PROPERTY(QAbstractItemModel *categoryModel READ categoryModel CONSTANT) | ||
49 | Q_PROPERTY(QAbstractItemModel *subCategoryModel READ subCategoryModel CONSTANT) | 49 | Q_PROPERTY(QAbstractItemModel *subCategoryModel READ subCategoryModel CONSTANT) | ||
50 | Q_PROPERTY(QAbstractItemModel *mostUsedModel READ mostUsedModel CONSTANT) | 50 | Q_PROPERTY(QAbstractItemModel *mostUsedModel READ mostUsedModel CONSTANT) | ||
51 | Q_PROPERTY(int activeCategory READ activeCategory WRITE setActiveCategory NOTIFY activeCategoryChanged) | 51 | Q_PROPERTY(int activeCategory READ activeCategory WRITE setActiveCategory NOTIFY activeCategoryChanged) | ||
52 | Q_PROPERTY(int activeSubCategory READ activeSubCategory WRITE setActiveSubCategory NOTIFY activeSubCategoryChanged) | 52 | Q_PROPERTY(int activeSubCategory READ activeSubCategory WRITE setActiveSubCategory NOTIFY activeSubCategoryChanged) | ||
53 | Q_PROPERTY(int width READ width NOTIFY widthChanged) | 53 | Q_PROPERTY(int width READ width NOTIFY widthChanged) | ||
54 | Q_PROPERTY(bool actionMenuVisible READ actionMenuVisible NOTIFY actionMenuVisibleChanged) | ||||
broulik: Doesn't need a `WRITE` as it is internal | |||||
54 | 55 | | |||
55 | public: | 56 | public: | ||
56 | SidebarMode(QObject * parent, const QVariantList& ); | 57 | SidebarMode(QObject * parent, const QVariantList& ); | ||
57 | ~SidebarMode() override; | 58 | ~SidebarMode() override; | ||
58 | QWidget * mainWidget() override; | 59 | QWidget * mainWidget() override; | ||
59 | void initEvent() override; | 60 | void initEvent() override; | ||
60 | void giveFocus() override; | 61 | void giveFocus() override; | ||
61 | KAboutData * aboutData() override; | 62 | KAboutData * aboutData() override; | ||
62 | ModuleView * moduleView() const override; | 63 | ModuleView * moduleView() const override; | ||
63 | QAbstractItemModel *categoryModel() const; | 64 | QAbstractItemModel *categoryModel() const; | ||
64 | QAbstractItemModel *subCategoryModel() const; | 65 | QAbstractItemModel *subCategoryModel() const; | ||
65 | QAbstractItemModel *mostUsedModel() const; | 66 | QAbstractItemModel *mostUsedModel() const; | ||
66 | 67 | | |||
67 | int activeCategory() const; | 68 | int activeCategory() const; | ||
68 | void setActiveCategory(int cat); | 69 | void setActiveCategory(int cat); | ||
69 | 70 | | |||
70 | int activeSubCategory() const; | 71 | int activeSubCategory() const; | ||
71 | void setActiveSubCategory(int cat); | 72 | void setActiveSubCategory(int cat); | ||
72 | 73 | | |||
73 | int width() const; | 74 | int width() const; | ||
74 | 75 | | |||
76 | bool actionMenuVisible() const; | ||||
77 | | ||||
broulik: Make the setter `private` | |||||
75 | Q_INVOKABLE QAction *action(const QString &name) const; | 78 | Q_INVOKABLE QAction *action(const QString &name) const; | ||
76 | // QML doesn't understand QIcon, otherwise we could get it from the QAction itself | 79 | // QML doesn't understand QIcon, otherwise we could get it from the QAction itself | ||
77 | Q_INVOKABLE QString actionIconName(const QString &name) const; | 80 | Q_INVOKABLE QString actionIconName(const QString &name) const; | ||
78 | Q_INVOKABLE void requestToolTip(int index, const QRectF &rect); | 81 | Q_INVOKABLE void requestToolTip(int index, const QRectF &rect); | ||
79 | Q_INVOKABLE void requestSubCategoryToolTip(int index, const QRectF &rect); | 82 | Q_INVOKABLE void requestSubCategoryToolTip(int index, const QRectF &rect); | ||
80 | Q_INVOKABLE void hideToolTip(); | 83 | Q_INVOKABLE void hideToolTip(); | ||
81 | Q_INVOKABLE void hideSubCategoryToolTip(); | 84 | Q_INVOKABLE void hideSubCategoryToolTip(); | ||
82 | Q_INVOKABLE void loadMostUsed(int index); | 85 | Q_INVOKABLE void loadMostUsed(int index); | ||
86 | Q_INVOKABLE void showActionMenu(const QPoint &position); | ||||
83 | 87 | | |||
84 | protected: | 88 | protected: | ||
85 | QList<QAbstractItemView*> views() const override; | 89 | QList<QAbstractItemView*> views() const override; | ||
86 | bool eventFilter(QObject* watched, QEvent* event) override; | 90 | bool eventFilter(QObject* watched, QEvent* event) override; | ||
87 | 91 | | |||
88 | private Q_SLOTS: | 92 | private Q_SLOTS: | ||
89 | void changeModule( const QModelIndex& activeModule ); | 93 | void changeModule( const QModelIndex& activeModule ); | ||
90 | void moduleLoaded(); | 94 | void moduleLoaded(); | ||
91 | void initWidget(); | 95 | void initWidget(); | ||
92 | 96 | | |||
93 | Q_SIGNALS: | 97 | Q_SIGNALS: | ||
94 | void activeCategoryChanged(); | 98 | void activeCategoryChanged(); | ||
95 | void activeSubCategoryChanged(); | 99 | void activeSubCategoryChanged(); | ||
96 | void widthChanged(); | 100 | void widthChanged(); | ||
101 | void actionMenuVisibleChanged(); | ||||
97 | 102 | | |||
98 | private: | 103 | private: | ||
99 | class Private; | 104 | class Private; | ||
100 | Private *const d; | 105 | Private *const d; | ||
106 | void setActionMenuVisible(const bool &actionMenuVisible); | ||||
broulik: Move this to the `Private` class | |||||
broulik: This isnt addressed | |||||
101 | }; | 107 | }; | ||
102 | 108 | | |||
103 | #endif | 109 | #endif |
Doesn't need a WRITE as it is internal