Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QSmoothList Class Reference
[QtBaseModule]

The QSmoothList class provides a view onto a model using a finger scrollable user interface. More...

    #include <QSmoothList>

Inherits QWidget.

Inherited by CallContactListView, QFavoriteServicesList, QSmoothContactListView, QSmoothListWidget, and QSpeedDialList.

Public Types

  • enum ScrollHint { EnsureVisible, PositionAtTop, PositionAtBottom, PositionAtCenter, ImmediateVisible }
  • enum SelectionMode { SingleSelection, NoSelection }

Public Functions

  • 206 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 14 public functions inherited from QPaintDevice

Public Slots

  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Signals

  • void activated ( const QModelIndex & index )
  • void clicked ( const QModelIndex & index )
  • void collapsed ( const QModelIndex & index )
  • void currentChanged ( const QModelIndex & current, const QModelIndex & previous )
  • void doubleClicked ( const QModelIndex & index )
  • void expanded ( const QModelIndex & index )
  • void pressed ( const QModelIndex & index )

Additional Inherited Members

  • 57 properties inherited from QWidget
  • 1 property inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QWidget
  • 4 static public members inherited from QObject
  • 38 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget
  • 2 protected variables inherited from QObject
  • 1 protected type inherited from QPaintDevice

Detailed Description

The QSmoothList class provides a view onto a model using a finger scrollable user interface.

QSmoothList implements the interfaces defined by the QAbstractItemView class to allow it to display data provided by models derived from the QAbstractItemModel class. A QSmoothList presents items stored in a model as a simple non-hierarchical list, or in a single-column hierarchical tree. If QSmoothList is provided with a hierarchical model, it will correctly reflect the hierarchy of model items, but only row zero of each QModelIndex is used to present a view of the items.

QSmoothList is designed to offer a similar interface to QListView; the primary difference is that QSmoothList allows the list position to be manipulated with a finger, facilitating use in touch-screen devices. QSmoothList also offers a subset of the QTreeView interface; items can be programmatically expanded or collapsed. Unlike QTreeView, however, QSmoothList does not support the use of a QHeaderView, and does not support multiple-column presentation.

The location of the QSmoothList can be manipulated by dragging, or by a 'flick' gesture. A flick occurs when a vertical movement is interrupted by a release - a momentum is then imparted to the list which continues to move in the initial direction, subject to a deceleration. The list can also be moved by key events if a suitable input device is available.

A QSmoothList can be used in single-selection mode, or in no-selection mode. Multiple selection is not supported, and must instead be implemented outside the QSmoothList, via a 'checkable' property of the model's items, or similar. Since multiple selection is not supported, QSmoothList does not differentiate between 'selected' and 'current' indices.

QSmoothList supports items of variable heights, as reported by the sizeHint() function of the delegate used to present the list items. However, QSmoothList does not support grid spacing. It is recommended that the delegate used with the QSmoothList should enforce height constraints, to achieve a presentation where items with variable sizes are displayed with uniform space allocations.


Member Type Documentation

enum QSmoothList::ScrollHint

ConstantValueDescription
QSmoothList::EnsureVisible0Scroll to ensure that the item is visible.
QSmoothList::PositionAtTop1Scroll to position the item at the top of the viewport.
QSmoothList::PositionAtBottom2Scroll to position the item at the bottom of the viewport.
QSmoothList::PositionAtCenter3Scroll to position the item at the center of the viewport.
QSmoothList::ImmediateVisible4Reposition the list without animation to ensure that the item is visible.

enum QSmoothList::SelectionMode

This enum indicates how the list responds to user selections:

ConstantValueDescription
QSmoothList::SingleSelection0When the user selects an item, any already-selected item becomes unselected, and the user cannot unselect the selected item.
QSmoothList::NoSelection1Items cannot be selected.


Member Function Documentation

QSmoothList::QSmoothList ( QWidget * parent = 0, Qt::WFlags flags = 0 )

Creates a new QSmoothList with the given parent and flags to view a model. Use setModel() to set the model.

QSmoothList::~QSmoothList ()   [virtual]

Destroys the list.

void QSmoothList::activated ( const QModelIndex & index )   [signal]

This signal is emitted when the item specified by index is activated by the user. How to activate items depends on the platform; e.g., by single- or double-clicking the item, or by pressing the Return or Enter key when the item is current.

See also clicked(), doubleClicked(), and pressed().

void QSmoothList::clearSelection ()   [slot]

Deselects the selected item, if any.

void QSmoothList::clicked ( const QModelIndex & index )   [signal]

This signal is emitted when a mouse button is clicked. The item the mouse was clicked on is specified by index. The signal is only emitted when the index is valid.

See also activated(), doubleClicked(), and pressed().

void QSmoothList::collapse ( const QModelIndex & index )   [slot]

Collapses the model item specified by the index.

See also collapsed().

void QSmoothList::collapseAll ()   [slot]

Collapses all expanded items.

See also expandAll(), expand(), collapse(), and setExpanded().

void QSmoothList::collapsed ( const QModelIndex & index )   [signal]

This signal is emitted when the item specified by index is collapsed.

See also expanded() and setExpanded().

void QSmoothList::currentChanged ( const QModelIndex & current, const QModelIndex & previous )   [signal]

This signal is emitted when a new item becomes the current item. The previous current item is specified by the previous index, and the new item by the current index.

See also currentIndex() and setCurrentIndex().

QModelIndex QSmoothList::currentIndex () const

Returns the model index of the current item, if any.

See also setCurrentIndex().

void QSmoothList::doubleClicked ( const QModelIndex & index )   [signal]

This signal is emitted when a mouse button is double-clicked. The item the mouse was double-clicked on is specified by index. The signal is only emitted when the index is valid.

See also clicked() and activated().

void QSmoothList::expand ( const QModelIndex & index )   [slot]

Expands the model item specified by the index.

See also expanded().

void QSmoothList::expandAll ()   [slot]

Expands all expandable items.

See also collapseAll(), expand(), collapse(), and setExpanded().

void QSmoothList::expanded ( const QModelIndex & index )   [signal]

This signal is emitted when the item specified by index is expanded.

See also collapsed() and setExpanded().

bool QSmoothList::hasOpaqueItemBackground () const

Returns true if the list has been set to paint items with opaque backgrounds.

QSize QSmoothList::iconSize () const

Returns the size at which icons should be drawn when painting list items.

See also setIconSize().

QModelIndex QSmoothList::indexAt ( const QPoint & point ) const

Returns the model index of the item at the viewport coordinates point.

See also visualRect().

bool QSmoothList::isExpanded ( const QModelIndex & index ) const

Returns true if the model item index is expanded; otherwise returns false.

See also expand(), expanded(), and setExpanded().

QAbstractItemDelegate * QSmoothList::itemDelegate () const

Returns the item delegate used by this view and model. This is either one set with setItemDelegate(), or the default one.

See also setItemDelegate().

QAbstractItemModel * QSmoothList::model () const

Returns the model that this list is viewing.

See also setModel().

void QSmoothList::pressed ( const QModelIndex & index )   [signal]

This signal is emitted when a mouse button is pressed. The item the mouse was pressed on is specified by index. The signal is only emitted when the index is valid.

Use the QApplication::mouseButtons() function to get the state of the mouse buttons.

See also activated(), clicked(), and doubleClicked().

void QSmoothList::reset ()   [slot]

Reset the internal state of the list.

void QSmoothList::scrollTo ( const QModelIndex & index, ScrollHint hint = EnsureVisible )

Scrolls the list if necessary to ensure that the item at index is visible. The list will try to position the item according to the given hint.

void QSmoothList::scrollToBottom ()   [slot]

Scrolls the list to the bottom.

See also scrollTo() and scrollToTop().

void QSmoothList::scrollToTop ()   [slot]

Scrolls the list to the top.

See also scrollTo() and scrollToBottom().

SelectionMode QSmoothList::selectionMode () const

Returns the selection mode of the list.

See also setSelectionMode().

void QSmoothList::setCurrentIndex ( const QModelIndex & index, ScrollHint hint = EnsureVisible )   [slot]

Sets the current item to be the item at index, and if necessary scrolls the list to position the item according to hint. The item will be selected unless selectionMode() is NoSelection.

See also currentIndex(), currentChanged(), and selectionMode().

void QSmoothList::setEmptyText ( const QString & text )

Sets the string text to be displayed instead of the list, when no items are present.

void QSmoothList::setExpanded ( const QModelIndex & index, bool set )

Sets the item referred to by index to either collapsed or expanded, depending on the value of set.

See also expanded(), expand(), and isExpanded().

void QSmoothList::setIconSize ( const QSize & size )

Sets the size at which icons should be drawn when painting list items to size.

Setting this property when the view is visible will cause the items to be laid out again.

See also iconSize().

void QSmoothList::setItemDelegate ( QAbstractItemDelegate * delegate )

Sets the item delegate for this list to delegate. This is useful if you want complete control over the editing and display of items.

Setting this property when the view is visible will cause the items to be laid out again.

See also itemDelegate().

void QSmoothList::setModel ( QAbstractItemModel * model )

Sets the model for the list to present.

The current selection index is reset.

See also model().

void QSmoothList::setOpaqueItemBackground ( bool opaque )

Sets the list items to be painted with opaque backgrounds, if opaque is true. Otherwise, the list items will be painted with transparent backgrounds.

See also hasOpaqueItemBackground().

void QSmoothList::setSelectionMode ( SelectionMode mode )

Sets the selection mode of the list to mode. Multiple-item selection modes are not supported by QSmoothList.

See also selectionMode().

void QSmoothList::setTextElideMode ( Qt::TextElideMode mode )

Sets the mode used to elide text when painting list items to mode.

See also textElideMode().

Qt::TextElideMode QSmoothList::textElideMode () const

Returns the mode used to elide text when painting list items.

See also setTextElideMode().

void QSmoothList::update ( const QModelIndex & index )   [slot]

Updates the area occupied by the given index.

QRect QSmoothList::visualRect ( const QModelIndex & index ) const

Returns the rectangle on the viewport occupied by the item at index.

See also indexAt().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 102
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 53
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 81
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 28
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 229
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 102
  7. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
Page suivante

Le Qt Developer Network au hasard

Logo

Utiliser QML et QtWebKit avec PySide

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web