• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Applets

menuview.h

Go to the documentation of this file.
00001 /*
00002     Copyright 2007 Robert Knight <robertknight@gmail.com>
00003     Copyright 2008 Sebastian Sauer <mail@dipe.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef MENUVIEW_H
00022 #define MENUVIEW_H
00023 
00024 // Qt
00025 #include <QtCore/QModelIndex>
00026 
00027 // KDE
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     // reimplemented
00132     virtual bool eventFilter(QObject * watched, QEvent *event);
00133 
00134 public Q_SLOTS:
00135     // an item in the menu got triggered
00136     void actionTriggered(QAction* action);
00137 
00138 private Q_SLOTS:
00139     // new items have been inserted into the model
00140     void rowsInserted(const QModelIndex& parent, int start, int end);
00141     // existing items are about to be removed from the model
00142     void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
00143     // data within an item of the model change
00144     void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
00145     // the model did reset itself and all items are invalid
00146     void modelReset();
00147 
00148 private:
00149     class Private;
00150     Private * const d;
00151 };
00152 
00153 }
00154 
00155 #endif // MENUVIEW_H
00156 

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal