QIconView - Area with movable labelled icons
#include <qiconview.h>
Inherits QScrollView.
Public Members
enum SelectionMode { Single = 0, Multi, Extended,
NoSelection }
enum Arrangement { LeftToRight = 0, TopToBottom }
enum ResizeMode { Fixed = 0, Adjust }
enum ItemTextPos { Bottom = 0, Right }
QIconView ( QWidget * parent = 0, const char * name = 0,
WFlags f = 0 )
virtual ~QIconView ()
virtual void insertItem ( QIconViewItem * item,
QIconViewItem * after = 0L )
virtual void takeItem ( QIconViewItem * item )
int index ( const QIconViewItem * item ) const
QIconViewItem* firstItem () const
QIconViewItem* lastItem () const
QIconViewItem* currentItem () const
virtual void setCurrentItem ( QIconViewItem * item )
virtual void setSelected ( QIconViewItem * item, bool s,
bool cb = FALSE )
uint count () const
virtual void setSelectionMode ( SelectionMode m )
SelectionMode selectionMode () const
QIconViewItem* findItem ( const QPoint & pos ) const
QIconViewItem* findItem ( const QString & text ) const
virtual void selectAll ( bool select )
virtual void clearSelection ()
virtual void invertSelection ()
virtual void repaintItem ( QIconViewItem * item )
void ensureItemVisible ( QIconViewItem * item )
QIconViewItem* findFirstVisibleItem ( const QRect & r )
const
QIconViewItem* findLastVisibleItem ( const QRect & r )
const
virtual void clear ()
virtual void setGridX ( int rx )
virtual void setGridY ( int ry )
int gridX () const
int gridY () const
virtual void setSpacing ( int sp )
int spacing () const
virtual void setItemTextPos ( ItemTextPos pos )
ItemTextPos itemTextPos () const
virtual void setItemTextBackground ( const QBrush & b )
QBrush itemTextBackground () const
virtual void setArrangement ( Arrangement am )
Arrangement arrangement () const
ResizeMode resizeMode () const
virtual void setMaxItemWidth ( int w )
int maxItemWidth () const
virtual void setMaxItemTextLength ( int w )
int maxItemTextLength () const
virtual void setAutoArrange ( bool b )
bool autoArrange () const
virtual void setShowToolTips ( bool b )
bool showToolTips () const
void setSorting ( bool sort, bool ascending = TRUE )
bool sorting () const
bool sortDirection () const
virtual void setItemsMovable ( bool b )
bool itemsMovable () const
virtual void setWordWrapIconText ( bool b )
bool wordWrapIconText () const
virtual void sort ( bool ascending = TRUE )
Public Slots
virtual void arrangeItemsInGrid ( const QSize & grid, bool
update = TRUE )
virtual void arrangeItemsInGrid ( bool update = TRUE )
virtual void updateContents () (internal)
Signals
void selectionChanged ()
void selectionChanged ( QIconViewItem * item )
void currentChanged ( QIconViewItem * item )
void clicked ( QIconViewItem * )
void clicked ( QIconViewItem *, const QPoint & )
void pressed ( QIconViewItem * )
void pressed ( QIconViewItem *, const QPoint & )
void doubleClicked ( QIconViewItem * item )
void returnPressed ( QIconViewItem * item )
void rightButtonClicked ( QIconViewItem * item, const
QPoint & pos )
void rightButtonPressed ( QIconViewItem * item, const
QPoint & pos )
void mouseButtonPressed ( int button, QIconViewItem *
item, const QPoint & pos )
void mouseButtonClicked ( int button, QIconViewItem *
item, const QPoint & pos )
void dropped ( QDropEvent * e, const
QValueList<QIconDragItem> & lst )
void moved ()
void onItem ( QIconViewItem * item )
void onViewport ()
void itemRenamed ( QIconViewItem * item, const QString & )
void itemRenamed ( QIconViewItem * item )
Protected Members
virtual void drawRubber ( QPainter * p )
virtual QDragObject* dragObject ()
virtual void insertInGrid ( QIconViewItem * item )
virtual void drawBackground ( QPainter * p, const QRect &
r )
void emitSelectionChanged ( QIconViewItem * i = 0 )
void emitRenamed ( QIconViewItem * item ) (internal)
QIconViewItem* makeRowLayout ( QIconViewItem * begin, int
& y )
Protected Slots
virtual void doAutoScroll ()
virtual void adjustItems ()
virtual void slotUpdate ()
Properties
Type Name READ WRITE Options
------------------------------------------------------------------------------------------
bool sorting sorting
bool sortDirection sortDirection
SelectionMode selectionMode selectionMode setSelectionMode
int gridX gridX setGridX
int gridY gridY setGridY
int spacing spacing setSpacing
ItemTextPos itemTextPos itemTextPos setItemTextPos
QBrush itemTextBackground itemTextBackground setItemTextBackground
Arrangement arrangement arrangement setArrangement
ResizeMode resizeMode resizeMode setResizeMode
int maxItemWidth maxItemWidth setMaxItemWidth
int maxItemTextLength maxItemTextLength setMaxItemTextLength
bool autoArrange autoArrange setAutoArrange
bool itemsMovable itemsMovable setItemsMovable
bool wordWrapIconText wordWrapIconText setWordWrapIconText
bool showToolTips showToolTips setShowToolTips
uint count count
DESCRIPTION
The QIconView class provides an area with movable labelled
icons.
It can display and control a grid or other 2-d layout of
items, and provides the ability to add or remove new items
at any time, lets the user select one or may items,
rearrange the items, provides drag and drop of items, and
so on.
Each item (a QIconViewItem) contains a text and a pixmap
(the icon itself).
The simplest usage of QIconView is to create the object,
create some QIconViewItems with the view as parent, set
the view's geometry, and show it.
When an item is inserted, QIconView allocates a spot for
fills up the leftmost column first, then goes rightwards.
You can change that using setArrangement(), or insert
items in a specified position by calling the appropriate
constructors or QIconViewItem::insertItem(), or sort while
the view is on-screen using setSorting() and/or sort().
Each (selectable) item can be selected, and the view
provides various SelectionMode settings. The default is
Single - when one item is selected, the previously
selected item is unselected.
The QIconView provides a widget which can contain lots of
iconview items which can be selected, dragged and so on.
Items can be inserted in a grid and can flow from top to
bottom (TopToBottom) or from left to right (LeftToRight).
The text can be either displayed at the bottom of the
icons or the the right of the icons. Items can also be
inserted in a sorted order. There are also methods to re-
arrange and re-sort the items after they have been
inserted.
There is a variety of selection modes, described in the
QIconView::SelectionMode documentation. The default is
single-selection, and you can change it using
setSelectionMode().
Since QIconView offers multiple selection it has to
display keyboard focus and selection state separately.
Therefore there are functions both 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 iconview provides
a rubberband too.
Items can also be in-place renamed.
The normal way to insert some items is to create
QIconViewItems and pass the iconview as parent. By using
insertItem(), items can be inserted manually too. The
QIconView offers basic methods similar to the QListView
and QListBox, like QIconView::takeItem(),
QIconView::clearSelection(), QIconView::setSelected(),
QIconView::setCurrentItem(), QIconView::currentItem() and
much more.
As the internal structure to store the iconview items is
linear (a double linked list), no iterator class is needed
to iterate over all items. This can be easily done with a
code like
QIconView *iv = the iconview
i->doSmething();
}
To notify the application about changes in the iconview
there are several signals which are emitted by the
QIconView.
The QIconView is designed for Drag'n'Drop, as the icons
are also moved inside the iconview itself using DnD. So
the QIconView provides some methods for extended DnD too.
To use DnD correctly in the iconview, please read
following instructions:
There are two different ways to do that, depending what
you want. The first case is the simple one, in which case
just the dragobject you created is dragged around. If you
want, that drag shapes (the rectangles of the dragged
items with exact positions) are drawn, you have to choose
the more complicated way. Here first the simple case is
described:
In the simple case you only need for starting a drag to
reimplement QIconView::dragObject(). There you create a
QDragObject with the data you want to drag and return it.
And for entering drags you don't need to do anything
special then. Just connect to dropped() signal to get
notified about drops onto the viewport and reimplement
QIconViewItem::acceptDrop() and QIconViewItem::dropped()
to be able to react on drops onto an iconview item.
If you want to have drag shapes drawn, you have to do
quite a bit more and complex things:
The first part is starting drags: If you want to use
extended DnD in the QIconView, you should use QIconDrag
(or a derived class from that) as dragobject and in
dragObject() create such an object and return it. Before
returning it, fill it there with QIconDragItems. Normally
such a drag should offer data of each selected item. So in
dragObject() you should iterate over all items, create for
each selected item a QIconDragItem and append this with
QIconDrag::append() to the QIconDrag object. With
QIconDragItem::setData() you can set the data of each item
which should be dragged. If you want to offer the data in
additional mime-types, it's the best to use a class
derived from QIconDrag which implements additional
encoding and decoding functions.
Now, when a drag enters the iconview, there is not much
todo. Just connect to the dropped() signal and reimplement
QIconViewItem::dropped() and QIconViewItem::acceptDrop().
The only special thing in this case is the second argument
in the dropped() signal and in QIconViewItem::dropped().
of these signal/method.
For an example implementation of the complex Drag'n'Drop
stuff look at the qfileiconview example
(qt/examples/qfileiconview)
Finally, see also QIconViewItem::setDragEnabled(),
QIconViewItem::setDropEnabled(),
QIconViewItem::acceptDrop() and QIconViewItem::dropped()
[Image Omitted]
[Image Omitted]
Examples: iconview/main.cpp
Member Type Documentation
QIconView::Arrangement
This enum type decides in which direction the items, which
do not fit onto the screen anymore flow.
LeftToRight - Items, which don't fit onto the view, go
further down (you get a vertical scrollbar)
TopToBottom - Items, which don't fit onto the view, go
further right (you get a horizontal scrollbar)
QIconView::ItemTextPos
This enum type specifies the position of the item text in
relation to the icon.
Bottom - The text is drawn at the bottom of the icon)
Right - The text is drawn at the right of the icon)
QIconView::ResizeMode
This enum type decides how QIconView should treat the
positions of its icons when the widget is resized. The
currently defined modes are:
Fixed - the icons' positions are not changed.
Adjust - the icons' positions are adjusted to be within
the new geometry, if possible.
QIconView::SelectionMode
This enumerated type is used by QIconView to indicate how
it reacts to selection by the user. It has four values:
Single - When the user selects an item, any
already-selected item becomes unselected, and the
that the user can never clear the selection, even
though the selection may be cleared by the
application programmer using
QIconView::clearSelection().
Multi - When the user selects an item in the most ordinary
way, the selection status of that item is toggled
and the other items are left alone.
Extended - When the user selects an item in the most
ordinary way, 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. And 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
stayes pressed.
NoSelection - Items cannot be selected.
In other words, Single is a real single-selection
iconview, Multi a real multi-selection iconview, and
Extended iconview where users can select multiple items
but usually want to select either just one or a range of
contiguous items, and NoSelection is for a iconview where
the user can look but not touch.
MEMBER FUNCTION DOCUMENTATION
QIconView::QIconView ( QWidget * parent = 0, const char * name =
0, WFlags f = 0 )
Constructs an empty icon view.
QIconView::~QIconView () [virtual]
Destructs the iconview and deletes all items.
void QIconView::adjustItems () [virtual protected slot]
Adjusts the positions of the items to the geometry of the
iconview.
void QIconView::arrangeItemsInGrid ( bool update = TRUE )
[virtual slot]
Arranges all items in the grid. For the grid the specified
values, given by QIconView::setGridX() and
QIconView::setGridY() are used. Even if
QIconView::sorting() is enabled, the items are not
resorted in this method. If you want to sort and re-
arrange all items, use iconview->sort(
iconview->sortDirection() );
See also QIconView::setGridX(), QIconView::setGridY() and
QIconView::sort().
void QIconView::arrangeItemsInGrid ( const QSize & grid, bool
update = TRUE ) [virtual slot]
Arranges all items in the grid; If the grid is invalid
(see QSize::isValid(), an invalid size is created when
using the default constructor of QSize()) the best fitting
grid is calculated first and used then.
if update is TRUE, the viewport is repainted.
QIconView::Arrangement QIconView::arrangement() const
Returns the arrangement mode of the iconview.
See also QIconView::setArrangement().
bool QIconView::autoArrange () const
Returns TRUE if all items are re-arranged in the grid if a
new one is inserted, else FALSE.
See also QIconView::setAutoArrange().
void QIconView::clear () [virtual]
Cleares the iconview.
void QIconView::clearSelection () [virtual]
Unselects all items.
void QIconView::clicked ( QIconViewItem * item ) [signal]
This signal is emitted when the user clicked (pressed +
released) with any mouse button on either and item (then
item is the item under the mouse cursor) or somewhere else
(then item is 0).
void QIconView::clicked ( QIconViewItem * item, const QPoint &
pos ) [signal]
This signal is emitted when the user clicked (pressed +
released) with any mouse button on either and item (then
item is the item under the mouse cursor) or somewhere else
(then item is 0). pos the position of the mouse cursor.
void QIconView::contentsDragEnterEvent ( QDragEnterEvent * e )
[virtual protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::contentsDragLeaveEvent ( QDragLeaveEvent * )
[virtual protected]
Reimplemented for internal reasons; the API is not
affected.
[virtual protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::contentsDropEvent ( QDropEvent * e ) [virtual
protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::contentsMouseDoubleClickEvent ( QMouseEvent * e )
[virtual protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::contentsMouseMoveEvent ( QMouseEvent * e )
[virtual protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::contentsMousePressEvent ( QMouseEvent * e )
[virtual protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::contentsMouseReleaseEvent ( QMouseEvent * e )
[virtual protected]
Reimplemented for internal reasons; the API is not
affected.
uint QIconView::count () const
Returns the number of items in the iconview.
void QIconView::currentChanged ( QIconViewItem * item ) [signal]
This signal is emitted, when the different items got
current. item is the new current item or 0, if no item is
current now.
QIconViewItem * QIconView::currentItem () const
Returns a pointer to the current item fo the iconview, or
0, if no item is current.
void QIconView::doAutoScroll () [virtual protected slot]
Does autoscrolling when selecting multiple icons with the
rubber band.
void QIconView::doubleClicked ( QIconViewItem * item ) [signal]
This signal is emitted, if the user double-clicked on the
item item.
QDragObject * QIconView::dragObject () [virtual protected]
Returns the QDragObject which should be used for DnD. This
method is called by the iconview when starting a drag to
get the dragobject which should be used for the drag.
See also QIconDrag.
void QIconView::drawBackground ( QPainter * p, const QRect & r )
[virtual protected]
This method is called to draw the rectangle r of the
background using the painter p. xOffset and yOffset are
known using the methods contentsX() and contentsY().
The default implementation only fills r with
colorGroup().base(). Subclasses may reimplement this to
draw fency backgrounds.
void QIconView::drawContents ( QPainter * p, int cx, int cy, int
cw, int ch ) [virtual protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::drawRubber ( QPainter * p ) [virtual protected]
Draws the rubber band using the painter p.
void QIconView::dropped ( QDropEvent * e, const
QValueList<QIconDragItem> & lst ) [signal]
This signal is emitted, when a drop event occurred onto
the viewport (not onto an icon), which the iconview itself
can't handle.
e gives you all information about the drop. If the drag
object of the drop was a QIconDrag, lst contains the list
of the dropped items. You can get the data using
QIconDragItem::data() of each item then.
So, if lst is not empty, use this data for further
operations, else the drag was not a QIconDrag, so you have
to decode e yourself and work with that.
void QIconView::emitSelectionChanged ( QIconViewItem * i = 0 )
[protected]
Emits signals, that indicate selection changes.
void QIconView::ensureItemVisible ( QIconViewItem * item )
Makes sure, that item is visible, and scrolls the view if
required.
void QIconView::enterEvent ( QEvent * e ) [virtual protected]
Reimplemented for internal reasons; the API is not
affected.
bool QIconView::eventFilter ( QObject * o, QEvent * e ) [virtual]
Reimplemented for internal reasons; the API is not
affected.
Reimplemented from QObject.
) const
Finds the first item which is visible in the rectangle r
in contents coordinates. If no items are visible at all, 0
is returned.
QIconViewItem * QIconView::findItem ( const QPoint & pos ) const
Returns a pointer to the item which contains pos, which is
given on contents coordinates.
QIconViewItem * QIconView::findItem ( const QString & text )
const
Returns a pointer to the first item which could be found
that contains text, or 0 if no such item could be found.
QIconViewItem* QIconView::findLastVisibleItem ( const QRect & r )
const
Finds the last item which is visible in the rectangle r in
contents coordinates. If no items are visible at all, 0 is
returned.
QIconViewItem * QIconView::firstItem () const
Returns a pointer to the first item fo the iconview, or 0,
if there are no items in the iconview.
void QIconView::focusInEvent ( QFocusEvent * e ) [virtual
protected]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::focusOutEvent ( QFocusEvent * ) [virtual
protected]
Reimplemented for internal reasons; the API is not
affected.
int QIconView::gridX () const
Returns the horizontal grid.
See also QIconView::setGridX().
int QIconView::gridY () const
Returns the vertica grid.
See also QIconView::setGridY().
int QIconView::index ( const QIconViewItem * item ) const
Returns the index of item or -1 if item doesn't exist in
this icon view.
void QIconView::insertInGrid ( QIconViewItem * item ) [virtual
protected]
Inserts an item in the grid of the iconview. You should
never need to call this manually.
* after = 0L ) [virtual]
Inserts the iconview item item after after. If after is 0,
item is appended.
You should never need to call this method yourself, you
should rather do
(void) new QIconViewItem( iconview, "This is the text of the item", pixmap );
This does everything required for inserting an item.
void QIconView::invertSelection () [virtual]
Inverts the selection. Works only in Multi and Extended
selection mode.
void QIconView::itemRenamed ( QIconViewItem * item ) [signal]
If the item has been renamed (e.g. by in-place renaming),
this signal is emitted.
void QIconView::itemRenamed ( QIconViewItem * item, const QString
& name ) [signal]
If the item has been renamed (e.g. by in-place renaming),
this signal is emitted. name is the new text (name) of the
item.
QBrush QIconView::itemTextBackground () const
Returns the brush which is used to draw the background of
an item text
See also setItemTextBackground().
QIconView::ItemTextPos QIconView::itemTextPos() const
Returns the position, at which the text of the items are
drawn.
See also QIconView::setItemTextPos().
bool QIconView::itemsMovable () const
Returns TRUE, if the user is allowed to move items around
in the iconview, else FALSE;
See also QIconView::setItemsMovable().
void QIconView::keyPressEvent ( QKeyEvent * e ) [virtual
protected]
Reimplemented for internal reasons; the API is not
affected.
QIconViewItem * QIconView::lastItem () const
Returns a pointer to the last item fo the iconview, or 0,
if there are no items in the iconview.
int & y ) [protected]
Lays out a row of icons (in Arrangement == TopToBottom
this is a column). Starts laying out with the item begin.
y is the starting coordinate. Returns the last item of the
row and sets the new starting coordinate to y.
This function may be made private in a future version of
Qt. We recommend not calling it.
int QIconView::maxItemTextLength () const
Returns the maximum length (in characters), which the text
of an icon may have.
See also QIconView::setMaxItemTextLength().
int QIconView::maxItemWidth () const
Returns the maximum width (in pixels), which an item may
have.
See also QIconView::setMaxItemWidth().
QSize QIconView::minimumSizeHint () const [virtual]
Reimplemented for internal reasons; the API is not
affected.
Reimplemented from QWidget.
void QIconView::mouseButtonClicked ( int button, QIconViewItem *
item, const QPoint & pos ) [signal]
This signal is emitted when the user clicked (pressed +
released) with any mouse button on either and item (then
item is the item under the mouse cursor) or somewhere else
(then item is 0). button is the number of the mouse button
which the user clicked, and pos the position of the mouse
cursor.
void QIconView::mouseButtonPressed ( int button, QIconViewItem *
item, const QPoint & pos ) [signal]
This signal is emitted when the user pressed with any
mouse button on either and item (then item is the item
under the mouse cursor) or somewhere else (then item is
0). button is the number of the mouse button which the
user pressed, and pos the position of the mouse cursor.
void QIconView::moved () [signal]
This signal is emitted after successfully dropping an (or
some) item(s) of the iconview somewhere and if they should
be removed now.
void QIconView::onItem ( QIconViewItem * i ) [signal]
This signal is emitted, when the user moves the mouse
cursor onto an item. Itīs only emitted once per item.
This signal is emitted, when the user moves the mouse
cursor, which was on an item away from the item onto the
viewport.
void QIconView::pressed ( QIconViewItem * item ) [signal]
This signal is emitted when the user pressed with any
mouse button on either and item (then item is the item
under the mouse cursor) or somewhere else (then item is
0).
void QIconView::pressed ( QIconViewItem * item, const QPoint &
pos ) [signal]
This signal is emitted when the user pressed with any
mouse button on either and item (then item is the item
under the mouse cursor) or somewhere else (then item is
0). pos the position of the mouse cursor.
void QIconView::repaintItem ( QIconViewItem * item ) [virtual]
Repaints the item.
void QIconView::resizeEvent ( QResizeEvent * e ) [virtual
protected]
Reimplemented for internal reasons; the API is not
affected.
QIconView::ResizeMode QIconView::resizeMode() const
Returns the resize mode of the iconview.
See also QIconView::setResizeMode().
void QIconView::returnPressed ( QIconViewItem * item ) [signal]
This signal is emitted, if the user pressed the return or
enter button. item is the item which was current while
return or enter was pressed.
void QIconView::rightButtonClicked ( QIconViewItem * item, const
QPoint & pos ) [signal]
This signal is emitted when the user clicked (pressed +
released) with the right mouse button on either and item
(then item is the item under the mouse cursor) or
somewhere else (then item is 0). pos the position of the
mouse cursor.
void QIconView::rightButtonPressed ( QIconViewItem * item, const
QPoint & pos ) [signal]
This signal is emitted when the user pressed with the
right mouse button on either and item (then item is the
item under the mouse cursor) or somewhere else (then item
is 0). pos the position of the mouse cursor.
void QIconView::selectAll ( bool select ) [virtual]
If select is TRUE, all items get selected, else all get
unselected. This works only in the selection modes Multi
of the current item is just set to select.
void QIconView::selectionChanged () [signal]
This signal is emitted when the selection has been
changed. It's emitted in each selection mode.
void QIconView::selectionChanged ( QIconViewItem * item )
[signal]
This signal is emitted when the selection has been
changed. item is the new selected item. This signal is
only emitted in single selection mode.
QIconView::SelectionMode QIconView::selectionMode() const
Returns the selection mode of the iconview. The initial
mode is Single.
See also setSelectionMode().
void QIconView::setArrangement ( Arrangement am )
Sets the arrangement mode of the iconview to am, which
must be one of LeftToRight and TopToBottom.
See also Arrangement.
void QIconView::setAutoArrange ( bool b ) [virtual]
If b is TRUE, all items are re-arranged in the grid if a
new one is inserted. Else, the best fitting place for the
new item is searched and the other ones are not touched.
This setting only applies if the iconview is visible. If
you insert items and the iconview is not visible, the
icons are reordered when it gets visible.
void QIconView::setContentsPos ( int x, int y ) [virtual slot]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::setCurrentItem ( QIconViewItem * item ) [virtual]
Makes item the new current item of the iconview.
void QIconView::setFont ( const QFont & f ) [virtual]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::setGridX ( int rx ) [virtual]
Sets the horizontal grid to rx. If rx is -1, there is no
horizontal grid used for arranging items.
void QIconView::setGridY ( int ry ) [virtual]
Sets the vertical grid to ry. If ry is -1, there is no
vertical grid used for arranging items.
[virtual]
Sets the brush, which should be used when drawing the
background of an item text. By default, this brush is set
to NoBrush, which means no extra brush is used for drawing
the item text background (just the normal iconview
background).
void QIconView::setItemTextPos ( ItemTextPos pos )
Sets the position, where the text of the items is drawn.
This can be Bottom or Right.
void QIconView::setItemsMovable ( bool b ) [virtual]
If b is TRUE, the user is allowed to move items around in
the iconview. if b is FALSE, the user is not allowed to do
that.
void QIconView::setMaxItemTextLength ( int w ) [virtual]
Sets the maximum length (in characters), which an item
text may have.
void QIconView::setMaxItemWidth ( int w ) [virtual]
Sets the maximum width, which an item may have. If a
gridX() is set, this value is ignored, and the gridX()
value is used.
void QIconView::setPalette ( const QPalette & p ) [virtual]
Reimplemented for internal reasons; the API is not
affected.
void QIconView::setResizeMode ( ResizeMode rm )
Sets the resize mode of the iconview to rm, which must be
one of Fixed and Adjust.
See also ResizeMode.
void QIconView::setSelected ( QIconViewItem * item, bool s, bool
cb = FALSE ) [virtual]
Selects or unselects item depending on s, and may also
unselect other items, depending on
QIconView::selectionMode() and cb.
If s is FALSE, item is unselected.
If s is TRUE and QIconView::selectionMode() is Single,
item is selected, and the item which was selected is
unselected.
If s is TRUE and QIconView::selectionMode() is Extended,
item is selected. If cb is TRUE, the other items of the
iconview are not touched. If cb is FALSE (the default) all
other items are unselected.
If s is TRUE and QIconView::selectionMode() is Multi item
Note that cb is used only if QIconView::selectionMode() is
Extended. cb defaults to FALSE.
All items whose selection status change repaint
themselves.
void QIconView::setSelectionMode ( SelectionMode m )
Sets the selection mode of the iconview to m, which may be
one of Single (the default), Extended, Multi or
NoSelection.
See also selectionMode().
Examples: iconview/main.cpp
void QIconView::setShowToolTips ( bool b ) [virtual]
If wordWrapIconText() is FALSE, it happens that an item
text is truncated because it's too large for one line. If
you specify TRUE for b here and the user moves the mouse
onto the item a tooltip with the whole item text is shown.
If you pass FALSE here this feature is switched off.
See also setWordWrapIconText().
void QIconView::setSorting ( bool sort, bool ascending = TRUE )
If sort is TRUE, new items are inserted sorted. The sort
direction is specified using ascending.
Inserting items sorted only works when re-arranging items
is set to TRUE as well (using
QIconView::setAutoArrange()).
See also QIconView::setAutoArrange() and
QIconView::autoArrange().
void QIconView::setSpacing ( int sp ) [virtual]
Sets the space between iconview items to sp.
void QIconView::setWordWrapIconText ( bool b ) [virtual]
If the width of an item text is larger than the maximal
item width, there are two possibilities how the QIconView
can deal with this. Either it does a word wrap of the item
text, so that it uses multiple lines. Or it truncates the
item text so that it shrinks to the maximal item width and
appends three dots "..." to the displayed text to indicate
that not the full text is displayed.
If you set b to TRUE, a word wrap is done, else the text
is displayed truncated.
NOTE: Both possibilities just change the way how the text
is displayed, they do NOT modify the item text itslef.
void QIconView::showEvent ( QShowEvent * ) [virtual]
Reimplemented for internal reasons; the API is not
affected.
bool QIconView::showToolTips () const
Returns TRUE if a tooltip is shown for truncated item
texts and FALSE otherwise.
See also setShowToolTips() and setWordWrapIconText().
QSize QIconView::sizeHint () const [virtual]
Reimplemented for internal reasons; the API is not
affected.
Examples: iconview/main.cpp
Reimplemented from QWidget.
QSizePolicy QIconView::sizePolicy () const [virtual]
Reimplemented for internal reasons; the API is not
affected.
Reimplemented from QWidget.
void QIconView::slotUpdate () [virtual protected slot]
Because of efficiency, the iconview is not redrawn
immediately after inserting a new item, but with a very
small delay using a QTimer. The result of this is, that if
lots of items are inserted in a short time (e.g. in a
loop), the iconview is not redrawn after each inserted
item, but after inserting all of them, which makes the
operation much faster and flicker-free.
void QIconView::sort ( bool ascending = TRUE ) [virtual]
Sorts the items of the listview and re-arranges them
afterwards. If ascending is TRUE, the items are sorted in
increasing order, else in decreasing order. For sorting
QIconViewItem::compare() is used. The default sort
direction is set to the sort direction you set here.
See also QIconViewItem::key(), QIconViewItem::setKey(),
QIconViewItem::compare(), QIconView::setSorting() and
QIconView::sortDirection().
bool QIconView::sortDirection () const
Returns TRUE if the sort direction for inserting new items
is ascending, FALSE means descending. This sort direction
has only a meaning if re-sorting and re-arranging of new
inserted items is enabled.
See also QIconView::setSorting() and
QIconView::setAutoArrange().
Returns TRUE if new items are inserted sorted, else FALSE.
See also QIconView::setSorting().
int QIconView::spacing () const
Returns the spacing between iconview items.
void QIconView::startDrag () [virtual protected]
Starts a drag.
void QIconView::styleChange ( QStyle & old ) [virtual protected]
Reimplemented for internal reasons; the API is not
affected.
Reimplemented from QWidget.
void QIconView::takeItem ( QIconViewItem * item ) [virtual]
Takes the iconview item item out of the iconview and
causes an update of the screen display. The item is not
deleted. You should normally not need to call this
function, as QIconViewItem::~QIconViewItem() calls it. The
normal way to delete an item is delete.
bool QIconView::wordWrapIconText () const
Returns TRUE, if an item text which needs too much space
(to the width) is displayed word wrapped, or FALSE if it
gets displayed truncated.
See also setWordWrapIconText() and setShowToolTips().
void QIconView::emitRenamed ( QIconViewItem * item ) [protected]
For internal use only.
void QIconView::updateContents () [virtual slot]
For internal use only.
SEE ALSO
http://doc.trolltech.com/qiconview.html
http://www.trolltech.com/faq/tech.html
COPYRIGHT
Copyright 1992-2001 Trolltech AS,
http://www.trolltech.com. See the license file included
in the distribution for a complete license statement.
AUTHOR
Generated automatically from the source code.
BUGS
If you find a bug in Qt, please report it as described in
http://doc.trolltech.com/bughowto.html. Good bug reports
make our job much simpler. Thank you.
manual page, please report them to qt-bugs@trolltech.com.
Please include the name of the manual page (qiconview.3qt)
and the Qt version (2.3.1).
Man(1) output converted with
man2html