Applets
menuview.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef MENUVIEW_H
00022 #define MENUVIEW_H
00023
00024
00025 #include <QtCore/QModelIndex>
00026
00027
00028 #include <KMenu>
00029
00030 class QAbstractItemModel;
00031
00032 namespace Kickoff
00033 {
00034
00035 class UrlItemLauncher;
00036
00051 class MenuView : public KMenu
00052 {
00053 Q_OBJECT
00054 public:
00055
00057 MenuView(QWidget *parent = 0);
00059 virtual ~MenuView();
00060
00062 void setModel(QAbstractItemModel *model);
00064 QAbstractItemModel *model() const;
00065
00067 UrlItemLauncher *launcher() const;
00068
00070 QModelIndex indexForAction(QAction *action) const;
00071
00079 QAction *actionForIndex(const QModelIndex& index) const;
00080
00088 bool isValidIndex(const QModelIndex& index) const;
00089
00091 void setColumn(int column);
00093 int column() const;
00094
00096 enum FormatType {
00097 Name = 0,
00098 Description,
00099 NameDescription,
00100 DescriptionName,
00101 NameDashDescription
00102 };
00104 FormatType formatType() const;
00106 void setFormatType(FormatType formattype);
00107
00108 protected:
00109
00119 virtual QAction *createLeafAction(const QModelIndex& index, QObject *parent);
00120
00129 virtual void updateAction(QAction *action, const QModelIndex& index);
00130
00131
00132 virtual bool eventFilter(QObject * watched, QEvent *event);
00133
00134 public Q_SLOTS:
00135
00136 void actionTriggered(QAction* action);
00137
00138 private Q_SLOTS:
00139
00140 void rowsInserted(const QModelIndex& parent, int start, int end);
00141
00142 void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
00143
00144 void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
00145
00146 void modelReset();
00147
00148 private:
00149 class Private;
00150 Private * const d;
00151 };
00152
00153 }
00154
00155 #endif // MENUVIEW_H
00156