CopperSpice API  1.7.2
QListWidget Class Reference

Provides an item based list widget. More...

Inheritance diagram for QListWidget:
QListView QAbstractItemView QAbstractScrollArea QFrame QWidget QObject QPaintDevice

Public Signals

void currentItemChanged (QListWidgetItem *current, QListWidgetItem *previous)
 
void currentRowChanged (int currentRow)
 
void currentTextChanged (const QString &currentText)
 
void itemActivated (QListWidgetItem *item)
 
void itemChanged (QListWidgetItem *item)
 
void itemClicked (QListWidgetItem *item)
 
void itemDoubleClicked (QListWidgetItem *item)
 
void itemEntered (QListWidgetItem *item)
 
void itemPressed (QListWidgetItem *item)
 
void itemSelectionChanged ()
 
- Public Signals inherited from QListView
void indexesMoved (const QModelIndexList &indexes)
 
- Public Signals inherited from QAbstractItemView
void activated (const QModelIndex &index)
 
void clicked (const QModelIndex &index)
 
void doubleClicked (const QModelIndex &index)
 
void entered (const QModelIndex &index)
 
void iconSizeChanged (const QSize &size)
 
void pressed (const QModelIndex &index)
 
void viewportEntered ()
 
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void windowTitleChanged (const QString &title)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void clear ()
 
void scrollToItem (const QListWidgetItem *item, QAbstractItemView::ScrollHint hint=EnsureVisible)
 
- Public Slots inherited from QAbstractItemView
void clearSelection ()
 
void edit (const QModelIndex &index)
 
virtual void reset ()
 
void scrollToBottom ()
 
void scrollToTop ()
 
virtual void selectAll ()
 
void setCurrentIndex (const QModelIndex &index)
 
virtual void setRootIndex (const QModelIndex &index)
 
void update (const QModelIndex &index)
 
- Public Slots inherited from QWidget
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void repaint ()
 
void setDisabled (bool disable)
 
void setEnabled (bool enable)
 
void setFocus ()
 
void setHidden (bool hidden)
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool modified)
 
void setWindowTitle (const QString &title)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QListWidget (QWidget *parent=nullptr)
 
 ~QListWidget ()
 
void addItem (const QString &label)
 
void addItem (QListWidgetItem *item)
 
void addItems (const QStringList &labels)
 
void closePersistentEditor (QListWidgetItem *item)
 
int count () const
 
QListWidgetItemcurrentItem () const
 
int currentRow () const
 
void dropEvent (QDropEvent *event) override
 
void editItem (QListWidgetItem *item)
 
QList< QListWidgetItem * > findItems (const QString &text, Qt::MatchFlags flags) const
 
void insertItem (int row, const QString &label)
 
void insertItem (int row, QListWidgetItem *item)
 
void insertItems (int row, const QStringList &labels)
 
bool isItemHidden (const QListWidgetItem *item) const
 
bool isItemSelected (const QListWidgetItem *item) const
 
bool isSortingEnabled () const
 
QListWidgetItemitem (int row) const
 
QListWidgetItemitemAt (const QPoint &p) const
 
QListWidgetItemitemAt (int x, int y) const
 
QWidgetitemWidget (QListWidgetItem *item) const
 
void openPersistentEditor (QListWidgetItem *item)
 
void removeItemWidget (QListWidgetItem *item)
 
int row (const QListWidgetItem *item) const
 
QList< QListWidgetItem * > selectedItems () const
 
void setCurrentItem (QListWidgetItem *item)
 
void setCurrentItem (QListWidgetItem *item, QItemSelectionModel::SelectionFlags command)
 
void setCurrentRow (int row)
 
void setCurrentRow (int row, QItemSelectionModel::SelectionFlags command)
 
void setItemHidden (const QListWidgetItem *item, bool hide)
 
void setItemSelected (const QListWidgetItem *item, bool select)
 
void setItemWidget (QListWidgetItem *item, QWidget *widget)
 
void setSortingEnabled (bool enable)
 
void sortItems (Qt::SortOrder order=Qt::AscendingOrder)
 
QListWidgetItemtakeItem (int row)
 
QRect visualItemRect (const QListWidgetItem *item) const
 
- Public Methods inherited from QListView
 QListView (QWidget *parent=nullptr)
 
 ~QListView ()
 
int batchSize () const
 
void clearPropertyFlags ()
 
Flow flow () const
 
QSize gridSize () const
 
QModelIndex indexAt (const QPoint &p) const override
 
bool isRowHidden (int row) const
 
bool isSelectionRectVisible () const
 
bool isWrapping () const
 
LayoutMode layoutMode () const
 
int modelColumn () const
 
Movement movement () const
 
ResizeMode resizeMode () const
 
void scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible) override
 
void setBatchSize (int batchSize)
 
void setFlow (Flow flow)
 
void setGridSize (const QSize &size)
 
void setLayoutMode (LayoutMode mode)
 
void setModelColumn (int column)
 
void setMovement (Movement movement)
 
void setResizeMode (ResizeMode mode)
 
void setRootIndex (const QModelIndex &index) override
 
void setRowHidden (int row, bool hide)
 
void setSelectionRectVisible (bool show)
 
void setSpacing (int space)
 
void setUniformItemSizes (bool enable)
 
void setViewMode (ViewMode mode)
 
void setWordWrap (bool on)
 
void setWrapping (bool enable)
 
int spacing () const
 
bool uniformItemSizes () const
 
ViewMode viewMode () const
 
QRect visualRect (const QModelIndex &index) const override
 
bool wordWrap () const
 
- Public Methods inherited from QAbstractItemView
 QAbstractItemView (QWidget *parent=nullptr)
 
 ~QAbstractItemView ()
 
bool alternatingRowColors () const
 
int autoScrollMargin () const
 
void closePersistentEditor (const QModelIndex &index)
 
QModelIndex currentIndex () const
 
Qt::DropAction defaultDropAction () const
 
DragDropMode dragDropMode () const
 
bool dragDropOverwriteMode () const
 
bool dragEnabled () const
 
EditTriggers editTriggers () const
 
bool hasAutoScroll () const
 
ScrollMode horizontalScrollMode () const
 
QSize iconSize () const
 
QWidgetindexWidget (const QModelIndex &index) const
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 
QAbstractItemDelegateitemDelegate () const
 
QAbstractItemDelegateitemDelegate (const QModelIndex &index) const
 
QAbstractItemDelegateitemDelegateForColumn (int column) const
 
QAbstractItemDelegateitemDelegateForRow (int row) const
 
virtual void keyboardSearch (const QString &search)
 
QAbstractItemModelmodel () const
 
void openPersistentEditor (const QModelIndex &index)
 
QModelIndex rootIndex () const
 
QAbstractItemView::SelectionBehavior selectionBehavior () const
 
QAbstractItemView::SelectionMode selectionMode () const
 
QItemSelectionModelselectionModel () const
 
void setAlternatingRowColors (bool enable)
 
void setAutoScroll (bool enable)
 
void setAutoScrollMargin (int margin)
 
void setDefaultDropAction (Qt::DropAction dropAction)
 
void setDragDropMode (DragDropMode behavior)
 
void setDragDropOverwriteMode (bool overwrite)
 
void setDragEnabled (bool enable)
 
void setDropIndicatorShown (bool enable)
 
void setEditTriggers (EditTriggers triggers)
 
void setHorizontalScrollMode (ScrollMode mode)
 
void setIconSize (const QSize &size)
 
void setIndexWidget (const QModelIndex &index, QWidget *widget)
 
void setItemDelegate (QAbstractItemDelegate *delegate)
 
void setItemDelegateForColumn (int column, QAbstractItemDelegate *delegate)
 
void setItemDelegateForRow (int row, QAbstractItemDelegate *delegate)
 
void setSelectionBehavior (QAbstractItemView::SelectionBehavior behavior)
 
void setSelectionMode (QAbstractItemView::SelectionMode mode)
 
virtual void setSelectionModel (QItemSelectionModel *selectionModel)
 
void setTabKeyNavigation (bool enable)
 
void setTextElideMode (Qt::TextElideMode mode)
 
void setVerticalScrollMode (ScrollMode mode)
 
bool showDropIndicator () const
 
virtual int sizeHintForColumn (int column) const
 
QSize sizeHintForIndex (const QModelIndex &index) const
 
virtual int sizeHintForRow (int row) const
 
bool tabKeyNavigation () const
 
Qt::TextElideMode textElideMode () const
 
ScrollMode verticalScrollMode () const
 
- Public Methods inherited from QAbstractScrollArea
 QAbstractScrollArea (QWidget *parent=nullptr)
 
 ~QAbstractScrollArea ()
 
void addScrollBarWidget (QWidget *widget, Qt::Alignment alignment)
 
QWidgetcornerWidget () const
 
QScrollBarhorizontalScrollBar () const
 
Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
 
QSize maximumViewportSize () const
 
QSize minimumSizeHint () const override
 
QWidgetList scrollBarWidgets (Qt::Alignment alignment)
 
void setCornerWidget (QWidget *widget)
 
void setHorizontalScrollBar (QScrollBar *scrollBar)
 
void setHorizontalScrollBarPolicy (Qt::ScrollBarPolicy)
 
void setSizeAdjustPolicy (SizeAdjustPolicy policy)
 
virtual void setupViewport (QWidget *viewport)
 
void setVerticalScrollBar (QScrollBar *scrollBar)
 
void setVerticalScrollBarPolicy (Qt::ScrollBarPolicy)
 
void setViewport (QWidget *widget)
 
SizeAdjustPolicy sizeAdjustPolicy () const
 
QSize sizeHint () const override
 
QScrollBarverticalScrollBar () const
 
Qt::ScrollBarPolicy verticalScrollBarPolicy () const
 
QWidgetviewport () const
 
- Public Methods inherited from QFrame
 QFrame (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QFrame ()
 
QRect frameRect () const
 
Shadow frameShadow () const
 
Shape frameShape () const
 
int frameStyle () const
 
int frameWidth () const
 
int lineWidth () const
 
int midLineWidth () const
 
void setFrameRect (const QRect &)
 
void setFrameShadow (Shadow)
 
void setFrameShape (Shape)
 
void setFrameStyle (int style)
 
void setLineWidth (int)
 
void setMidLineWidth (int)
 
QSize sizeHint () const override
 
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QWidget ()
 
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 
void activateWindow ()
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void adjustSize ()
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 
QBackingStorebackingStore () const
 
QSize baseSize () const
 
QWidget * childAt (const QPoint &position) const
 
QWidget * childAt (int x, int y) const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 
void clearMask ()
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
QCursor cursor () const
 
WId effectiveWinId () const
 
void ensurePolished () const
 
Qt::FocusPolicy focusPolicy () const
 
QWidget * focusProxy () const
 
QWidget * focusWidget () const
 
const QFontfont () const
 
QFontInfo fontInfo () const
 
QFontMetrics fontMetrics () const
 
QPalette::ColorRole foregroundRole () const
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
 
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
 
void grabKeyboard ()
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
QGraphicsEffectgraphicsEffect () const
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 
bool hasEditFocus () const
 
bool hasFocus () const
 
virtual bool hasHeightForWidth () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int width) const
 
Qt::InputMethodHints inputMethodHints () const
 
void insertAction (QAction *before, QAction *action)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *parent) const
 
bool isEnabledToTLW () const
 
bool isFullScreen () const
 
bool isHidden () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *parent) const
 
bool isWindow () const
 
bool isWindowModified () const
 
QLayoutlayout () const
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapFromParent (const QPoint &pos) const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QPoint mapToParent (const QPoint &pos) const
 
QRegion mask () const
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (const QPoint &point)
 
void move (int x, int y)
 
QWidget * nativeParentWidget () const
 
QWidget * nextInFocusChain () const
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
QPaintEnginepaintEngine () const override
 
const QPalettepalette () const
 
QWidget * parentWidget () const
 
QPoint pos () const
 
QWidget * previousInFocusChain () const
 
QRect rect () const
 
void releaseKeyboard ()
 
void releaseMouse ()
 
void releaseShortcut (int id)
 
void removeAction (QAction *action)
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &region)
 
void repaint (int x, int y, int w, int h)
 
void resize (const QSize &size)
 
void resize (int w, int h)
 
bool restoreGeometry (const QByteArray &geometry)
 
QByteArray saveGeometry () const
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &rect)
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
 
void setAutoFillBackground (bool enable)
 
void setBackgroundRole (QPalette::ColorRole role)
 
void setBaseSize (const QSize &size)
 
void setBaseSize (int basew, int baseh)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &cursor)
 
void setEditFocus (bool enable)
 
void setFixedHeight (int h)
 
void setFixedSize (const QSize &size)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFocus (Qt::FocusReason reason)
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *widget)
 
void setFont (const QFont &font)
 
void setForegroundRole (QPalette::ColorRole role)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int x, int y, int w, int h)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *layout)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &size)
 
void setMaximumSize (int maxw, int maxh)
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &size)
 
void setMinimumSize (int minw, int minh)
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &palette)
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags flags)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setSizeIncrement (const QSize &size)
 
void setSizeIncrement (int w, int h)
 
void setSizePolicy (QSizePolicy policy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
void setStatusTip (const QString &data)
 
void setStyle (QStyle *style)
 
void setToolTip (const QString &data)
 
void setToolTipDuration (int msec)
 
void setUpdatesEnabled (bool enable)
 
void setWhatsThis (const QString &str)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags flags)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &role)
 
void setWindowState (Qt::WindowStates windowState)
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *widget)
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 
QString toolTip () const
 
int toolTipDuration () const
 
QWidget * topLevelWidget () const
 
bool underMouse () const
 
void ungrabGesture (Qt::GestureType gestureType)
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (const QRect &rect)
 
void update (const QRegion &region)
 
void update (int x, int y, int w, int h)
 
void updateGeometry ()
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 
QString whatsThis () const
 
int width () const
 
QWidget * window () const
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 
QWindowwindowHandle () const
 
QIcon windowIcon () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 
Qt::WindowStates windowState () const
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 
WId winId () const
 
int x () const
 
int y () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Protected Methods

virtual bool dropMimeData (int index, const QMimeData *data, Qt::DropAction action)
 
bool event (QEvent *event) override
 
QModelIndex indexFromItem (QListWidgetItem *item) const
 
QListWidgetItemitemFromIndex (const QModelIndex &index) const
 
QList< QListWidgetItem * > items (const QMimeData *data) const
 
virtual QMimeDatamimeData (const QList< QListWidgetItem * > &items) const
 
virtual QStringList mimeTypes () const
 
virtual Qt::DropActions supportedDropActions () const
 
- Protected Methods inherited from QListView
void currentChanged (const QModelIndex &current, const QModelIndex &previous) override
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >()) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
int horizontalOffset () const override
 
bool isIndexHidden (const QModelIndex &index) const override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
 
void paintEvent (QPaintEvent *event) override
 
QRect rectForIndex (const QModelIndex &index) const
 
void resizeEvent (QResizeEvent *event) override
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) override
 
void rowsInserted (const QModelIndex &parent, int start, int end) override
 
void scrollContentsBy (int dx, int dy) override
 
QModelIndexList selectedIndexes () const override
 
void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override
 
void setPositionForIndex (const QPoint &position, const QModelIndex &index)
 
void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags flags) override
 
void startDrag (Qt::DropActions supportedActions) override
 
void timerEvent (QTimerEvent *event) override
 
void updateGeometries () override
 
int verticalOffset () const override
 
QStyleOptionViewItem viewOptions () const override
 
QSize viewportSizeHint () const override
 
QRegion visualRegionForSelection (const QItemSelection &selection) const override
 
void wheelEvent (QWheelEvent *event) override
 
- Protected Methods inherited from QAbstractItemView
QPoint dirtyRegionOffset () const
 
void dragEnterEvent (QDragEnterEvent *event) override
 
DropIndicatorPosition dropIndicatorPosition () const
 
virtual bool edit (const QModelIndex &index, EditTrigger trigger, QEvent *event)
 
bool event (QEvent *event) override
 
void executeDelayedItemsLayout ()
 
void focusInEvent (QFocusEvent *event) override
 
bool focusNextPrevChild (bool next) override
 
void focusOutEvent (QFocusEvent *event) override
 
int horizontalStepsPerItem () const
 
void inputMethodEvent (QInputMethodEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void scheduleDelayedItemsLayout ()
 
void scrollDirtyRegion (int dx, int dy)
 
virtual QItemSelectionModel::SelectionFlags selectionCommand (const QModelIndex &index, const QEvent *event=nullptr) const
 
void setDirtyRegion (const QRegion &region)
 
void setHorizontalStepsPerItem (int steps)
 
void setState (State state)
 
void setVerticalStepsPerItem (int steps)
 
State state () const
 
void timerEvent (QTimerEvent *event) override
 
int verticalStepsPerItem () const
 
bool viewportEvent (QEvent *event) override
 
- Protected Methods inherited from QAbstractScrollArea
void contextMenuEvent (QContextMenuEvent *event) override
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
bool event (QEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void setViewportMargins (const QMargins &margins)
 
void setViewportMargins (int left, int top, int right, int bottom)
 
QMargins viewportMargins () const
 
void wheelEvent (QWheelEvent *event) override
 
- Protected Methods inherited from QFrame
void changeEvent (QEvent *event) override
 
void drawFrame (QPainter *)
 
bool event (QEvent *event) override
 
void initStyleOption (QStyleOptionFrame *option) const
 
void paintEvent (QPaintEvent *event) override
 
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
 
virtual void closeEvent (QCloseEvent *event)
 
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual void enterEvent (QEvent *event)
 
bool event (QEvent *event) override
 
bool focusNextChild ()
 
bool focusPreviousChild ()
 
virtual void hideEvent (QHideEvent *event)
 
void initPainter (QPainter *painter) const override
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
int metric (PaintDeviceMetric metric) const override
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void showEvent (QShowEvent *event)
 
virtual void tabletEvent (QTabletEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 

Properties

 count
 
 currentRow
 
 sortingEnabled
 
- Properties inherited from QListView
 batchSize
 
 flow
 
 gridSize
 
 isWrapping
 
 layoutMode
 
 modelColumn
 
 movement
 
 resizeMode
 
 selectionRectVisible
 
 spacing
 
 uniformItemSizes
 
 viewMode
 
 wordWrap
 
- Properties inherited from QAbstractItemView
 alternatingRowColors
 
 autoScroll
 
 autoScrollMargin
 
 defaultDropAction
 
 dragDropMode
 
 dragDropOverwriteMode
 
 dragEnabled
 
 editTriggers
 
 horizontalScrollMode
 
 iconSize
 
 selectionBehavior
 
 selectionMode
 
 showDropIndicator
 
 tabKeyNavigation
 
 textElideMode
 
 verticalScrollMode
 
- Properties inherited from QAbstractScrollArea
 horizontalScrollBarPolicy
 
 verticalScrollBarPolicy
 
- Properties inherited from QFrame
 frameRect
 
 frameShadow
 
 frameShape
 
 frameWidth
 
 lineWidth
 
 midLineWidth
 
- Properties inherited from QWidget
 acceptDrops
 
 accessibleDescription
 
 accessibleName
 
 autoFillBackground
 
 baseSize
 
 childrenRect
 
 childrenRegion
 
 contextMenuPolicy
 
 cursor
 
 enabled
 
 focus
 
 focusPolicy
 
 font
 
 frameGeometry
 
 frameSize
 
 fullScreen
 
 geometry
 
 height
 
 inputMethodHints
 
 isActiveWindow
 
 layoutDirection
 
 locale
 
 maximized
 
 maximumHeight
 
 maximumSize
 
 maximumWidth
 
 minimized
 
 minimumHeight
 
 minimumSize
 
 minimumSizeHint
 
 minimumWidth
 
 modal
 
 mouseTracking
 
 normalGeometry
 
 palette
 
 pos
 
 rect
 
 size
 
 sizeHint
 
 sizeIncrement
 
 sizePolicy
 
 statusTip
 
 styleSheet
 
 toolTip
 
 updatesEnabled
 
 visible
 
 whatsThis
 
 width
 
 windowFilePath
 
 windowFlags
 
 windowIcon
 
 windowIconText
 
 windowModality
 
 windowModified
 
 windowOpacity
 
 windowTitle
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Friends

class QListWidgetItem
 

Additional Inherited Members

- Public Types inherited from QListView
enum  Flow
 
enum  LayoutMode
 
enum  Movement
 
enum  ResizeMode
 
enum  ViewMode
 
- Public Types inherited from QAbstractItemView
enum  DragDropMode
 
enum  ScrollHint
 
enum  ScrollMode
 
enum  SelectionBehavior
 
enum  SelectionMode
 
- Public Types inherited from QFrame
enum  Shadow
 
enum  Shape
 
enum  StyleMask
 
- Public Types inherited from QWidget
enum  RenderFlag
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 
- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QWidget * find (WId id)
 
static QWidget * keyboardGrabber ()
 
static QWidget * mouseGrabber ()
 
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Types inherited from QAbstractItemView
enum  CursorAction
 
enum  DropIndicatorPosition
 
enum  State
 
- Protected Slots inherited from QAbstractItemView
virtual void closeEditor (QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
 
virtual void commitData (QWidget *editor)
 
virtual void currentChanged (const QModelIndex &current, const QModelIndex &previous)
 
virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >())
 
virtual void editorDestroyed (QObject *editor)
 
virtual void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
virtual void rowsInserted (const QModelIndex &parent, int start, int end)
 
virtual void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 
virtual void updateGeometries ()
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 

Detailed Description

The QListWidget class provides an item-based list widget. QListWidget is a convenience class that provides a list view similar to the one supplied by QListView, but with a classic item-based interface for adding and removing items. QListWidget uses an internal model to manage each QListWidgetItem in the list.

For a more flexible list view widget use the QListView class with a standard model.

List widgets are constructed in the same way as other widgets.

QListWidget *listWidget = new QListWidget(this);

The selectionMode() of a list widget determines how many of the items in the list can be selected at the same time, and whether complex selections of items can be created. This can be set with the setSelectionMode() function.

There are two ways to add items to the list: they can be constructed with the list widget as their parent widget, or they can be constructed with no parent widget and added to the list later. If a list widget already exists when the items are constructed, the first method is easier to use:

new QListWidgetItem(tr("Oak"), listWidget);
new QListWidgetItem(tr("Fir"), listWidget);
new QListWidgetItem(tr("Pine"), listWidget);

If you need to insert a new item into the list at a particular position, then it should be constructed without a parent widget. The insertItem() function should then be used to place it within the list. The list widget will take ownership of the item.

newItem->setText(itemText);
listWidget->insertItem(row, newItem);

For multiple items insertItems() can be used. The number of items in the list is found with the count() function. To remove items from the list, use takeItem().

The current item in the list can be found with currentItem(), and changed with setCurrentItem(). The user can also change the current item by navigating with the keyboard or clicking on a different item. When the current item changes, the currentItemChanged() signal is emitted with the new current item and the item that was previously current.

Windows XP style list widget. Mac OS X style list widget. Fusion style list widget.
See also
QListWidgetItem, QListView, QTreeView, Model/View Programming

Constructor & Destructor Documentation

QListWidget::QListWidget ( QWidget parent = nullptr)
explicit

Constructs an empty QListWidget with the given parent.

QListWidget::~QListWidget ( )

Destroys the list widget and all its items.

Method Documentation

void QListWidget::addItem ( const QString label)
inline

Inserts an item with the text label at the end of the list widget.

void QListWidget::addItem ( QListWidgetItem item)
inline

Inserts the item at the end of the list widget.

Warning
A QListWidgetItem can only be added to a QListWidget once. Adding the same QListWidgetItem multiple times to a QListWidget will result in undefined behavior.
See also
insertItem()
void QListWidget::addItems ( const QStringList labels)
inline

Inserts items with the text labels at the end of the list widget.

See also
insertItems()
void QListWidget::clear ( )
slot

Removes all items and selections in the view.

Warning
All items will be permanently deleted.
void QListWidget::closePersistentEditor ( QListWidgetItem item)

Closes the persistent editor for the given item.

See also
openPersistentEditor()
int QListWidget::count ( ) const

Property documentation pending.

QListWidgetItem * QListWidget::currentItem ( ) const

Returns the current item.

See also
setCurrentItem()
void QListWidget::currentItemChanged ( QListWidgetItem current,
QListWidgetItem previous 
)
signal

This signal is emitted whenever the current item changes. The value for previous is the item that previously had the focus and current is the new current item.

int QListWidget::currentRow ( ) const

Property documentation pending.

void QListWidget::currentRowChanged ( int  currentRow)
signal

This signal is emitted whenever the current item changes. The value for currentRow is the row of the current item. If there is no current item, the currentRow is -1.

void QListWidget::currentTextChanged ( const QString currentText)
signal

This signal is emitted whenever the current item changes. The value for currentText is the text data in the current item. If there is no current item, the currentText is invalid.

void QListWidget::dropEvent ( QDropEvent event)
overridevirtual

Reimplemented from QWidget::dropEvent().

Reimplemented from QListView.

bool QListWidget::dropMimeData ( int  index,
const QMimeData data,
Qt::DropAction  action 
)
protectedvirtual

Handles data supplied by an external drag and drop operation that ended with the given action in the given index. Returns true if data and action can be handled by the model, otherwise returns false.

See also
supportedDropActions()
void QListWidget::editItem ( QListWidgetItem item)

Starts editing the item if it is editable.

bool QListWidget::event ( QEvent event)
overrideprotected

Reimplemented from QObject::event().

QList< QListWidgetItem * > QListWidget::findItems ( const QString text,
Qt::MatchFlags  flags 
) const

Finds items with the text that matches the string text using the given flags.

QModelIndex QListWidget::indexFromItem ( QListWidgetItem item) const
protected

Returns the QModelIndex associated with the given item.

void QListWidget::insertItem ( int  row,
const QString label 
)

Inserts an item with the text label in the list widget at the position given by row.

See also
addItem()
void QListWidget::insertItem ( int  row,
QListWidgetItem item 
)

Inserts the item at the position in the list given by row.

See also
addItem()
void QListWidget::insertItems ( int  row,
const QStringList labels 
)

Inserts items from the list of labels into the list, starting at the given row.

See also
insertItem(), addItem()
bool QListWidget::isItemHidden ( const QListWidgetItem item) const
deprecated
Deprecated:
Returns true if the item is explicitly hidden, otherwise returns false.

This function is deprecated. Use QListWidgetItem::isHidden() instead.

bool QListWidget::isItemSelected ( const QListWidgetItem item) const
deprecated
Deprecated:
Returns true if item is selected, otherwise returns false.

This function is deprecated. Use QListWidgetItem::isSelected() instead.

bool QListWidget::isSortingEnabled ( ) const

Property documentation pending.

QListWidgetItem * QListWidget::item ( int  row) const

Returns the item that occupies the given row in the list if one has been set, otherwise returns a nullptr.

See also
row()
void QListWidget::itemActivated ( QListWidgetItem item)
signal

This signal is emitted when the item is activated. The item is activated when the user clicks or double clicks on it, depending on the system configuration. It is also activated when the user presses the activation key (on Windows and X11 this is the Return key, on Mac OS X it is Ctrl+0).

QListWidgetItem * QListWidget::itemAt ( const QPoint p) const

Returns a pointer to the item at the coordinates p</The coordinates are relative to the list widget's viewport().

QListWidgetItem * QListWidget::itemAt ( int  x,
int  y 
) const
inline

Returns a pointer to the item at the coordinates (x, y). The coordinates are relative to the list widget's viewport().

void QListWidget::itemChanged ( QListWidgetItem item)
signal

This signal is emitted whenever the data of item has changed.

void QListWidget::itemClicked ( QListWidgetItem item)
signal

This signal is emitted with the specified item when a mouse button is clicked on an item in the widget.

See also
itemPressed(), itemDoubleClicked()
void QListWidget::itemDoubleClicked ( QListWidgetItem item)
signal

This signal is emitted with the specified item when a mouse button is double clicked on an item in the widget.

See also
itemClicked(), itemPressed()
void QListWidget::itemEntered ( QListWidgetItem item)
signal

This signal is emitted when the mouse cursor enters an item. The item is the item entered. This signal is only emitted when mouseTracking is turned on, or when a mouse button is pressed while moving into an item.

See also
QWidget::setMouseTracking()
QListWidgetItem * QListWidget::itemFromIndex ( const QModelIndex index) const
protected

Returns a pointer to the QListWidgetItem associated with the given index.

void QListWidget::itemPressed ( QListWidgetItem item)
signal

This signal is emitted with the specified item when a mouse button is pressed on an item in the widget.

See also
itemClicked(), itemDoubleClicked()
QList< QListWidgetItem * > QListWidget::items ( const QMimeData data) const
protected

Returns a list of pointers to the items contained in the data object. If the object was not created by a QListWidget in the same process, the list is empty.

void QListWidget::itemSelectionChanged ( )
signal

This signal is emitted whenever the selection changes.

See also
selectedItems(), QListWidgetItem::isSelected(), currentItemChanged()
QWidget * QListWidget::itemWidget ( QListWidgetItem item) const

Returns the widget displayed in the given item.

See also
setItemWidget()
QMimeData * QListWidget::mimeData ( const QList< QListWidgetItem * > &  items) const
protectedvirtual

Returns an object that contains a serialized description of the specified items. The format used to describe the items is obtained from mimeTypes(). If the list of items is empty then nullptr is returned.

QStringList QListWidget::mimeTypes ( ) const
protectedvirtual

Returns a list of MIME types that can be used to describe a list of listwidget items.

See also
mimeData()
void QListWidget::openPersistentEditor ( QListWidgetItem item)

Opens an editor for the given item. The editor remains open after editing.

See also
closePersistentEditor()
void QListWidget::removeItemWidget ( QListWidgetItem item)
inline

Removes the widget set on the given item.

int QListWidget::row ( const QListWidgetItem item) const

Returns the row containing the given item.

See also
item()
void QListWidget::scrollToItem ( const QListWidgetItem item,
QAbstractItemView::ScrollHint  hint = EnsureVisible 
)
slot

Scrolls the view if necessary to ensure that the item is visible. The value for hint specifies where the item should be located after the operation.

QList< QListWidgetItem * > QListWidget::selectedItems ( ) const

Returns a list of all selected items in the list widget.

void QListWidget::setCurrentItem ( QListWidgetItem item)

Sets the current item to item. Unless the selection mode is NoSelection, the item is also be selected.

See also
currentItem()
void QListWidget::setCurrentItem ( QListWidgetItem item,
QItemSelectionModel::SelectionFlags  command 
)

Set the current item to item, using the given command.

void QListWidget::setCurrentRow ( int  row)

Property documentation pending.

void QListWidget::setCurrentRow ( int  row,
QItemSelectionModel::SelectionFlags  command 
)

Property documentation pending.

void QListWidget::setItemHidden ( const QListWidgetItem item,
bool  hide 
)
deprecated
Deprecated:
If hide is true, the item will be hidden, otherwise it will be shown.

This function is deprecated. Use QListWidgetItem::setHidden() instead.

See also
isItemHidden()
void QListWidget::setItemSelected ( const QListWidgetItem item,
bool  select 
)
deprecated
Deprecated:
Selects or deselects the given item depending on whether select is true of false.

This function is deprecated. Use QListWidgetItem::setSelected() instead.

See also
isItemSelected()
void QListWidget::setItemWidget ( QListWidgetItem item,
QWidget widget 
)

Sets the widget to be displayed in the give item. This function should only be used to display static content in the place of a list widget item. If you want to display custom dynamic content or implement a custom editor widget, use QListView and subclass QItemDelegate instead.

See also
itemWidget(), Delegate Classes
void QListWidget::setSortingEnabled ( bool  enable)

Property documentation pending.

void QListWidget::sortItems ( Qt::SortOrder  order = Qt::AscendingOrder)

Sorts all the items in the list widget according to the specified order.

Qt::DropActions QListWidget::supportedDropActions ( ) const
protectedvirtual

Returns the drop actions supported by this view.

See also
Qt::DropActions
QListWidgetItem * QListWidget::takeItem ( int  row)

Removes and returns the item from the given row in the list widget, otherwise returns a nullptr. Items removed from a list widget will not be managed by CopperSpice and will need to be deleted manually.

See also
insertItem(), addItem()
QRect QListWidget::visualItemRect ( const QListWidgetItem item) const

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

Property Documentation

QListWidget::count

This property holds the number of items in the list including any hidden items.

PropertiesClass Methods
read count
QListWidget::currentRow

This property holds the row of the current item.

Depending on the current selection mode, the row may also be selected.

PropertiesClass Methods
read currentRow
write cs_setCurrentRow
notify currentRowChanged
user true
QListWidget::sortingEnabled

This property holds whether sorting is enabled.

If this property is true, sorting is enabled for the list, if the property is false, sorting is not enabled. The default value is false.

PropertiesClass Methods
read isSortingEnabled
write setSortingEnabled