| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qlistview.h:1 -->
|
|---|
| 3 | <html>
|
|---|
| 4 | <head>
|
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|---|
| 6 | <title>qlistview.h Include File</title>
|
|---|
| 7 | <style type="text/css"><!--
|
|---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
|---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
|---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
|---|
| 11 | body { background: #ffffff; color: black; }
|
|---|
| 12 | --></style>
|
|---|
| 13 | </head>
|
|---|
| 14 | <body>
|
|---|
| 15 |
|
|---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|---|
| 17 | <tr bgcolor="#E5E5E5">
|
|---|
| 18 | <td valign=center>
|
|---|
| 19 | <a href="index.html">
|
|---|
| 20 | <font color="#004faf">Home</font></a>
|
|---|
| 21 | | <a href="classes.html">
|
|---|
| 22 | <font color="#004faf">All Classes</font></a>
|
|---|
| 23 | | <a href="mainclasses.html">
|
|---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
|---|
| 25 | | <a href="annotated.html">
|
|---|
| 26 | <font color="#004faf">Annotated</font></a>
|
|---|
| 27 | | <a href="groups.html">
|
|---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
|---|
| 29 | | <a href="functions.html">
|
|---|
| 30 | <font color="#004faf">Functions</font></a>
|
|---|
| 31 | </td>
|
|---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qlistview.h</h1>
|
|---|
| 33 |
|
|---|
| 34 | <p>This is the verbatim text of the qlistview.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
|---|
| 35 | <hr>
|
|---|
| 36 | <pre>
|
|---|
| 37 | /****************************************************************************
|
|---|
| 38 | ** $Id: qlistview-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
|---|
| 39 | **
|
|---|
| 40 | ** Definition of QListView widget class
|
|---|
| 41 | **
|
|---|
| 42 | ** Created : 970809
|
|---|
| 43 | **
|
|---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|---|
| 45 | **
|
|---|
| 46 | ** This file is part of the widgets module of the Qt GUI Toolkit.
|
|---|
| 47 | **
|
|---|
| 48 | ** This file may be distributed under the terms of the Q Public License
|
|---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
|---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
|
|---|
| 51 | **
|
|---|
| 52 | ** This file may be distributed and/or modified under the terms of the
|
|---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
|
|---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 55 | ** packaging of this file.
|
|---|
| 56 | **
|
|---|
| 57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|---|
| 58 | ** licenses may use this file in accordance with the Qt Commercial License
|
|---|
| 59 | ** Agreement provided with the Software.
|
|---|
| 60 | **
|
|---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 63 | **
|
|---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|---|
| 65 | ** information about Qt Commercial License Agreements.
|
|---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|---|
| 68 | **
|
|---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
|---|
| 70 | ** not clear to you.
|
|---|
| 71 | **
|
|---|
| 72 | **********************************************************************/
|
|---|
| 73 |
|
|---|
| 74 | #ifndef QLISTVIEW_H
|
|---|
| 75 | #define QLISTVIEW_H
|
|---|
| 76 |
|
|---|
| 77 | #ifndef QT_H
|
|---|
| 78 | #include "qscrollview.h"
|
|---|
| 79 | #endif // QT_H
|
|---|
| 80 |
|
|---|
| 81 | #ifndef QT_NO_LISTVIEW
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 | class QPixmap;
|
|---|
| 85 | class QFont;
|
|---|
| 86 | class QHeader;
|
|---|
| 87 | class QIconSet;
|
|---|
| 88 |
|
|---|
| 89 | class QListView;
|
|---|
| 90 | struct QListViewPrivate;
|
|---|
| 91 | struct QCheckListItemPrivate;
|
|---|
| 92 | class QListViewItemIterator;
|
|---|
| 93 | struct QListViewItemIteratorPrivate;
|
|---|
| 94 | class QDragObject;
|
|---|
| 95 | class QMimeSource;
|
|---|
| 96 | class QLineEdit;
|
|---|
| 97 | class QListViewToolTip;
|
|---|
| 98 |
|
|---|
| 99 | class Q_EXPORT QListViewItem : public Qt
|
|---|
| 100 | {
|
|---|
| 101 | friend class QListViewItemIterator;
|
|---|
| 102 | friend class QListViewToolTip;
|
|---|
| 103 |
|
|---|
| 104 | public:
|
|---|
| 105 | QListViewItem( QListView * parent );
|
|---|
| 106 | QListViewItem( QListViewItem * parent );
|
|---|
| 107 | QListViewItem( QListView * parent, QListViewItem * after );
|
|---|
| 108 | QListViewItem( QListViewItem * parent, QListViewItem * after );
|
|---|
| 109 |
|
|---|
| 110 | QListViewItem( QListView * parent,
|
|---|
| 111 | QString, QString = QString::null,
|
|---|
| 112 | QString = QString::null, QString = QString::null,
|
|---|
| 113 | QString = QString::null, QString = QString::null,
|
|---|
| 114 | QString = QString::null, QString = QString::null );
|
|---|
| 115 | QListViewItem( QListViewItem * parent,
|
|---|
| 116 | QString, QString = QString::null,
|
|---|
| 117 | QString = QString::null, QString = QString::null,
|
|---|
| 118 | QString = QString::null, QString = QString::null,
|
|---|
| 119 | QString = QString::null, QString = QString::null );
|
|---|
| 120 |
|
|---|
| 121 | QListViewItem( QListView * parent, QListViewItem * after,
|
|---|
| 122 | QString, QString = QString::null,
|
|---|
| 123 | QString = QString::null, QString = QString::null,
|
|---|
| 124 | QString = QString::null, QString = QString::null,
|
|---|
| 125 | QString = QString::null, QString = QString::null );
|
|---|
| 126 | QListViewItem( QListViewItem * parent, QListViewItem * after,
|
|---|
| 127 | QString, QString = QString::null,
|
|---|
| 128 | QString = QString::null, QString = QString::null,
|
|---|
| 129 | QString = QString::null, QString = QString::null,
|
|---|
| 130 | QString = QString::null, QString = QString::null );
|
|---|
| 131 | virtual ~QListViewItem();
|
|---|
| 132 |
|
|---|
| 133 | virtual void insertItem( QListViewItem * );
|
|---|
| 134 | virtual void takeItem( QListViewItem * );
|
|---|
| 135 | virtual void removeItem( QListViewItem *item ) { takeItem( item ); } //obsolete, use takeItem instead
|
|---|
| 136 |
|
|---|
| 137 | int height() const;
|
|---|
| 138 | virtual void invalidateHeight();
|
|---|
| 139 | int totalHeight() const;
|
|---|
| 140 | virtual int width( const QFontMetrics&,
|
|---|
| 141 | const QListView*, int column) const;
|
|---|
| 142 | void widthChanged(int column=-1) const;
|
|---|
| 143 | int depth() const;
|
|---|
| 144 |
|
|---|
| 145 | virtual void setText( int, const QString &);
|
|---|
| 146 | virtual QString text( int ) const;
|
|---|
| 147 |
|
|---|
| 148 | virtual void setPixmap( int, const QPixmap & );
|
|---|
| 149 | virtual const QPixmap * pixmap( int ) const;
|
|---|
| 150 |
|
|---|
| 151 | virtual QString key( int, bool ) const;
|
|---|
| 152 | virtual int compare( QListViewItem *i, int col, bool ) const;
|
|---|
| 153 | virtual void sortChildItems( int, bool );
|
|---|
| 154 |
|
|---|
| 155 | int childCount() const { return nChildren; }
|
|---|
| 156 |
|
|---|
| 157 | bool isOpen() const { return open; }
|
|---|
| 158 | virtual void setOpen( bool );
|
|---|
| 159 | virtual void setup();
|
|---|
| 160 |
|
|---|
| 161 | virtual void setSelected( bool );
|
|---|
| 162 | bool isSelected() const { return selected; }
|
|---|
| 163 |
|
|---|
| 164 | virtual void paintCell( QPainter *, const QColorGroup & cg,
|
|---|
| 165 | int column, int width, int alignment );
|
|---|
| 166 | virtual void paintBranches( QPainter * p, const QColorGroup & cg,
|
|---|
| 167 | int w, int y, int h );
|
|---|
| 168 | virtual void paintFocus( QPainter *, const QColorGroup & cg,
|
|---|
| 169 | const QRect & r );
|
|---|
| 170 |
|
|---|
| 171 | QListViewItem * firstChild() const;
|
|---|
| 172 | QListViewItem * nextSibling() const { return siblingItem; }
|
|---|
| 173 | QListViewItem * parent() const;
|
|---|
| 174 |
|
|---|
| 175 | QListViewItem * itemAbove();
|
|---|
| 176 | QListViewItem * itemBelow();
|
|---|
| 177 |
|
|---|
| 178 | int itemPos() const;
|
|---|
| 179 |
|
|---|
| 180 | QListView *listView() const;
|
|---|
| 181 |
|
|---|
| 182 | virtual void setSelectable( bool enable );
|
|---|
| 183 | bool isSelectable() const { return selectable && enabled; }
|
|---|
| 184 |
|
|---|
| 185 | virtual void setExpandable( bool );
|
|---|
| 186 | bool isExpandable() const { return expandable; }
|
|---|
| 187 |
|
|---|
| 188 | void repaint() const;
|
|---|
| 189 |
|
|---|
| 190 | virtual void sort();
|
|---|
| 191 | void moveItem( QListViewItem *after );
|
|---|
| 192 |
|
|---|
| 193 | virtual void setDragEnabled( bool allow );
|
|---|
| 194 | virtual void setDropEnabled( bool allow );
|
|---|
| 195 | bool dragEnabled() const;
|
|---|
| 196 | bool dropEnabled() const;
|
|---|
| 197 | virtual bool acceptDrop( const QMimeSource *mime ) const;
|
|---|
| 198 |
|
|---|
| 199 | void setVisible( bool b );
|
|---|
| 200 | bool isVisible() const;
|
|---|
| 201 |
|
|---|
| 202 | virtual void setRenameEnabled( int col, bool b );
|
|---|
| 203 | bool renameEnabled( int col ) const;
|
|---|
| 204 | virtual void startRename( int col );
|
|---|
| 205 |
|
|---|
| 206 | virtual void setEnabled( bool b );
|
|---|
| 207 | bool isEnabled() const;
|
|---|
| 208 |
|
|---|
| 209 | virtual int rtti() const;
|
|---|
| 210 | // ### Qt 4: make const or better use an enum
|
|---|
| 211 | static int RTTI;
|
|---|
| 212 |
|
|---|
| 213 | virtual void setMultiLinesEnabled( bool b );
|
|---|
| 214 | bool multiLinesEnabled() const;
|
|---|
| 215 |
|
|---|
| 216 | protected:
|
|---|
| 217 | virtual void enforceSortOrder() const;
|
|---|
| 218 | virtual void setHeight( int );
|
|---|
| 219 | virtual void activate();
|
|---|
| 220 |
|
|---|
| 221 | bool activatedPos( QPoint & );
|
|---|
| 222 | #ifndef QT_NO_DRAGANDDROP
|
|---|
| 223 | virtual void dropped( QDropEvent *e );
|
|---|
| 224 | #endif
|
|---|
| 225 | virtual void dragEntered();
|
|---|
| 226 | virtual void dragLeft();
|
|---|
| 227 | virtual void okRename( int col );
|
|---|
| 228 | virtual void cancelRename( int col );
|
|---|
| 229 |
|
|---|
| 230 | void ignoreDoubleClick();
|
|---|
| 231 |
|
|---|
| 232 | private:
|
|---|
| 233 | void init();
|
|---|
| 234 | void moveToJustAfter( QListViewItem * );
|
|---|
| 235 | void enforceSortOrderBackToRoot();
|
|---|
| 236 | void removeRenameBox();
|
|---|
| 237 |
|
|---|
| 238 | int ownHeight;
|
|---|
| 239 | int maybeTotalHeight;
|
|---|
| 240 | int nChildren;
|
|---|
| 241 |
|
|---|
| 242 | uint lsc: 14;
|
|---|
| 243 | uint lso: 1;
|
|---|
| 244 | uint open : 1;
|
|---|
| 245 | uint selected : 1;
|
|---|
| 246 | uint selectable: 1;
|
|---|
| 247 | uint configured: 1;
|
|---|
| 248 | uint expandable: 1;
|
|---|
| 249 | uint is_root: 1;
|
|---|
| 250 | uint allow_drag : 1;
|
|---|
| 251 | uint allow_drop : 1;
|
|---|
| 252 | uint visible : 1;
|
|---|
| 253 | uint enabled : 1;
|
|---|
| 254 | uint mlenabled : 1;
|
|---|
| 255 |
|
|---|
| 256 | QListViewItem * parentItem;
|
|---|
| 257 | QListViewItem * siblingItem;
|
|---|
| 258 | QListViewItem * childItem;
|
|---|
| 259 | QLineEdit *renameBox;
|
|---|
| 260 | int renameCol;
|
|---|
| 261 |
|
|---|
| 262 | void * columns;
|
|---|
| 263 |
|
|---|
| 264 | friend class QListView;
|
|---|
| 265 | };
|
|---|
| 266 |
|
|---|
| 267 | class QCheckListItem;
|
|---|
| 268 |
|
|---|
| 269 | class Q_EXPORT QListView: public QScrollView
|
|---|
| 270 | {
|
|---|
| 271 | friend class QListViewItemIterator;
|
|---|
| 272 | friend class QListViewItem;
|
|---|
| 273 | friend class QCheckListItem;
|
|---|
| 274 | friend class QListViewToolTip;
|
|---|
| 275 |
|
|---|
| 276 | Q_OBJECT
|
|---|
| 277 | Q_ENUMS( SelectionMode ResizeMode RenameAction )
|
|---|
| 278 | Q_PROPERTY( int columns READ columns )
|
|---|
| 279 | Q_PROPERTY( bool multiSelection READ isMultiSelection WRITE setMultiSelection DESIGNABLE false )
|
|---|
| 280 | Q_PROPERTY( SelectionMode selectionMode READ selectionMode WRITE setSelectionMode )
|
|---|
| 281 | Q_PROPERTY( int childCount READ childCount )
|
|---|
| 282 | Q_PROPERTY( bool allColumnsShowFocus READ allColumnsShowFocus WRITE setAllColumnsShowFocus )
|
|---|
| 283 | Q_PROPERTY( bool showSortIndicator READ showSortIndicator WRITE setShowSortIndicator )
|
|---|
| 284 | Q_PROPERTY( int itemMargin READ itemMargin WRITE setItemMargin )
|
|---|
| 285 | Q_PROPERTY( bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated )
|
|---|
| 286 | Q_PROPERTY( bool showToolTips READ showToolTips WRITE setShowToolTips )
|
|---|
| 287 | Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode )
|
|---|
| 288 | Q_PROPERTY( int treeStepSize READ treeStepSize WRITE setTreeStepSize )
|
|---|
| 289 | Q_PROPERTY( RenameAction defaultRenameAction READ defaultRenameAction WRITE setDefaultRenameAction )
|
|---|
| 290 |
|
|---|
| 291 | public:
|
|---|
| 292 | QListView( QWidget* parent=0, const char* name=0, WFlags f = 0 );
|
|---|
| 293 | ~QListView();
|
|---|
| 294 |
|
|---|
| 295 | int treeStepSize() const;
|
|---|
| 296 | virtual void setTreeStepSize( int );
|
|---|
| 297 |
|
|---|
| 298 | virtual void insertItem( QListViewItem * );
|
|---|
| 299 | virtual void takeItem( QListViewItem * );
|
|---|
| 300 | virtual void removeItem( QListViewItem *item ) { takeItem( item ); } // obsolete, use takeItem instead
|
|---|
| 301 |
|
|---|
| 302 | QHeader * header() const;
|
|---|
| 303 |
|
|---|
| 304 | virtual int addColumn( const QString &label, int size = -1);
|
|---|
| 305 | virtual int addColumn( const QIconSet& iconset, const QString &label, int size = -1);
|
|---|
| 306 | virtual void removeColumn( int index );
|
|---|
| 307 | virtual void setColumnText( int column, const QString &label );
|
|---|
| 308 | virtual void setColumnText( int column, const QIconSet& iconset, const QString &label );
|
|---|
| 309 | QString columnText( int column ) const;
|
|---|
| 310 | virtual void setColumnWidth( int column, int width );
|
|---|
| 311 | int columnWidth( int column ) const;
|
|---|
| 312 | enum WidthMode { Manual, Maximum };
|
|---|
| 313 | virtual void setColumnWidthMode( int column, WidthMode );
|
|---|
| 314 | WidthMode columnWidthMode( int column ) const;
|
|---|
| 315 | int columns() const;
|
|---|
| 316 |
|
|---|
| 317 | virtual void setColumnAlignment( int, int );
|
|---|
| 318 | int columnAlignment( int ) const;
|
|---|
| 319 |
|
|---|
| 320 | void show();
|
|---|
| 321 |
|
|---|
| 322 | QListViewItem * itemAt( const QPoint & screenPos ) const;
|
|---|
| 323 | QRect itemRect( const QListViewItem * ) const;
|
|---|
| 324 | int itemPos( const QListViewItem * );
|
|---|
| 325 |
|
|---|
| 326 | void ensureItemVisible( const QListViewItem * );
|
|---|
| 327 |
|
|---|
| 328 | void repaintItem( const QListViewItem * ) const;
|
|---|
| 329 |
|
|---|
| 330 | virtual void setMultiSelection( bool enable );
|
|---|
| 331 | bool isMultiSelection() const;
|
|---|
| 332 |
|
|---|
| 333 | enum SelectionMode { Single, Multi, Extended, NoSelection };
|
|---|
| 334 | void setSelectionMode( SelectionMode mode );
|
|---|
| 335 | SelectionMode selectionMode() const;
|
|---|
| 336 |
|
|---|
| 337 | virtual void clearSelection();
|
|---|
| 338 | virtual void setSelected( QListViewItem *, bool );
|
|---|
| 339 | void setSelectionAnchor( QListViewItem * );
|
|---|
| 340 | bool isSelected( const QListViewItem * ) const;
|
|---|
| 341 | QListViewItem * selectedItem() const;
|
|---|
| 342 | virtual void setOpen( QListViewItem *, bool );
|
|---|
| 343 | bool isOpen( const QListViewItem * ) const;
|
|---|
| 344 |
|
|---|
| 345 | virtual void setCurrentItem( QListViewItem * );
|
|---|
| 346 | QListViewItem * currentItem() const;
|
|---|
| 347 |
|
|---|
| 348 | QListViewItem * firstChild() const;
|
|---|
| 349 | QListViewItem * lastItem() const;
|
|---|
| 350 |
|
|---|
| 351 | int childCount() const;
|
|---|
| 352 |
|
|---|
| 353 | virtual void setAllColumnsShowFocus( bool );
|
|---|
| 354 | bool allColumnsShowFocus() const;
|
|---|
| 355 |
|
|---|
| 356 | virtual void setItemMargin( int );
|
|---|
| 357 | int itemMargin() const;
|
|---|
| 358 |
|
|---|
| 359 | virtual void setRootIsDecorated( bool );
|
|---|
| 360 | bool rootIsDecorated() const;
|
|---|
| 361 |
|
|---|
| 362 | virtual void setSorting( int column, bool ascending = TRUE );
|
|---|
| 363 | int sortColumn() const;
|
|---|
| 364 | void setSortColumn( int column );
|
|---|
| 365 | SortOrder sortOrder() const;
|
|---|
| 366 | void setSortOrder( SortOrder order );
|
|---|
| 367 | virtual void sort();
|
|---|
| 368 |
|
|---|
| 369 | virtual void setFont( const QFont & );
|
|---|
| 370 | virtual void setPalette( const QPalette & );
|
|---|
| 371 |
|
|---|
| 372 | bool eventFilter( QObject * o, QEvent * );
|
|---|
| 373 |
|
|---|
| 374 | QSize sizeHint() const;
|
|---|
| 375 | QSize minimumSizeHint() const;
|
|---|
| 376 |
|
|---|
| 377 | virtual void setShowSortIndicator( bool show );
|
|---|
| 378 | bool showSortIndicator() const;
|
|---|
| 379 | virtual void setShowToolTips( bool b );
|
|---|
| 380 | bool showToolTips() const;
|
|---|
| 381 |
|
|---|
| 382 | enum ResizeMode { NoColumn, AllColumns, LastColumn };
|
|---|
| 383 | virtual void setResizeMode( ResizeMode m );
|
|---|
| 384 | ResizeMode resizeMode() const;
|
|---|
| 385 |
|
|---|
| 386 | QListViewItem * findItem( const QString& text, int column, ComparisonFlags compare = ExactMatch | CaseSensitive ) const;
|
|---|
| 387 |
|
|---|
| 388 | enum RenameAction { Accept, Reject };
|
|---|
| 389 | virtual void setDefaultRenameAction( RenameAction a );
|
|---|
| 390 | RenameAction defaultRenameAction() const;
|
|---|
| 391 | bool isRenaming() const;
|
|---|
| 392 |
|
|---|
| 393 | void hideColumn( int column );
|
|---|
| 394 |
|
|---|
| 395 | public slots:
|
|---|
| 396 | virtual void clear();
|
|---|
| 397 | virtual void invertSelection();
|
|---|
| 398 | virtual void selectAll( bool select );
|
|---|
| 399 | void triggerUpdate();
|
|---|
| 400 | void setContentsPos( int x, int y );
|
|---|
| 401 | void adjustColumn( int col );
|
|---|
| 402 |
|
|---|
| 403 | signals:
|
|---|
| 404 | void selectionChanged();
|
|---|
| 405 | void selectionChanged( QListViewItem * );
|
|---|
| 406 | void currentChanged( QListViewItem * );
|
|---|
| 407 | void clicked( QListViewItem * );
|
|---|
| 408 | void clicked( QListViewItem *, const QPoint &, int );
|
|---|
| 409 | void pressed( QListViewItem * );
|
|---|
| 410 | void pressed( QListViewItem *, const QPoint &, int );
|
|---|
| 411 |
|
|---|
| 412 | void doubleClicked( QListViewItem * );
|
|---|
| 413 | void doubleClicked( QListViewItem *, const QPoint&, int );
|
|---|
| 414 | void returnPressed( QListViewItem * );
|
|---|
| 415 | void spacePressed( QListViewItem * );
|
|---|
| 416 | void rightButtonClicked( QListViewItem *, const QPoint&, int );
|
|---|
| 417 | void rightButtonPressed( QListViewItem *, const QPoint&, int );
|
|---|
| 418 | void mouseButtonPressed( int, QListViewItem *, const QPoint& , int );
|
|---|
| 419 | void mouseButtonClicked( int, QListViewItem *, const QPoint&, int );
|
|---|
| 420 |
|
|---|
| 421 | void contextMenuRequested( QListViewItem *, const QPoint &, int );
|
|---|
| 422 |
|
|---|
| 423 | void onItem( QListViewItem *item );
|
|---|
| 424 | void onViewport();
|
|---|
| 425 |
|
|---|
| 426 | void expanded( QListViewItem *item );
|
|---|
| 427 | void collapsed( QListViewItem *item );
|
|---|
| 428 | #ifndef QT_NO_DRAGANDDROP
|
|---|
| 429 | void dropped( QDropEvent *e );
|
|---|
| 430 | #endif
|
|---|
| 431 | void itemRenamed( QListViewItem *item, int col, const QString & );
|
|---|
| 432 | void itemRenamed( QListViewItem *item, int col );
|
|---|
| 433 |
|
|---|
| 434 | protected:
|
|---|
| 435 | void contentsMousePressEvent( QMouseEvent * e );
|
|---|
| 436 | void contentsMouseReleaseEvent( QMouseEvent * e );
|
|---|
| 437 | void contentsMouseMoveEvent( QMouseEvent * e );
|
|---|
| 438 | void contentsMouseDoubleClickEvent( QMouseEvent * e );
|
|---|
| 439 | void contentsContextMenuEvent( QContextMenuEvent * e );
|
|---|
| 440 | #ifndef QT_NO_DRAGANDDROP
|
|---|
| 441 | void contentsDragEnterEvent( QDragEnterEvent *e );
|
|---|
| 442 | void contentsDragMoveEvent( QDragMoveEvent *e );
|
|---|
| 443 | void contentsDragLeaveEvent( QDragLeaveEvent *e );
|
|---|
| 444 | void contentsDropEvent( QDropEvent *e );
|
|---|
| 445 | virtual QDragObject *dragObject();
|
|---|
| 446 | virtual void startDrag();
|
|---|
| 447 | #endif
|
|---|
| 448 |
|
|---|
| 449 | void focusInEvent( QFocusEvent * e );
|
|---|
| 450 | void focusOutEvent( QFocusEvent * e );
|
|---|
| 451 |
|
|---|
| 452 | void keyPressEvent( QKeyEvent *e );
|
|---|
| 453 |
|
|---|
| 454 | void resizeEvent( QResizeEvent *e );
|
|---|
| 455 | void viewportResizeEvent( QResizeEvent *e );
|
|---|
| 456 |
|
|---|
| 457 | void showEvent( QShowEvent * );
|
|---|
| 458 |
|
|---|
| 459 | void drawContentsOffset( QPainter *, int ox, int oy,
|
|---|
| 460 | int cx, int cy, int cw, int ch );
|
|---|
| 461 |
|
|---|
| 462 | virtual void paintEmptyArea( QPainter *, const QRect & );
|
|---|
| 463 | void styleChange( QStyle& );
|
|---|
| 464 | void windowActivationChange( bool );
|
|---|
| 465 |
|
|---|
| 466 | protected slots:
|
|---|
| 467 | void updateContents();
|
|---|
| 468 | void doAutoScroll();
|
|---|
| 469 |
|
|---|
| 470 | private slots:
|
|---|
| 471 | void changeSortColumn( int );
|
|---|
| 472 | void handleIndexChange();
|
|---|
| 473 | void updateDirtyItems();
|
|---|
| 474 | void makeVisible();
|
|---|
| 475 | void handleSizeChange( int, int, int );
|
|---|
| 476 | void startRename();
|
|---|
| 477 | void openFocusItem();
|
|---|
| 478 |
|
|---|
| 479 | private:
|
|---|
| 480 | void contentsMousePressEventEx( QMouseEvent * e );
|
|---|
| 481 | void contentsMouseReleaseEventEx( QMouseEvent * e );
|
|---|
| 482 | void init();
|
|---|
| 483 | void updateGeometries();
|
|---|
| 484 | void buildDrawableList() const;
|
|---|
| 485 | void reconfigureItems();
|
|---|
| 486 | void widthChanged(const QListViewItem*, int c);
|
|---|
| 487 | void handleItemChange( QListViewItem *old, bool shift, bool control );
|
|---|
| 488 | void selectRange( QListViewItem *from, QListViewItem *to, bool invert, bool includeFirst, bool clearSel = FALSE );
|
|---|
| 489 | bool selectRange( QListViewItem *newItem, QListViewItem *oldItem, QListViewItem *anchorItem );
|
|---|
| 490 | bool clearRange( QListViewItem *from, QListViewItem *to, bool includeFirst = TRUE );
|
|---|
| 491 | void doAutoScroll( const QPoint &cursorPos );
|
|---|
| 492 |
|
|---|
| 493 | QListViewPrivate * d;
|
|---|
| 494 |
|
|---|
| 495 | private: // Disabled copy constructor and operator=
|
|---|
| 496 | #if defined(Q_DISABLE_COPY)
|
|---|
| 497 | QListView( const QListView & );
|
|---|
| 498 | QListView &operator=( const QListView & );
|
|---|
| 499 | #endif
|
|---|
| 500 | };
|
|---|
| 501 |
|
|---|
| 502 |
|
|---|
| 503 | class Q_EXPORT QCheckListItem : public QListViewItem
|
|---|
| 504 | {
|
|---|
| 505 | public:
|
|---|
| 506 | enum Type { RadioButton,
|
|---|
| 507 | CheckBox,
|
|---|
| 508 | Controller,
|
|---|
| 509 | RadioButtonController=Controller,
|
|---|
| 510 | CheckBoxController };
|
|---|
| 511 | // ### should be integrated with qbutton in ver4 perhaps
|
|---|
| 512 | enum ToggleState { Off, NoChange, On };
|
|---|
| 513 |
|
|---|
| 514 | QCheckListItem( QCheckListItem *parent, const QString &text,
|
|---|
| 515 | Type = RadioButtonController );
|
|---|
| 516 | QCheckListItem( QCheckListItem *parent, QListViewItem *after,
|
|---|
| 517 | const QString &text, Type = RadioButtonController );
|
|---|
| 518 | QCheckListItem( QListViewItem *parent, const QString &text,
|
|---|
| 519 | Type = RadioButtonController );
|
|---|
| 520 | QCheckListItem( QListViewItem *parent, QListViewItem *after,
|
|---|
| 521 | const QString &text, Type = RadioButtonController );
|
|---|
| 522 | QCheckListItem( QListView *parent, const QString &text,
|
|---|
| 523 | Type = RadioButtonController );
|
|---|
| 524 | QCheckListItem( QListView *parent, QListViewItem *after,
|
|---|
| 525 | const QString &text, Type = RadioButtonController );
|
|---|
| 526 | QCheckListItem( QListViewItem *parent, const QString &text,
|
|---|
| 527 | const QPixmap & );
|
|---|
| 528 | QCheckListItem( QListView *parent, const QString &text,
|
|---|
| 529 | const QPixmap & );
|
|---|
| 530 | ~QCheckListItem();
|
|---|
| 531 |
|
|---|
| 532 | void paintCell( QPainter *, const QColorGroup & cg,
|
|---|
| 533 | int column, int width, int alignment );
|
|---|
| 534 | virtual void paintFocus( QPainter *, const QColorGroup & cg,
|
|---|
| 535 | const QRect & r );
|
|---|
| 536 | int width( const QFontMetrics&, const QListView*, int column) const;
|
|---|
| 537 | void setup();
|
|---|
| 538 |
|
|---|
| 539 | virtual void setOn( bool ); // ### should be replaced by setChecked in ver4
|
|---|
| 540 | bool isOn() const { return on; }
|
|---|
| 541 | Type type() const { return myType; }
|
|---|
| 542 | QString text() const { return QListViewItem::text( 0 ); }
|
|---|
| 543 | QString text( int n ) const { return QListViewItem::text( n ); }
|
|---|
| 544 |
|
|---|
| 545 | void setTristate( bool );
|
|---|
| 546 | bool isTristate() const;
|
|---|
| 547 | ToggleState state() const;
|
|---|
| 548 | void setState( ToggleState s);
|
|---|
| 549 |
|
|---|
| 550 | int rtti() const;
|
|---|
| 551 | static int RTTI;
|
|---|
| 552 |
|
|---|
| 553 | protected:
|
|---|
| 554 | void activate();
|
|---|
| 555 | void turnOffChild();
|
|---|
| 556 | virtual void stateChange( bool );
|
|---|
| 557 |
|
|---|
| 558 | private:
|
|---|
| 559 | void init();
|
|---|
| 560 | ToggleState internalState() const;
|
|---|
| 561 | void setStoredState( ToggleState newState, void *key );
|
|---|
| 562 | ToggleState storedState( void *key ) const;
|
|---|
| 563 | void stateChange( ToggleState s );
|
|---|
| 564 | void restoreState( void *key, int depth = 0 );
|
|---|
| 565 | void updateController( bool update = TRUE , bool store = FALSE );
|
|---|
| 566 | void updateStoredState( void *key );
|
|---|
| 567 | void setState( ToggleState s, bool update, bool store );
|
|---|
| 568 | void setCurrentState( ToggleState s );
|
|---|
| 569 |
|
|---|
| 570 | Type myType;
|
|---|
| 571 | bool on; // ### remove in ver4
|
|---|
| 572 | QCheckListItemPrivate *d;
|
|---|
| 573 | };
|
|---|
| 574 |
|
|---|
| 575 | class Q_EXPORT QListViewItemIterator
|
|---|
| 576 | {
|
|---|
| 577 | friend struct QListViewPrivate;
|
|---|
| 578 | friend class QListView;
|
|---|
| 579 | friend class QListViewItem;
|
|---|
| 580 |
|
|---|
| 581 | public:
|
|---|
| 582 | enum IteratorFlag {
|
|---|
| 583 | Visible = 0x00000001,
|
|---|
| 584 | Invisible = 0x00000002,
|
|---|
| 585 | Selected = 0x00000004,
|
|---|
| 586 | Unselected = 0x00000008,
|
|---|
| 587 | Selectable = 0x00000010,
|
|---|
| 588 | NotSelectable = 0x00000020,
|
|---|
| 589 | DragEnabled = 0x00000040,
|
|---|
| 590 | DragDisabled = 0x00000080,
|
|---|
| 591 | DropEnabled = 0x00000100,
|
|---|
| 592 | DropDisabled = 0x00000200,
|
|---|
| 593 | Expandable = 0x00000400,
|
|---|
| 594 | NotExpandable = 0x00000800,
|
|---|
| 595 | Checked = 0x00001000,
|
|---|
| 596 | NotChecked = 0x00002000
|
|---|
| 597 | };
|
|---|
| 598 |
|
|---|
| 599 | QListViewItemIterator();
|
|---|
| 600 | QListViewItemIterator( QListViewItem *item );
|
|---|
| 601 | QListViewItemIterator( QListViewItem *item, int iteratorFlags );
|
|---|
| 602 |
|
|---|
| 603 | QListViewItemIterator( const QListViewItemIterator &it );
|
|---|
| 604 | QListViewItemIterator( QListView *lv );
|
|---|
| 605 | QListViewItemIterator( QListView *lv, int iteratorFlags );
|
|---|
| 606 |
|
|---|
| 607 | QListViewItemIterator &operator=( const QListViewItemIterator &it );
|
|---|
| 608 |
|
|---|
| 609 | ~QListViewItemIterator();
|
|---|
| 610 |
|
|---|
| 611 | QListViewItemIterator &operator++();
|
|---|
| 612 | const QListViewItemIterator operator++( int );
|
|---|
| 613 | QListViewItemIterator &operator+=( int j );
|
|---|
| 614 |
|
|---|
| 615 | QListViewItemIterator &operator--();
|
|---|
| 616 | const QListViewItemIterator operator--( int );
|
|---|
| 617 | QListViewItemIterator &operator-=( int j );
|
|---|
| 618 |
|
|---|
| 619 | QListViewItem* operator*();
|
|---|
| 620 | QListViewItem *current() const;
|
|---|
| 621 |
|
|---|
| 622 | protected:
|
|---|
| 623 | QListViewItem *curr;
|
|---|
| 624 | QListView *listView;
|
|---|
| 625 |
|
|---|
| 626 | private:
|
|---|
| 627 | QListViewItemIteratorPrivate* d() const;
|
|---|
| 628 | void init( int flags );
|
|---|
| 629 | void addToListView();
|
|---|
| 630 | void currentRemoved();
|
|---|
| 631 | bool matchesFlags( const QListViewItem* ) const;
|
|---|
| 632 | bool testPair( QListViewItemIterator::IteratorFlag, QListViewItemIterator::IteratorFlag, bool ) const;
|
|---|
| 633 | bool isChecked( const QListViewItem* ) const;
|
|---|
| 634 | };
|
|---|
| 635 |
|
|---|
| 636 | #endif // QT_NO_LISTVIEW
|
|---|
| 637 |
|
|---|
| 638 | #endif // QLISTVIEW_H
|
|---|
| 639 | </pre>
|
|---|
| 640 | <!-- eof -->
|
|---|
| 641 | <p><address><hr><div align=center>
|
|---|
| 642 | <table width=100% cellspacing=0 border=0><tr>
|
|---|
| 643 | <td>Copyright © 2007
|
|---|
| 644 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|---|
| 645 | <td align=right><div align=right>Qt 3.3.8</div>
|
|---|
| 646 | </table></div></address></body>
|
|---|
| 647 | </html>
|
|---|