You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
962 lines
47 KiB
962 lines
47 KiB
'\" t
|
|
.TH QIconView 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
|
.\" license file included in the distribution for a complete license
|
|
.\" statement.
|
|
.\"
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
QIconView \- Area with movable labelled icons
|
|
.SH SYNOPSIS
|
|
\fC#include <ntqiconview.h>\fR
|
|
.PP
|
|
Inherits QScrollView.
|
|
.PP
|
|
.SS "Public Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "enum \fBSelectionMode\fR { Single = 0, Multi, Extended, NoSelection }"
|
|
.br
|
|
.ti -1c
|
|
.BI "enum \fBArrangement\fR { LeftToRight = 0, TopToBottom }"
|
|
.br
|
|
.ti -1c
|
|
.BI "enum \fBResizeMode\fR { Fixed = 0, Adjust }"
|
|
.br
|
|
.ti -1c
|
|
.BI "enum \fBItemTextPos\fR { Bottom = 0, Right }"
|
|
.br
|
|
.ti -1c
|
|
.BI "\fBQIconView\fR ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual \fB~QIconView\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBinsertItem\fR ( QIconViewItem * item, QIconViewItem * after = 0L )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBtakeItem\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBindex\fR ( const QIconViewItem * item ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBfirstItem\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBlastItem\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBcurrentItem\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetCurrentItem\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetSelected\fR ( QIconViewItem * item, bool s, bool cb = FALSE )"
|
|
.br
|
|
.ti -1c
|
|
.BI "uint \fBcount\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetSelectionMode\fR ( SelectionMode m )"
|
|
.br
|
|
.ti -1c
|
|
.BI "SelectionMode \fBselectionMode\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBfindItem\fR ( const QPoint & pos ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBfindItem\fR ( const QString & text, ComparisonFlags compare = BeginsWith ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBselectAll\fR ( bool select )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBclearSelection\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBinvertSelection\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBrepaintItem\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBrepaintSelectedItems\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBensureItemVisible\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBfindFirstVisibleItem\fR ( const QRect & r ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBfindLastVisibleItem\fR ( const QRect & r ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBclear\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetGridX\fR ( int rx )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetGridY\fR ( int ry )"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBgridX\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBgridY\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetSpacing\fR ( int sp )"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBspacing\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetItemTextPos\fR ( ItemTextPos pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "ItemTextPos \fBitemTextPos\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetItemTextBackground\fR ( const QBrush & b )"
|
|
.br
|
|
.ti -1c
|
|
.BI "QBrush \fBitemTextBackground\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetArrangement\fR ( Arrangement am )"
|
|
.br
|
|
.ti -1c
|
|
.BI "Arrangement \fBarrangement\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetResizeMode\fR ( ResizeMode am )"
|
|
.br
|
|
.ti -1c
|
|
.BI "ResizeMode \fBresizeMode\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetMaxItemWidth\fR ( int w )"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBmaxItemWidth\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetMaxItemTextLength\fR ( int w )"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBmaxItemTextLength\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetAutoArrange\fR ( bool b )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBautoArrange\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetShowToolTips\fR ( bool b )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBshowToolTips\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBsetSorting\fR ( bool sort, bool ascending = TRUE )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBsorting\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBsortDirection\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetItemsMovable\fR ( bool b )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBitemsMovable\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsetWordWrapIconText\fR ( bool b )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBwordWrapIconText\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBsort\fR ( bool ascending = TRUE )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBisRenaming\fR () const"
|
|
.br
|
|
.in -1c
|
|
.SS "Public Slots"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "virtual void \fBarrangeItemsInGrid\fR ( const QSize & grid, bool update = TRUE )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBarrangeItemsInGrid\fR ( bool update = TRUE )"
|
|
.br
|
|
.in -1c
|
|
.SS "Signals"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "void \fBselectionChanged\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBselectionChanged\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBcurrentChanged\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBclicked\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBclicked\fR ( QIconViewItem * item, const QPoint & pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBpressed\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBpressed\fR ( QIconViewItem * item, const QPoint & pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBdoubleClicked\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBreturnPressed\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBrightButtonClicked\fR ( QIconViewItem * item, const QPoint & pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBrightButtonPressed\fR ( QIconViewItem * item, const QPoint & pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBmouseButtonPressed\fR ( int button, QIconViewItem * item, const QPoint & pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBmouseButtonClicked\fR ( int button, QIconViewItem * item, const QPoint & pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBcontextMenuRequested\fR ( QIconViewItem * item, const QPoint & pos )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBdropped\fR ( QDropEvent * e, const QValueList<QIconDragItem> & lst )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBmoved\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBonItem\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBonViewport\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBitemRenamed\fR ( QIconViewItem * item, const QString & name )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBitemRenamed\fR ( QIconViewItem * item )"
|
|
.br
|
|
.in -1c
|
|
.SS "Properties"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "Arrangement \fBarrangement\fR - the arrangement mode of the icon view"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBautoArrange\fR - whether the icon view rearranges its items when a new item is inserted"
|
|
.br
|
|
.ti -1c
|
|
.BI "uint \fBcount\fR - the number of items in the icon view \fI(read " "only" ")\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBgridX\fR - the horizontal grid of the icon view"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBgridY\fR - the vertical grid of the icon view"
|
|
.br
|
|
.ti -1c
|
|
.BI "QBrush \fBitemTextBackground\fR - the brush to use when drawing the background of an item's text"
|
|
.br
|
|
.ti -1c
|
|
.BI "ItemTextPos \fBitemTextPos\fR - the position where the text of each item is drawn"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBitemsMovable\fR - whether the user is allowed to move items around in the icon view"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBmaxItemTextLength\fR - the maximum length (in " "characters" ") that an item's text may have"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBmaxItemWidth\fR - the maximum width that an item may have"
|
|
.br
|
|
.ti -1c
|
|
.BI "ResizeMode \fBresizeMode\fR - the resize mode of the icon view"
|
|
.br
|
|
.ti -1c
|
|
.BI "SelectionMode \fBselectionMode\fR - the selection mode of the icon view"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBshowToolTips\fR - whether the icon view will display a tool tip with the complete text for any truncated item text"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBsortDirection\fR - whether the sort direction for inserting new items is ascending; \fI(read " "only" ")\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBsorting\fR - whether the icon view sorts on insertion \fI(read " "only" ")\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBspacing\fR - the space in pixels between icon view items"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBwordWrapIconText\fR - whether the item text will be word-wrapped if it is too long"
|
|
.br
|
|
.in -1c
|
|
.SS "Protected Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "virtual void \fBdrawRubber\fR ( QPainter * p )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual QDragObject * \fBdragObject\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBstartDrag\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBinsertInGrid\fR ( QIconViewItem * item )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBdrawBackground\fR ( QPainter * p, const QRect & r )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBemitSelectionChanged\fR ( QIconViewItem * i = 0 )"
|
|
.br
|
|
.ti -1c
|
|
.BI "QIconViewItem * \fBmakeRowLayout\fR ( QIconViewItem * begin, int & y, bool & changed )"
|
|
.br
|
|
.in -1c
|
|
.SS "Protected Slots"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "virtual void \fBdoAutoScroll\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBadjustItems\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBslotUpdate\fR ()"
|
|
.br
|
|
.in -1c
|
|
.SH DESCRIPTION
|
|
The QIconView class provides an area with movable labelled icons.
|
|
.PP
|
|
A QIconView can display and manage a grid or other 2D layout of labelled icons. Each labelled icon is a QIconViewItem. Items (QIconViewItems) can be added or deleted at any time; items can be moved within the QIconView. Single or multiple items can be selected. Items can be renamed in-place. QIconView also supports drag and drop.
|
|
.PP
|
|
Each item contains a label string, a pixmap or picture (the icon itself) and optionally a sort key. The sort key is used for sorting the items and defaults to the label string. The label string can be displayed below or to the right of the icon (see ItemTextPos).
|
|
.PP
|
|
The simplest way to create a QIconView is to create a QIconView object and create some QIconViewItems with the QIconView as their parent, set the icon view's geometry and show it. For example:
|
|
.PP
|
|
.nf
|
|
.br
|
|
QIconView *iv = new QIconView( this );
|
|
.br
|
|
QDir dir( path, "*.xpm" );
|
|
.br
|
|
for ( uint i = 0; i < dir.count(); i++ ) {
|
|
.br
|
|
(void) new QIconViewItem( iv, dir[i], QPixmap( path + dir[i] ) );
|
|
.br
|
|
}
|
|
.br
|
|
iv->resize( 600, 400 );
|
|
.br
|
|
iv->show();
|
|
.br
|
|
.fi
|
|
.PP
|
|
The QIconViewItem call passes a pointer to the QIconView we wish to populate, along with the label text and a QPixmap.
|
|
.PP
|
|
When an item is inserted the QIconView allocates a position for it. Existing items are rearranged if autoArrange() is TRUE. The default arrangement is LeftToRight -- the QIconView fills up the \fIleft-most\fR column from top to bottom, then moves one column \fIright\fR and fills that from top to bottom and so on. The arrangement can be modified with any of the following approaches:
|
|
.TP
|
|
Call setArrangement(), e.g. with TopToBottom which will fill the \fItop-most\fR row from left to right, then moves one row \fIdown\fR and fills that row from left to right and so on.
|
|
.TP
|
|
Construct each QIconViewItem using a constructor which allows you to specify which item the new one is to follow.
|
|
.TP
|
|
Call setSorting() or sort() to sort the items.
|
|
.PP
|
|
The spacing between items is set with setSpacing(). Items can be laid out using a fixed grid using setGridX() and setGridY(); by default the QIconView calculates a grid dynamically. The position of items' label text is set with setItemTextPos(). The text's background can be set with setItemTextBackground(). The maximum width of an item and of its text are set with setMaxItemWidth() and setMaxItemTextLength(). The label text will be word-wrapped if it is too long; this is controlled by setWordWrapIconText(). If the label text is truncated, the user can still see the entire text in a tool tip if they hover the mouse over the item. This is controlled with setShowToolTips().
|
|
.PP
|
|
Items which are selectable may be selected depending on the SelectionMode; the default is Single. Because QIconView offers multiple selection it must display keyboard focus and selection state separately. Therefore there are functions to set the selection state of an item (setSelected()) and to select which item displays keyboard focus (setCurrentItem()). When multiple items may be selected the icon view provides a rubberband, too.
|
|
.PP
|
|
When in-place renaming is enabled (it is disabled by default), the user may change the item's label. They do this by selecting the item (single clicking it or navigating to it with the arrow keys), then single clicking it (or pressing F2), and entering their text. If no key has been set with QIconViewItem::setKey() the new text will also serve as the key. (See QIconViewItem::setRenameEnabled().)
|
|
.PP
|
|
You can control whether users can move items themselves with setItemsMovable().
|
|
.PP
|
|
Because the internal structure used to store the icon view items is linear, no iterator class is needed to iterate over all the items. Instead we iterate by getting the first item from the \fIicon view\fR and then each subsequent (QIconViewItem::nextItem()) from each \fIitem\fR in turn:
|
|
.PP
|
|
.nf
|
|
.br
|
|
for ( QIconViewItem *item = iv->firstItem(); item; item = item->nextItem() )
|
|
.br
|
|
do_something( item );
|
|
.br
|
|
.fi
|
|
QIconView also provides currentItem(). You can search for an item using findItem() (searching by position or for label text) and with findFirstVisibleItem() and findLastVisibleItem(). The number of items is returned by count(). An item can be removed from an icon view using takeItem(); to delete an item use \fCdelete\fR. All the items can be deleted with clear().
|
|
.PP
|
|
The QIconView emits a wide range of useful signals, including selectionChanged(), currentChanged(), clicked(), moved() and itemRenamed().
|
|
.SH "Drag and Drop"
|
|
QIconView supports the drag and drop of items within the QIconView itself. It also supports the drag and drop of items out of or into the QIconView and drag and drop onto items themselves. The drag and drop of items outside the QIconView can be achieved in a simple way with basic functionality, or in a more sophisticated way which provides more power and control.
|
|
.PP
|
|
The simple approach to dragging items out of the icon view is to subclass QIconView and reimplement QIconView::dragObject().
|
|
.PP
|
|
.nf
|
|
.br
|
|
QDragObject *MyIconView::dragObject()
|
|
.br
|
|
{
|
|
.br
|
|
return new QTextDrag( currentItem()->text(), this );
|
|
.br
|
|
}
|
|
.br
|
|
.fi
|
|
.PP
|
|
In this example we create a QTextDrag object, (derived from QDragObject), containing the item's label and return it as the drag object. We could just as easily have created a QImageDrag from the item's pixmap and returned that instead.
|
|
.PP
|
|
QIconViews and their QIconViewItems can also be the targets of drag and drops. To make the QIconView itself able to accept drops connect to the dropped() signal. When a drop occurs this signal will be emitted with a QDragEvent and a QValueList of QIconDragItems. To make a QIconViewItem into a drop target subclass QIconViewItem and reimplement QIconViewItem::acceptDrop() and QIconViewItem::dropped().
|
|
.PP
|
|
.nf
|
|
.br
|
|
bool MyIconViewItem::acceptDrop( const QMimeSource *mime ) const
|
|
.br
|
|
{
|
|
.br
|
|
if ( mime->provides( "text/plain" ) )
|
|
.br
|
|
return TRUE;
|
|
.br
|
|
return FALSE;
|
|
.br
|
|
}
|
|
.br
|
|
.br
|
|
void MyIconViewItem::dropped( QDropEvent *evt, const QValueList<QIconDragItem>& )
|
|
.br
|
|
{
|
|
.br
|
|
QString label;
|
|
.br
|
|
if ( QTextDrag::decode( evt, label ) )
|
|
.br
|
|
setText( label );
|
|
.br
|
|
}
|
|
.br
|
|
.fi
|
|
.PP
|
|
See iconview/simple_dd/main.h and iconview/simple_dd/main.cpp for a simple drag and drop example which demonstrates drag and drop between a QIconView and a QListBox.
|
|
.PP
|
|
If you want to use extended drag-and-drop or have drag shapes drawn you must take a more sophisticated approach.
|
|
.PP
|
|
The first part is starting drags -- you should use a QIconDrag (or a class derived from it) for the drag object. In dragObject() create the drag object, populate it with QIconDragItems and return it. Normally such a drag should offer each selected item's data. So in dragObject() you should iterate over all the items, and create a QIconDragItem for each selected item, and append these items with QIconDrag::append() to the QIconDrag object. You can use QIconDragItem::setData() to set the data of each item that should be dragged. If you want to offer the data in additional mime-types, it's best to use a class derived from QIconDrag, which implements additional encoding and decoding functions.
|
|
.PP
|
|
When a drag enters the icon view, there is little to do. Simply connect to the dropped() signal and reimplement QIconViewItem::acceptDrop() and QIconViewItem::dropped(). If you've used a QIconDrag (or a subclass of it) the second argument to the dropped signal contains a QValueList of QIconDragItems -- you can access their data by calling QIconDragItem::data() on each one.
|
|
.PP
|
|
For an example implementation of complex drag-and-drop look at the fileiconview example (qt/examples/fileiconview).
|
|
.PP
|
|
See also QIconViewItem::setDragEnabled(), QIconViewItem::setDropEnabled(), QIconViewItem::acceptDrop(), QIconViewItem::dropped(), and Advanced Widgets.
|
|
.PP
|
|
.ce 1
|
|
.B "[Image Omitted]"
|
|
.PP
|
|
|
|
.ce 1
|
|
.B "[Image Omitted]"
|
|
.PP
|
|
.SS "Member Type Documentation"
|
|
.SH "QIconView::Arrangement"
|
|
This enum type determines in which direction the items flow when the view runs out of space.
|
|
.TP
|
|
\fCQIconView::LeftToRight\fR - Items which don't fit into the view cause the viewport to extend vertically (you get a vertical scrollbar).
|
|
.TP
|
|
\fCQIconView::TopToBottom\fR - Items which don't fit into the view cause the viewport to extend horizontally (you get a horizontal scrollbar).
|
|
.SH "QIconView::ItemTextPos"
|
|
This enum type specifies the position of the item text in relation to the icon.
|
|
.TP
|
|
\fCQIconView::Bottom\fR - The text is drawn below the icon.
|
|
.TP
|
|
\fCQIconView::Right\fR - The text is drawn to the right of the icon.
|
|
.SH "QIconView::ResizeMode"
|
|
This enum type is used to tell QIconView how it should treat the positions of its icons when the widget is resized. The modes are:
|
|
.TP
|
|
\fCQIconView::Fixed\fR - The icons' positions are not changed.
|
|
.TP
|
|
\fCQIconView::Adjust\fR - The icons' positions are adjusted to be within the new geometry, if possible.
|
|
.SH "QIconView::SelectionMode"
|
|
This enumerated type is used by QIconView to indicate how it reacts to selection by the user. It has four values:
|
|
.TP
|
|
\fCQIconView::Single\fR - When the user selects an item, any already-selected item becomes unselected and the user cannot unselect the selected item. This means that the user can never clear the selection. (The application programmer can, using QIconView::clearSelection().)
|
|
.TP
|
|
\fCQIconView::Multi\fR - When the user selects an item, e.g. by navigating to it with the keyboard arrow keys or by clicking it, the selection status of that item is toggled and the other items are left alone. Also, multiple items can be selected by dragging the mouse while the left mouse button stays pressed.
|
|
.TP
|
|
\fCQIconView::Extended\fR - When the user selects an item the selection is cleared and the new item selected. However, if the user presses the Ctrl key when clicking on an item, the clicked item gets toggled and all other items are left untouched. If the user presses the Shift key while clicking on an item, all items between the current item and the clicked item get selected or unselected, depending on the state of the clicked item. Also, multiple items can be selected by dragging the mouse while the left mouse button stays pressed.
|
|
.TP
|
|
\fCQIconView::NoSelection\fR - Items cannot be selected.
|
|
.PP
|
|
To summarise: Single is a real single-selection icon view; Multi a real multi-selection icon view; Extended is an icon view in which users can select multiple items but usually want to select either just one or a range of contiguous items; and NoSelection mode is for an icon view where the user can look but not touch.
|
|
.SH MEMBER FUNCTION DOCUMENTATION
|
|
.SH "QIconView::QIconView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
|
|
Constructs an empty icon view called \fIname\fR, with parent \fIparent\fR and using the widget flags \fIf\fR.
|
|
.SH "QIconView::~QIconView ()\fC [virtual]\fR"
|
|
Destroys the icon view and deletes all items.
|
|
.SH "void QIconView::adjustItems ()\fC [virtual protected slot]\fR"
|
|
Adjusts the positions of the items to the geometry of the icon view.
|
|
.SH "void QIconView::arrangeItemsInGrid ( const QSize & grid, bool update = TRUE )\fC [virtual slot]\fR"
|
|
This variant uses \fIgrid\fR instead of (gridX(), gridY()). If \fIgrid\fR is invalid (see QSize::isValid()), arrangeItemsInGrid() calculates a valid grid itself and uses that.
|
|
.PP
|
|
If \fIupdate\fR is TRUE (the default) the viewport is repainted.
|
|
.PP
|
|
Example: fileiconview/qfileiconview.h.
|
|
.SH "void QIconView::arrangeItemsInGrid ( bool update = TRUE )\fC [virtual slot]\fR"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
Arranges all the items in the grid given by gridX() and gridY().
|
|
.PP
|
|
Even if sorting() is enabled, the items are not sorted by this function. If you want to sort or rearrange the items, use iconview->sort(iconview->sortDirection()).
|
|
.PP
|
|
If \fIupdate\fR is TRUE (the default), the viewport is repainted as well.
|
|
.PP
|
|
See also QIconView::gridX, QIconView::gridY, and QIconView::sort().
|
|
.SH "Arrangement QIconView::arrangement () const"
|
|
Returns the arrangement mode of the icon view. See the "arrangement" property for details.
|
|
.SH "bool QIconView::autoArrange () const"
|
|
Returns TRUE if the icon view rearranges its items when a new item is inserted; otherwise returns FALSE. See the "autoArrange" property for details.
|
|
.SH "void QIconView::clear ()\fC [virtual]\fR"
|
|
Clears the icon view. All items are deleted.
|
|
.SH "void QIconView::clearSelection ()\fC [virtual]\fR"
|
|
Unselects all the items.
|
|
.SH "void QIconView::clicked ( QIconViewItem * item )\fC [signal]\fR"
|
|
This signal is emitted when the user clicks any mouse button. If \fIitem\fR is non-null, the cursor is on \fIitem\fR. If \fIitem\fR is null, the mouse cursor isn't on any item.
|
|
.PP
|
|
See also mouseButtonClicked(), rightButtonClicked(), and pressed().
|
|
.SH "void QIconView::clicked ( QIconViewItem * item, const QPoint & pos )\fC [signal]\fR"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
This signal is emitted when the user clicks any mouse button on an icon view item. \fIitem\fR is a pointer to the item that has been clicked.
|
|
.PP
|
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differ by a pixel or two, \fIpos\fR is the position at release time.)
|
|
.PP
|
|
See also mouseButtonClicked(), rightButtonClicked(), and pressed().
|
|
.SH "void QIconView::contextMenuRequested ( QIconViewItem * item, const QPoint & pos )\fC [signal]\fR"
|
|
This signal is emitted when the user invokes a context menu with the right mouse button or with special system keys, with \fIitem\fR being the item under the mouse cursor or the current item, respectively.
|
|
.PP
|
|
\fIpos\fR is the position for the context menu in the global coordinate system.
|
|
.SH "uint QIconView::count () const"
|
|
Returns the number of items in the icon view. See the "count" property for details.
|
|
.SH "void QIconView::currentChanged ( QIconViewItem * item )\fC [signal]\fR"
|
|
This signal is emitted when a new item becomes current. \fIitem\fR is the new current item (or 0 if no item is now current).
|
|
.PP
|
|
See also currentItem().
|
|
.SH "QIconViewItem * QIconView::currentItem () const"
|
|
Returns a pointer to the current item of the icon view, or 0 if no item is current.
|
|
.PP
|
|
See also setCurrentItem(), firstItem(), and lastItem().
|
|
.SH "void QIconView::doAutoScroll ()\fC [virtual protected slot]\fR"
|
|
Performs autoscrolling when selecting multiple icons with the rubber band.
|
|
.SH "void QIconView::doubleClicked ( QIconViewItem * item )\fC [signal]\fR"
|
|
This signal is emitted when the user double-clicks on \fIitem\fR.
|
|
.SH "QDragObject * QIconView::dragObject ()\fC [virtual protected]\fR"
|
|
Returns the QDragObject that should be used for drag-and-drop. This function is called by the icon view when starting a drag to get the dragobject that should be used for the drag. Subclasses may reimplement this.
|
|
.PP
|
|
See also QIconDrag.
|
|
.PP
|
|
Examples:
|
|
.)l fileiconview/qfileiconview.cpp and iconview/simple_dd/main.cpp.
|
|
.SH "void QIconView::drawBackground ( QPainter * p, const QRect & r )\fC [virtual protected]\fR"
|
|
This function is called to draw the rectangle \fIr\fR of the background using the painter \fIp\fR.
|
|
.PP
|
|
The default implementation fills \fIr\fR with the viewport's backgroundBrush(). Subclasses may reimplement this to draw custom backgrounds.
|
|
.PP
|
|
See also contentsX, contentsY, and drawContents().
|
|
.SH "void QIconView::drawRubber ( QPainter * p )\fC [virtual protected]\fR"
|
|
Draws the rubber band using the painter \fIp\fR.
|
|
.SH "void QIconView::dropped ( QDropEvent * e, const QValueList<QIconDragItem> & lst )\fC [signal]\fR"
|
|
This signal is emitted when a drop event occurs in the viewport (but not on any icon) which the icon view itself can't handle.
|
|
.PP
|
|
\fIe\fR provides all the information about the drop. If the drag object of the drop was a QIconDrag, \fIlst\fR contains the list of the dropped items. You can get the data using QIconDragItem::data() on each item. If the \fIlst\fR is empty, i.e. the drag was not a QIconDrag, you have to decode the data in \fIe\fR and work with that.
|
|
.PP
|
|
Note QIconViewItems may be drop targets; if a drop event occurs on an item the item handles the drop.
|
|
.PP
|
|
Examples:
|
|
.)l iconview/main.cpp and iconview/simple_dd/main.cpp.
|
|
.SH "void QIconView::emitSelectionChanged ( QIconViewItem * i = 0 )\fC [protected]\fR"
|
|
Emits a signal to indicate selection changes. \fIi\fR is the QIconViewItem that was selected or de-selected.
|
|
.PP
|
|
\fIYou should never need to call this function.\fR
|
|
.SH "void QIconView::ensureItemVisible ( QIconViewItem * item )"
|
|
Makes sure that \fIitem\fR is entirely visible. If necessary, ensureItemVisible() scrolls the icon view.
|
|
.PP
|
|
See also ensureVisible().
|
|
.SH "QIconViewItem * QIconView::findFirstVisibleItem ( const QRect & r ) const"
|
|
Finds the first item whose bounding rectangle overlaps \fIr\fR and returns a pointer to that item. \fIr\fR is given in content coordinates. Returns 0 if no item overlaps \fIr\fR.
|
|
.PP
|
|
If you want to find all items that touch \fIr\fR, you will need to use this function and nextItem() in a loop ending at findLastVisibleItem() and test QIconViewItem::rect() for each of these items.
|
|
.PP
|
|
See also findLastVisibleItem() and QIconViewItem::rect().
|
|
.SH "QIconViewItem * QIconView::findItem ( const QPoint & pos ) const"
|
|
Returns a pointer to the item that contains point \fIpos\fR, which is given in contents coordinates, or 0 if no item contains point \fIpos\fR.
|
|
.SH "QIconViewItem * QIconView::findItem ( const QString & text, ComparisonFlags compare = BeginsWith ) const"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
Returns a pointer to the first item whose text begins with \fItext\fR, or 0 if no such item could be found. Use the \fIcompare\fR flag to control the comparison behaviour. (See Qt::StringComparisonMode.)
|
|
.SH "QIconViewItem * QIconView::findLastVisibleItem ( const QRect & r ) const"
|
|
Finds the last item whose bounding rectangle overlaps \fIr\fR and returns a pointer to that item. \fIr\fR is given in content coordinates. Returns 0 if no item overlaps \fIr\fR.
|
|
.PP
|
|
See also findFirstVisibleItem().
|
|
.SH "QIconViewItem * QIconView::firstItem () const"
|
|
Returns a pointer to the first item of the icon view, or 0 if there are no items in the icon view.
|
|
.PP
|
|
See also lastItem() and currentItem().
|
|
.SH "int QIconView::gridX () const"
|
|
Returns the horizontal grid of the icon view. See the "gridX" property for details.
|
|
.SH "int QIconView::gridY () const"
|
|
Returns the vertical grid of the icon view. See the "gridY" property for details.
|
|
.SH "int QIconView::index ( const QIconViewItem * item ) const"
|
|
Returns the index of \fIitem\fR, or -1 if \fIitem\fR doesn't exist in this icon view.
|
|
.SH "void QIconView::insertInGrid ( QIconViewItem * item )\fC [virtual protected]\fR"
|
|
Inserts the QIconViewItem \fIitem\fR in the icon view's grid. \fIYou should never need to call this function.\fR Instead, insert QIconViewItems by creating them with a pointer to the QIconView that they are to be inserted into.
|
|
.SH "void QIconView::insertItem ( QIconViewItem * item, QIconViewItem * after = 0L )\fC [virtual]\fR"
|
|
Inserts the icon view item \fIitem\fR after \fIafter\fR. If \fIafter\fR is 0, \fIitem\fR is appended after the last item.
|
|
.PP
|
|
\fIYou should never need to call this function.\fR Instead create QIconViewItem's and associate them with your icon view like this:
|
|
.PP
|
|
.nf
|
|
.br
|
|
(void) new QIconViewItem( myIconview, "The text of the item", aPixmap );
|
|
.br
|
|
.fi
|
|
.SH "void QIconView::invertSelection ()\fC [virtual]\fR"
|
|
Inverts the selection. Works only in Multi and Extended selection mode.
|
|
.SH "bool QIconView::isRenaming () const"
|
|
Returns TRUE if an iconview item is being renamed; otherwise returns FALSE.
|
|
.SH "void QIconView::itemRenamed ( QIconViewItem * item, const QString & name )\fC [signal]\fR"
|
|
This signal is emitted when \fIitem\fR has been renamed to \fIname\fR, usually by in-place renaming.
|
|
.PP
|
|
See also QIconViewItem::setRenameEnabled() and QIconViewItem::rename().
|
|
.SH "void QIconView::itemRenamed ( QIconViewItem * item )\fC [signal]\fR"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
This signal is emitted when \fIitem\fR has been renamed, usually by in-place renaming.
|
|
.PP
|
|
See also QIconViewItem::setRenameEnabled() and QIconViewItem::rename().
|
|
.SH "QBrush QIconView::itemTextBackground () const"
|
|
Returns the brush to use when drawing the background of an item's text. See the "itemTextBackground" property for details.
|
|
.SH "ItemTextPos QIconView::itemTextPos () const"
|
|
Returns the position where the text of each item is drawn. See the "itemTextPos" property for details.
|
|
.SH "bool QIconView::itemsMovable () const"
|
|
Returns TRUE if the user is allowed to move items around in the icon view; otherwise returns FALSE. See the "itemsMovable" property for details.
|
|
.SH "QIconViewItem * QIconView::lastItem () const"
|
|
Returns a pointer to the last item of the icon view, or 0 if there are no items in the icon view.
|
|
.PP
|
|
See also firstItem() and currentItem().
|
|
.SH "QIconViewItem * QIconView::makeRowLayout ( QIconViewItem * begin, int & y, bool & changed )\fC [protected]\fR"
|
|
Lays out a row of icons (if Arrangement == TopToBottom this is a column). Starts laying out with the item \fIbegin\fR. \fIy\fR is the starting coordinate. Returns the last item of the row (column) and sets the new starting coordinate to \fIy\fR. The \fIchanged\fR parameter is used internally.
|
|
.PP
|
|
\fBWarning:\fR This function may be made private in a future version of Qt. We do not recommend calling it.
|
|
.SH "int QIconView::maxItemTextLength () const"
|
|
Returns the maximum length (in characters) that an item's text may have. See the "maxItemTextLength" property for details.
|
|
.SH "int QIconView::maxItemWidth () const"
|
|
Returns the maximum width that an item may have. See the "maxItemWidth" property for details.
|
|
.SH "void QIconView::mouseButtonClicked ( int button, QIconViewItem * item, const QPoint & pos )\fC [signal]\fR"
|
|
This signal is emitted when the user clicks mouse button \fIbutton\fR. If \fIitem\fR is non-null, the cursor is on \fIitem\fR. If \fIitem\fR is null, the mouse cursor isn't on any item.
|
|
.PP
|
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differ by a pixel or two, \fIpos\fR is the position at release time.)
|
|
.PP
|
|
See also mouseButtonPressed(), rightButtonClicked(), and clicked().
|
|
.SH "void QIconView::mouseButtonPressed ( int button, QIconViewItem * item, const QPoint & pos )\fC [signal]\fR"
|
|
This signal is emitted when the user presses mouse button \fIbutton\fR. If \fIitem\fR is non-null, the cursor is on \fIitem\fR. If \fIitem\fR is null, the mouse cursor isn't on any item.
|
|
.PP
|
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
|
|
.PP
|
|
See also rightButtonClicked() and pressed().
|
|
.SH "void QIconView::moved ()\fC [signal]\fR"
|
|
This signal is emitted after successfully dropping one (or more) items of the icon view. If the items should be removed, it's best to do so in a slot connected to this signal.
|
|
.PP
|
|
Example: iconview/main.cpp.
|
|
.SH "void QIconView::onItem ( QIconViewItem * item )\fC [signal]\fR"
|
|
This signal is emitted when the user moves the mouse cursor onto an \fIitem\fR, similar to the QWidget::enterEvent() function.
|
|
.SH "void QIconView::onViewport ()\fC [signal]\fR"
|
|
This signal is emitted when the user moves the mouse cursor from an item to an empty part of the icon view.
|
|
.PP
|
|
See also onItem().
|
|
.SH "void QIconView::pressed ( QIconViewItem * item )\fC [signal]\fR"
|
|
This signal is emitted when the user presses any mouse button. If \fIitem\fR is non-null, the cursor is on \fIitem\fR. If \fIitem\fR is null, the mouse cursor isn't on any item.
|
|
.PP
|
|
See also mouseButtonPressed(), rightButtonPressed(), and clicked().
|
|
.SH "void QIconView::pressed ( QIconViewItem * item, const QPoint & pos )\fC [signal]\fR"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
This signal is emitted when the user presses any mouse button. If \fIitem\fR is non-null, the cursor is on \fIitem\fR. If \fIitem\fR is null, the mouse cursor isn't on any item.
|
|
.PP
|
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differ by a pixel or two, \fIpos\fR is the position at release time.)
|
|
.PP
|
|
See also mouseButtonPressed(), rightButtonPressed(), and clicked().
|
|
.SH "void QIconView::repaintItem ( QIconViewItem * item )\fC [virtual]\fR"
|
|
Repaints the \fIitem\fR.
|
|
.SH "void QIconView::repaintSelectedItems ()"
|
|
Repaints the selected items.
|
|
.SH "ResizeMode QIconView::resizeMode () const"
|
|
Returns the resize mode of the icon view. See the "resizeMode" property for details.
|
|
.SH "void QIconView::returnPressed ( QIconViewItem * item )\fC [signal]\fR"
|
|
This signal is emitted if the user presses the Return or Enter key. \fIitem\fR is the currentItem() at the time of the keypress.
|
|
.SH "void QIconView::rightButtonClicked ( QIconViewItem * item, const QPoint & pos )\fC [signal]\fR"
|
|
This signal is emitted when the user clicks the right mouse button. If \fIitem\fR is non-null, the cursor is on \fIitem\fR. If \fIitem\fR is null, the mouse cursor isn't on any item.
|
|
.PP
|
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differ by a pixel or two, \fIpos\fR is the position at release time.)
|
|
.PP
|
|
See also rightButtonPressed(), mouseButtonClicked(), and clicked().
|
|
.SH "void QIconView::rightButtonPressed ( QIconViewItem * item, const QPoint & pos )\fC [signal]\fR"
|
|
This signal is emitted when the user presses the right mouse button. If \fIitem\fR is non-null, the cursor is on \fIitem\fR. If \fIitem\fR is null, the mouse cursor isn't on any item.
|
|
.PP
|
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
|
|
.SH "void QIconView::selectAll ( bool select )\fC [virtual]\fR"
|
|
In Multi and Extended modes, this function sets all items to be selected if \fIselect\fR is TRUE, and to be unselected if \fIselect\fR is FALSE.
|
|
.PP
|
|
In Single and NoSelection modes, this function only changes the selection status of currentItem().
|
|
.SH "void QIconView::selectionChanged ()\fC [signal]\fR"
|
|
This signal is emitted when the selection has been changed. It's emitted in each selection mode.
|
|
.SH "void QIconView::selectionChanged ( QIconViewItem * item )\fC [signal]\fR"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
This signal is emitted when the selection changes. \fIitem\fR is the newly selected item. This signal is emitted only in single selection mode.
|
|
.SH "SelectionMode QIconView::selectionMode () const"
|
|
Returns the selection mode of the icon view. See the "selectionMode" property for details.
|
|
.SH "void QIconView::setArrangement ( Arrangement am )\fC [virtual]\fR"
|
|
Sets the arrangement mode of the icon view to \fIam\fR. See the "arrangement" property for details.
|
|
.SH "void QIconView::setAutoArrange ( bool b )\fC [virtual]\fR"
|
|
Sets whether the icon view rearranges its items when a new item is inserted to \fIb\fR. See the "autoArrange" property for details.
|
|
.SH "void QIconView::setCurrentItem ( QIconViewItem * item )\fC [virtual]\fR"
|
|
Makes \fIitem\fR the new current item of the icon view.
|
|
.SH "void QIconView::setGridX ( int rx )\fC [virtual]\fR"
|
|
Sets the horizontal grid of the icon view to \fIrx\fR. See the "gridX" property for details.
|
|
.SH "void QIconView::setGridY ( int ry )\fC [virtual]\fR"
|
|
Sets the vertical grid of the icon view to \fIry\fR. See the "gridY" property for details.
|
|
.SH "void QIconView::setItemTextBackground ( const QBrush & b )\fC [virtual]\fR"
|
|
Sets the brush to use when drawing the background of an item's text to \fIb\fR. See the "itemTextBackground" property for details.
|
|
.SH "void QIconView::setItemTextPos ( ItemTextPos pos )\fC [virtual]\fR"
|
|
Sets the position where the text of each item is drawn to \fIpos\fR. See the "itemTextPos" property for details.
|
|
.SH "void QIconView::setItemsMovable ( bool b )\fC [virtual]\fR"
|
|
Sets whether the user is allowed to move items around in the icon view to \fIb\fR. See the "itemsMovable" property for details.
|
|
.SH "void QIconView::setMaxItemTextLength ( int w )\fC [virtual]\fR"
|
|
Sets the maximum length (in characters) that an item's text may have to \fIw\fR. See the "maxItemTextLength" property for details.
|
|
.SH "void QIconView::setMaxItemWidth ( int w )\fC [virtual]\fR"
|
|
Sets the maximum width that an item may have to \fIw\fR. See the "maxItemWidth" property for details.
|
|
.SH "void QIconView::setResizeMode ( ResizeMode am )\fC [virtual]\fR"
|
|
Sets the resize mode of the icon view to \fIam\fR. See the "resizeMode" property for details.
|
|
.SH "void QIconView::setSelected ( QIconViewItem * item, bool s, bool cb = FALSE )\fC [virtual]\fR"
|
|
Selects or unselects \fIitem\fR depending on \fIs\fR, and may also unselect other items, depending on QIconView::selectionMode() and \fIcb\fR.
|
|
.PP
|
|
If \fIs\fR is FALSE, \fIitem\fR is unselected.
|
|
.PP
|
|
If \fIs\fR is TRUE and QIconView::selectionMode() is Single, \fIitem\fR is selected, and the item which was selected is unselected.
|
|
.PP
|
|
If \fIs\fR is TRUE and QIconView::selectionMode() is Extended, \fIitem\fR is selected. If \fIcb\fR is TRUE, the selection state of the icon view's other items is left unchanged. If \fIcb\fR is FALSE (the default) all other items are unselected.
|
|
.PP
|
|
If \fIs\fR is TRUE and QIconView::selectionMode() is Multi \fIitem\fR is selected.
|
|
.PP
|
|
Note that \fIcb\fR is used only if QIconView::selectionMode() is Extended. \fIcb\fR defaults to FALSE.
|
|
.PP
|
|
All items whose selection status is changed repaint themselves.
|
|
.SH "void QIconView::setSelectionMode ( SelectionMode m )\fC [virtual]\fR"
|
|
Sets the selection mode of the icon view to \fIm\fR. See the "selectionMode" property for details.
|
|
.SH "void QIconView::setShowToolTips ( bool b )\fC [virtual]\fR"
|
|
Sets whether the icon view will display a tool tip with the complete text for any truncated item text to \fIb\fR. See the "showToolTips" property for details.
|
|
.SH "void QIconView::setSorting ( bool sort, bool ascending = TRUE )"
|
|
If \fIsort\fR is TRUE, this function sets the icon view to sort items when a new item is inserted. If \fIsort\fR is FALSE, the icon view will not be sorted.
|
|
.PP
|
|
Note that autoArrange() must be TRUE for sorting to take place.
|
|
.PP
|
|
If \fIascending\fR is TRUE (the default), items are sorted in ascending order. If \fIascending\fR is FALSE, items are sorted in descending order.
|
|
.PP
|
|
QIconViewItem::compare() is used to compare pairs of items. The sorting is based on the items' keys; these default to the items' text unless specifically set to something else.
|
|
.PP
|
|
See also QIconView::autoArrange, QIconView::autoArrange, sortDirection, sort(), and QIconViewItem::setKey().
|
|
.SH "void QIconView::setSpacing ( int sp )\fC [virtual]\fR"
|
|
Sets the space in pixels between icon view items to \fIsp\fR. See the "spacing" property for details.
|
|
.SH "void QIconView::setWordWrapIconText ( bool b )\fC [virtual]\fR"
|
|
Sets whether the item text will be word-wrapped if it is too long to \fIb\fR. See the "wordWrapIconText" property for details.
|
|
.SH "bool QIconView::showToolTips () const"
|
|
Returns TRUE if the icon view will display a tool tip with the complete text for any truncated item text; otherwise returns FALSE. See the "showToolTips" property for details.
|
|
.SH "void QIconView::slotUpdate ()\fC [virtual protected slot]\fR"
|
|
This slot is used for a slightly-delayed update.
|
|
.PP
|
|
The icon view is not redrawn immediately after inserting a new item but after a very small delay using a QTimer. This means that when many items are inserted in a loop the icon view is probably redrawn only once at the end of the loop. This makes the insertions both flicker-free and faster.
|
|
.SH "void QIconView::sort ( bool ascending = TRUE )\fC [virtual]\fR"
|
|
Sorts and rearranges all the items in the icon view. If \fIascending\fR is TRUE, the items are sorted in increasing order, otherwise they are sorted in decreasing order.
|
|
.PP
|
|
QIconViewItem::compare() is used to compare pairs of items. The sorting is based on the items' keys; these default to the items' text unless specifically set to something else.
|
|
.PP
|
|
Note that this function sets the sort order to \fIascending\fR.
|
|
.PP
|
|
See also QIconViewItem::key(), QIconViewItem::setKey(), QIconViewItem::compare(), QIconView::setSorting(), and QIconView::sortDirection.
|
|
.SH "bool QIconView::sortDirection () const"
|
|
Returns TRUE if the sort direction for inserting new items is ascending;; otherwise returns FALSE. See the "sortDirection" property for details.
|
|
.SH "bool QIconView::sorting () const"
|
|
Returns TRUE if the icon view sorts on insertion; otherwise returns FALSE. See the "sorting" property for details.
|
|
.SH "int QIconView::spacing () const"
|
|
Returns the space in pixels between icon view items. See the "spacing" property for details.
|
|
.SH "void QIconView::startDrag ()\fC [virtual protected]\fR"
|
|
Starts a drag.
|
|
.SH "void QIconView::takeItem ( QIconViewItem * item )\fC [virtual]\fR"
|
|
Takes the icon view item \fIitem\fR out of the icon view and causes an update of the screen display. The item is not deleted. You should normally not need to call this function because QIconViewItem::~QIconViewItem() calls it. The normal way to delete an item is to delete it.
|
|
.SH "bool QIconView::wordWrapIconText () const"
|
|
Returns TRUE if the item text will be word-wrapped if it is too long; otherwise returns FALSE. See the "wordWrapIconText" property for details.
|
|
.SS "Property Documentation"
|
|
.SH "Arrangement arrangement"
|
|
This property holds the arrangement mode of the icon view.
|
|
.PP
|
|
This can be LeftToRight or TopToBottom. The default is LeftToRight.
|
|
.PP
|
|
Set this property's value with setArrangement() and get this property's value with arrangement().
|
|
.SH "bool autoArrange"
|
|
This property holds whether the icon view rearranges its items when a new item is inserted.
|
|
.PP
|
|
The default is TRUE.
|
|
.PP
|
|
Note that if the icon view is not visible at the time of insertion, QIconView defers all position-related work until it is shown and then calls arrangeItemsInGrid().
|
|
.PP
|
|
Set this property's value with setAutoArrange() and get this property's value with autoArrange().
|
|
.SH "uint count"
|
|
This property holds the number of items in the icon view.
|
|
.PP
|
|
Get this property's value with count().
|
|
.SH "int gridX"
|
|
This property holds the horizontal grid of the icon view.
|
|
.PP
|
|
If the value is -1, (the default), QIconView computes suitable column widths based on the icon view's contents.
|
|
.PP
|
|
Note that setting a grid width overrides setMaxItemWidth().
|
|
.PP
|
|
Set this property's value with setGridX() and get this property's value with gridX().
|
|
.SH "int gridY"
|
|
This property holds the vertical grid of the icon view.
|
|
.PP
|
|
If the value is -1, (the default), QIconView computes suitable column heights based on the icon view's contents.
|
|
.PP
|
|
Set this property's value with setGridY() and get this property's value with gridY().
|
|
.SH "QBrush itemTextBackground"
|
|
This property holds the brush to use when drawing the background of an item's text.
|
|
.PP
|
|
By default this brush is set to NoBrush, meaning that only the normal icon view background is used.
|
|
.PP
|
|
Set this property's value with setItemTextBackground() and get this property's value with itemTextBackground().
|
|
.SH "ItemTextPos itemTextPos"
|
|
This property holds the position where the text of each item is drawn.
|
|
.PP
|
|
Valid values are Bottom or Right. The default is Bottom.
|
|
.PP
|
|
Set this property's value with setItemTextPos() and get this property's value with itemTextPos().
|
|
.SH "bool itemsMovable"
|
|
This property holds whether the user is allowed to move items around in the icon view.
|
|
.PP
|
|
The default is TRUE.
|
|
.PP
|
|
Set this property's value with setItemsMovable() and get this property's value with itemsMovable().
|
|
.SH "int maxItemTextLength"
|
|
This property holds the maximum length (in characters) that an item's text may have.
|
|
.PP
|
|
The default is 255 characters.
|
|
.PP
|
|
Set this property's value with setMaxItemTextLength() and get this property's value with maxItemTextLength().
|
|
.SH "int maxItemWidth"
|
|
This property holds the maximum width that an item may have.
|
|
.PP
|
|
The default is 100 pixels.
|
|
.PP
|
|
Note that if the gridX() value is set QIconView will ignore this property.
|
|
.PP
|
|
Set this property's value with setMaxItemWidth() and get this property's value with maxItemWidth().
|
|
.SH "ResizeMode resizeMode"
|
|
This property holds the resize mode of the icon view.
|
|
.PP
|
|
This can be Fixed or Adjust. The default is Fixed. See ResizeMode.
|
|
.PP
|
|
Set this property's value with setResizeMode() and get this property's value with resizeMode().
|
|
.SH "SelectionMode selectionMode"
|
|
This property holds the selection mode of the icon view.
|
|
.PP
|
|
This can be Single (the default), Extended, Multi or NoSelection.
|
|
.PP
|
|
Set this property's value with setSelectionMode() and get this property's value with selectionMode().
|
|
.SH "bool showToolTips"
|
|
This property holds whether the icon view will display a tool tip with the complete text for any truncated item text.
|
|
.PP
|
|
The default is TRUE. Note that this has no effect if setWordWrapIconText() is TRUE, as it is by default.
|
|
.PP
|
|
Set this property's value with setShowToolTips() and get this property's value with showToolTips().
|
|
.SH "bool sortDirection"
|
|
This property holds whether the sort direction for inserting new items is ascending;.
|
|
.PP
|
|
The default is TRUE (i.e. ascending). This sort direction is only meaningful if both sorting() and autoArrange() are TRUE.
|
|
.PP
|
|
To set the sort direction, use setSorting()
|
|
.PP
|
|
Get this property's value with sortDirection().
|
|
.SH "bool sorting"
|
|
This property holds whether the icon view sorts on insertion.
|
|
.PP
|
|
The default is FALSE, i.e. no sorting on insertion.
|
|
.PP
|
|
To set the sorting, use setSorting().
|
|
.PP
|
|
Get this property's value with sorting().
|
|
.SH "int spacing"
|
|
This property holds the space in pixels between icon view items.
|
|
.PP
|
|
The default is 5 pixels.
|
|
.PP
|
|
Negative values for spacing are illegal.
|
|
.PP
|
|
Set this property's value with setSpacing() and get this property's value with spacing().
|
|
.SH "bool wordWrapIconText"
|
|
This property holds whether the item text will be word-wrapped if it is too long.
|
|
.PP
|
|
The default is TRUE.
|
|
.PP
|
|
If this property is FALSE, icon text that is too long is truncated, and an ellipsis (...) appended to indicate that truncation has occurred. The full text can still be seen by the user if they hover the mouse because the full text is shown in a tooltip; see setShowToolTips().
|
|
.PP
|
|
Set this property's value with setWordWrapIconText() and get this property's value with wordWrapIconText().
|
|
|
|
.SH "SEE ALSO"
|
|
.BR http://doc.trolltech.com/ntqiconview.html
|
|
.BR http://www.trolltech.com/faq/tech.html
|
|
.SH COPYRIGHT
|
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
|
license file included in the distribution for a complete license
|
|
statement.
|
|
.SH AUTHOR
|
|
Generated automatically from the source code.
|
|
.SH BUGS
|
|
If you find a bug in Qt, please report it as described in
|
|
.BR http://doc.trolltech.com/bughowto.html .
|
|
Good bug reports help us to help you. Thank you.
|
|
.P
|
|
The definitive TQt documentation is provided in HTML format; it is
|
|
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
|
|
a web browser. This man page is provided as a convenience for those
|
|
users who prefer man pages, although this format is not officially
|
|
supported by Trolltech.
|
|
.P
|
|
If you find errors in this manual page, please report them to
|
|
.BR qt-bugs@trolltech.com .
|
|
Please include the name of the manual page (tqiconview.3qt) and the Qt
|
|
version (3.3.8).
|