| Home · All Classes · Main Classes · Deprecated |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of libmeegotouch. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #ifndef MLIST_H 00021 #define MLIST_H 00022 00023 #include <QRectF> 00024 00025 #include "mwidgetcontroller.h" 00026 #include <mlistmodel.h> 00027 00028 class QGraphicsSceneResizeEvent; 00029 class MListPrivate; 00030 class QItemSelectionModel; 00031 class QAbstractItemModel; 00032 class QModelIndex; 00033 class MCellCreator; 00034 class MListFilter; 00035 00127 class M_CORE_EXPORT MList : public MWidgetController 00128 { 00129 Q_OBJECT 00130 M_CONTROLLER(MList) 00131 00132 00135 Q_PROPERTY(bool showGroups READ showGroups WRITE setShowGroups) 00136 00140 Q_PROPERTY(int columns READ columns WRITE setColumns) 00141 00145 Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode) 00146 00147 friend class Ut_MList; 00148 friend class Pt_MList; 00149 00150 public: 00154 enum SelectionMode { 00158 NoSelection, 00162 SingleSelection, 00166 MultiSelection 00167 }; 00168 00169 enum ScrollHint { 00173 EnsureVisibleHint, 00177 PositionAtTopHint, 00181 PositionAtBottomHint, 00185 PositionAtCenterHint 00186 }; 00187 00188 enum DisplayMode { 00192 Hide = 0, 00196 Show, 00201 Auto, 00206 Floating 00207 }; 00208 00209 enum ListOptimizationFlag { 00214 DontCallCreateCellDuringUpdate = 0x1 00215 }; 00216 Q_DECLARE_FLAGS(ListOptimizationFlags, ListOptimizationFlag) 00217 00218 00222 MList(QGraphicsItem *parent = 0); 00223 00227 virtual ~MList(); 00228 00251 void setItemModel(QAbstractItemModel *itemModel); 00252 00256 QAbstractItemModel *itemModel() const; 00257 00263 void setCellCreator(MCellCreator *cellCreator); 00264 00268 const MCellCreator *cellCreator() const; 00269 00275 void setHeaderCreator(MCellCreator *cellCreator); 00276 00280 const MCellCreator *headerCreator() const; 00281 00289 void setColumns(int columns); 00290 int columns() const; 00291 00295 QItemSelectionModel *selectionModel() const; 00296 00300 void setSelectionModel(QItemSelectionModel *selectionModel); 00301 00306 void setSelectionMode(MList::SelectionMode mode); 00307 00311 MList::SelectionMode selectionMode() const; 00312 00316 const QModelIndex firstVisibleItem() const; 00317 00321 const QModelIndex lastVisibleItem() const; 00322 00326 bool showGroups() const; 00327 00358 void setShowGroups(bool showGroups); 00359 00364 bool indexVisible(); 00365 00369 MListFilter *filtering() const; 00370 00374 ListOptimizationFlags optimizationFlags() const; 00375 00379 void setOptimizationFlag(ListOptimizationFlag optimizationFlag, bool enabled = true); 00380 00385 void setOptimizationFlags(ListOptimizationFlags optimizationFlags); 00386 00387 public Q_SLOTS: 00392 void selectItem(const QModelIndex &index); 00393 00398 void longTapItem(const QModelIndex &index); 00399 00403 void longTapItem(const QModelIndex &index, const QPointF &position); 00404 00409 void scrollTo(const QModelIndex &index); 00410 00414 void scrollTo(const QModelIndex &index, ScrollHint hint); 00415 00420 void setIndexVisible(bool visible); 00421 00427 void setIndexDisplayMode(DisplayMode displayMode); 00428 00433 DisplayMode indexDisplayMode() const; 00434 00435 Q_SIGNALS: 00440 void scrollToIndex(const QModelIndex &index); 00441 00445 void selectionModelChanged(QItemSelectionModel *selectionModel); 00446 00450 void itemClicked(const QModelIndex &index); 00451 00456 void itemLongTapped(const QModelIndex &index); 00457 00461 void itemLongTapped(const QModelIndex &index, const QPointF &position); 00462 00466 void panningStarted(); 00467 00471 void panningStopped(); 00472 00473 protected: 00474 MList(MListPrivate *dd, MListModel *model, QGraphicsItem *parent); 00475 00479 virtual void updateData(const QList<const char *>& modifications); 00480 00484 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); 00485 00489 virtual void keyPressEvent(QKeyEvent *event); 00490 00494 virtual void connectNotify(const char *signal); 00495 00499 virtual void disconnectNotify(const char *signal); 00500 00501 private: 00502 Q_DECLARE_PRIVATE(MList) 00503 Q_DISABLE_COPY(MList) 00504 friend class MListView; 00505 }; 00506 00507 Q_DECLARE_OPERATORS_FOR_FLAGS(MList::ListOptimizationFlags) 00508 00509 #endif
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:21 (PDT) Doxygen 1.7.1 |
MeeGo Touch |