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 <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;
00078 QAction *actionForIndex(const QModelIndex& index) const;
00079
00081 void setColumn(int column);
00083 int column() const;
00084
00086 enum FormatType {
00087 Name = 0,
00088 Description,
00089 NameDescription,
00090 DescriptionName
00091 };
00093 FormatType formatType() const;
00095 void setFormatType(FormatType formattype);
00096
00097 protected:
00098
00108 virtual QAction *createLeafAction(const QModelIndex& index,QObject *parent);
00109
00118 virtual void updateAction(QAction *action, const QModelIndex& index);
00119
00120
00121 virtual bool eventFilter(QObject * watched, QEvent *event);
00122
00123 public Q_SLOTS:
00124
00125 void actionTriggered(QAction* action);
00126
00127 private Q_SLOTS:
00128
00129 void rowsAboutToBeInserted(const QModelIndex& parent,int start,int end);
00130
00131 void rowsAboutToBeRemoved(const QModelIndex& parent,int start,int end);
00132
00133 void dataChanged(const QModelIndex& topLeft,const QModelIndex& bottomRight);
00134
00135 void modelReset();
00136
00137 void aboutToShow();
00138
00139 void fillSubMenu();
00140
00141 private:
00142 class Private;
00143 Private * const d;
00144 };
00145
00146 }
00147
00148 #endif // MENUVIEW_H
00149