Q3IconView Class Reference |
enum | Arrangement { LeftToRight, TopToBottom } |
typedef | ComparisonFlags |
enum | ItemTextPos { Bottom, Right } |
enum | ResizeMode { Fixed, Adjust } |
enum | SelectionMode { Single, Multi, Extended, NoSelection } |
enum | StringComparisonMode { CaseSensitive, ExactMatch, BeginsWith, EndsWith, Contains } |
|
|
Q3IconView ( QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0 ) | |
virtual | ~Q3IconView () |
Arrangement | arrangement () const |
bool | autoArrange () const |
virtual void | clear () |
virtual void | clearSelection () |
uint | count () const |
Q3IconViewItem * | currentItem () const |
void | ensureItemVisible ( Q3IconViewItem * item ) |
Q3IconViewItem * | findFirstVisibleItem ( const QRect & r ) const |
Q3IconViewItem * | findItem ( const QPoint & pos ) const |
Q3IconViewItem * | findItem ( const QString & text, ComparisonFlags compare = BeginsWith | Qt::CaseSensitive ) const |
Q3IconViewItem * | findLastVisibleItem ( const QRect & r ) const |
Q3IconViewItem * | firstItem () const |
int | gridX () const |
int | gridY () const |
int | index ( const Q3IconViewItem * item ) const |
virtual void | insertItem ( Q3IconViewItem * item, Q3IconViewItem * after = 0L ) |
virtual void | invertSelection () |
bool | isRenaming () const |
QBrush | itemTextBackground () const |
ItemTextPos | itemTextPos () const |
bool | itemsMovable () const |
Q3IconViewItem * | lastItem () const |
int | maxItemTextLength () const |
int | maxItemWidth () const |
virtual void | repaintItem ( Q3IconViewItem * item ) |
void | repaintSelectedItems () |
ResizeMode | resizeMode () const |
virtual void | selectAll ( bool select ) |
SelectionMode | selectionMode () const |
virtual void | setArrangement ( Arrangement am ) |
virtual void | setAutoArrange ( bool b ) |
virtual void | setCurrentItem ( Q3IconViewItem * item ) |
virtual void | setGridX ( int rx ) |
virtual void | setGridY ( int ry ) |
virtual void | setItemTextBackground ( const QBrush & b ) |
virtual void | setItemTextPos ( ItemTextPos pos ) |
virtual void | setItemsMovable ( bool b ) |
virtual void | setMaxItemTextLength ( int w ) |
virtual void | setMaxItemWidth ( int w ) |
virtual void | setResizeMode ( ResizeMode am ) |
virtual void | setSelected ( Q3IconViewItem * item, bool s, bool cb = false ) |
virtual void | setSelectionMode ( SelectionMode m ) |
virtual void | setShowToolTips ( bool b ) |
void | setSorting ( bool sort, bool ascending = true ) |
virtual void | setSpacing ( int sp ) |
virtual void | setWordWrapIconText ( bool b ) |
bool | showToolTips () const |
virtual void | sort ( bool ascending = true ) |
bool | sortDirection () const |
bool | sorting () const |
int | spacing () const |
virtual void | takeItem ( Q3IconViewItem * item ) |
bool | wordWrapIconText () const |
virtual bool | eventFilter ( QObject * o, QEvent * e ) |
virtual QVariant | inputMethodQuery ( Qt::InputMethodQuery query ) const |
virtual QSize | minimumSizeHint () const |
virtual void | showEvent ( QShowEvent * ) |
virtual QSize | sizeHint () const |
virtual void | arrangeItemsInGrid ( const QSize & grid, bool update = true ) |
virtual void | arrangeItemsInGrid ( bool update = true ) |
virtual void | setContentsPos ( int x, int y ) |
void | clicked ( Q3IconViewItem * item ) |
void | clicked ( Q3IconViewItem * item, const QPoint & pos ) |
void | contextMenuRequested ( Q3IconViewItem * item, const QPoint & pos ) |
void | currentChanged ( Q3IconViewItem * item ) |
void | doubleClicked ( Q3IconViewItem * item ) |
void | dropped ( QDropEvent * e, const Q3ValueList<Q3IconDragItem> & lst ) |
void | itemRenamed ( Q3IconViewItem * item, const QString & name ) |
void | itemRenamed ( Q3IconViewItem * item ) |
void | mouseButtonClicked ( int button, Q3IconViewItem * item, const QPoint & pos ) |
void | mouseButtonPressed ( int button, Q3IconViewItem * item, const QPoint & pos ) |
void | moved () |
void | onItem ( Q3IconViewItem * item ) |
void | onViewport () |
void | pressed ( Q3IconViewItem * item ) |
void | pressed ( Q3IconViewItem * item, const QPoint & pos ) |
void | returnPressed ( Q3IconViewItem * item ) |
void | rightButtonClicked ( Q3IconViewItem * item, const QPoint & pos ) |
void | rightButtonPressed ( Q3IconViewItem * item, const QPoint & pos ) |
void | selectionChanged () |
void | selectionChanged ( Q3IconViewItem * item ) |
virtual Q3DragObject * | dragObject () |
virtual void | drawBackground ( QPainter * p, const QRect & r ) |
virtual void | drawRubber ( QPainter * p ) |
void | emitSelectionChanged ( Q3IconViewItem * i = 0 ) |
virtual void | insertInGrid ( Q3IconViewItem * item ) |
Q3IconViewItem * | makeRowLayout ( Q3IconViewItem * begin, int & y, bool & changed ) |
virtual void | startDrag () |
virtual void | changeEvent ( QEvent * ev ) |
virtual void | contentsContextMenuEvent ( QContextMenuEvent * e ) |
virtual void | contentsDragEnterEvent ( QDragEnterEvent * e ) |
virtual void | contentsDragLeaveEvent ( QDragLeaveEvent * e ) |
virtual void | contentsDragMoveEvent ( QDragMoveEvent * e ) |
virtual void | contentsDropEvent ( QDropEvent * e ) |
virtual void | contentsMouseDoubleClickEvent ( QMouseEvent * e ) |
virtual void | contentsMouseMoveEvent ( QMouseEvent * e ) |
virtual void | contentsMousePressEvent ( QMouseEvent * e ) |
virtual void | contentsMouseReleaseEvent ( QMouseEvent * e ) |
virtual void | drawContents ( QPainter * p, int cx, int cy, int cw, int ch ) |
virtual void | enterEvent ( QEvent * e ) |
virtual void | focusInEvent ( QFocusEvent * e ) |
virtual void | focusOutEvent ( QFocusEvent * e ) |
virtual void | keyPressEvent ( QKeyEvent * e ) |
virtual void | resizeEvent ( QResizeEvent * e ) |
virtual void | adjustItems () |
virtual void | doAutoScroll () |
virtual void | slotUpdate () |
The Q3IconView class provides an area with movable labelled icons.
A Q3IconView can display and manage a grid or other 2D layout of labelled icons. Each labelled icon is a Q3IconViewItem. Items (Q3IconViewItems) can be added or deleted at any time; items can be moved within the Q3IconView. Single or multiple items can be selected. Items can be renamed in-place. Q3IconView also supports drag and drop.
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).
The simplest way to create a Q3IconView is to create a Q3IconView object and create some Q3IconViewItems with the Q3IconView as their parent, set the icon view's geometry and show it. For example:
Q3IconView *iv = new Q3IconView(this); QDir dir(path, "*.xpm"); for (uint i = 0; i < dir.count(); i++) { (void) new Q3IconViewItem(iv, dir[i], QPixmap(path + dir[i])); } iv->resize(600, 400); iv->show();
The Q3IconViewItem call passes a pointer to the Q3IconView we wish to populate, along with the label text and a QPixmap.
When an item is inserted the Q3IconView allocates a position for it. Existing items are rearranged if autoArrange() is true. The default arrangement is LeftToRight -- the Q3IconView fills up the left-most column from top to bottom, then moves one column right and fills that from top to bottom and so on. The arrangement can be modified with any of the following approaches:
The spacing between items is set with setSpacing(). Items can be laid out using a fixed grid using setGridX() and setGridY(); by default the Q3IconView 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().
Items which are selectable may be selected depending on the SelectionMode; the default is Single. Because Q3IconView 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.
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 Q3IconViewItem::setKey() the new text will also serve as the key. (See Q3IconViewItem::setRenameEnabled().)
You can control whether users can move items themselves with setItemsMovable().
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 icon view and then each subsequent (Q3IconViewItem::nextItem()) from each item in turn:
for (Q3IconViewItem *item = iv->firstItem(); item; item = item->nextItem()) do_something(item);
Q3IconView 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 delete. All the items can be deleted with clear().
The Q3IconView emits a wide range of useful signals, including selectionChanged(), currentChanged(), clicked(), moved() and itemRenamed().
Q3IconView supports the drag and drop of items within the Q3IconView itself. It also supports the drag and drop of items out of or into the Q3IconView and drag and drop onto items themselves. The drag and drop of items outside the Q3IconView can be achieved in a simple way with basic functionality, or in a more sophisticated way which provides more power and control.
The simple approach to dragging items out of the icon view is to subclass Q3IconView and reimplement Q3IconView::dragObject().
Q3DragObject *MyIconView::dragObject() { return new Q3TextDrag(currentItem()->text(), this); }
In this example we create a Q3TextDrag object, (derived from Q3DragObject), containing the item's label and return it as the drag object. We could just as easily have created a Q3ImageDrag from the item's pixmap and returned that instead.
Q3IconViews and their Q3IconViewItems can also be the targets of drag and drops. To make the Q3IconView itself able to accept drops connect to the dropped() signal. When a drop occurs this signal will be emitted with a QDragEvent and a QLinkedList of Q3IconDragItems. To make a Q3IconViewItem into a drop target subclass Q3IconViewItem and reimplement Q3IconViewItem::acceptDrop() and Q3IconViewItem::dropped().
bool MyIconViewItem::acceptDrop(const QMimeSource *mime) const { if (mime->provides("text/plain")) return true; return false; } void MyIconViewItem::dropped(QDropEvent *evt, const Q3ValueList<Q3IconDragItem>&) { QString label; if (Q3TextDrag::decode(evt, label)) setText(label); }
If you want to use extended drag-and-drop or have drag shapes drawn you must take a more sophisticated approach.
The first part is starting drags -- you should use a Q3IconDrag (or a class derived from it) for the drag object. In dragObject() create the drag object, populate it with Q3IconDragItems 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 Q3IconDragItem for each selected item, and append these items with Q3IconDrag::append() to the Q3IconDrag object. You can use Q3IconDragItem::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 Q3IconDrag, which implements additional encoding and decoding functions.
When a drag enters the icon view, there is little to do. Simply connect to the dropped() signal and reimplement Q3IconViewItem::acceptDrop() and Q3IconViewItem::dropped(). If you've used a Q3IconDrag (or a subclass of it) the second argument to the dropped signal contains a QLinkedList of Q3IconDragItems -- you can access their data by calling Q3IconDragItem::data() on each one.
For an example implementation of complex drag-and-drop look at the fileiconview example (qt/examples/fileiconview).
See also Q3IconViewItem::setDragEnabled(), Q3IconViewItem::setDropEnabled(), Q3IconViewItem::acceptDrop(), and Q3IconViewItem::dropped().
This enum type determines in which direction the items flow when the view runs out of space.
Constant | Value | Description |
---|---|---|
Q3IconView::LeftToRight | 0 | Items which don't fit into the view go further down (you get a vertical scroll bar) |
Q3IconView::TopToBottom | 1 | Items which don't fit into the view go further right (you get a horizontal scroll bar) |
This typedef is used in Q3IconView's API for values that are OR'd combinations of StringComparisonMode values.
See also StringComparisonMode.
This enum type specifies the position of the item text in relation to the icon.
Constant | Value | Description |
---|---|---|
Q3IconView::Bottom | 0 | The text is drawn below the icon. |
Q3IconView::Right | 1 | The text is drawn to the right of the icon. |
This enum type is used to tell Q3IconView how it should treat the positions of its icons when the widget is resized. The modes are:
Constant | Value | Description |
---|---|---|
Q3IconView::Fixed | 0 | The icons' positions are not changed. |
Q3IconView::Adjust | 1 | The icons' positions are adjusted to be within the new geometry, if possible. |
This enumerated type is used by Q3IconView to indicate how it reacts to selection by the user. It has four values:
Constant | Value | Description |
---|---|---|
Q3IconView::Single | 0 | 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 Q3IconView::clearSelection().) |
Q3IconView::Multi | 1 | 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. |
Q3IconView::Extended | 2 | 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. |
Q3IconView::NoSelection | 3 | Items cannot be selected. |
To summarize: 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.
This enum type is used to set the string comparison mode when searching for an item. We'll refer to the string being searched as the 'target' string.
Constant | Value | Description |
---|---|---|
Q3IconView::CaseSensitive | 0x00001 | The strings must match case sensitively. |
Q3IconView::ExactMatch | 0x00010 | The target and search strings must match exactly. |
Q3IconView::BeginsWith | 0x00002 | The target string begins with the search string. |
Q3IconView::EndsWith | 0x00004 | The target string ends with the search string. |
Q3IconView::Contains | 0x00008 | The target string contains the search string. |
If you OR these flags together (excluding CaseSensitive), the search criteria be applied in the following order: ExactMatch, BeginsWith, EndsWith, Contains.
Matching is case-insensitive unless CaseSensitive is set. CaseSensitive can be OR-ed with any combination of the other flags.
See also ComparisonFlags.
This property holds the arrangement mode of the icon view.
This can be LeftToRight or TopToBottom. The default is LeftToRight.
Access functions:
Arrangement | arrangement () const |
virtual void | setArrangement ( Arrangement am ) |
This property holds whether the icon view rearranges its items when a new item is inserted.
The default is true.
Note that if the icon view is not visible at the time of insertion, Q3IconView defers all position-related work until it is shown and then calls arrangeItemsInGrid().
Access functions:
bool | autoArrange () const |
virtual void | setAutoArrange ( bool b ) |
This property holds the number of items in the icon view.
Access functions:
uint | count () const |
This property holds the horizontal grid of the icon view.
If the value is -1, (the default), Q3IconView computes suitable column widths based on the icon view's contents.
Note that setting a grid width overrides setMaxItemWidth().
Access functions:
int | gridX () const |
virtual void | setGridX ( int rx ) |
This property holds the vertical grid of the icon view.
If the value is -1, (the default), Q3IconView computes suitable column heights based on the icon view's contents.
Access functions:
int | gridY () const |
virtual void | setGridY ( int ry ) |
This property holds the brush to use when drawing the background of an item's text.
By default this brush is set to Qt::NoBrush, meaning that only the normal icon view background is used.
Access functions:
QBrush | itemTextBackground () const |
virtual void | setItemTextBackground ( const QBrush & b ) |
This property holds the position where the text of each item is drawn.
Valid values are Bottom or Right. The default is Bottom.
Access functions:
ItemTextPos | itemTextPos () const |
virtual void | setItemTextPos ( ItemTextPos pos ) |
This property holds whether the user is allowed to move items around in the icon view.
The default is true.
Access functions:
bool | itemsMovable () const |
virtual void | setItemsMovable ( bool b ) |
This property holds the maximum length (in characters) that an item's text may have.
The default is 255 characters.
Access functions:
int | maxItemTextLength () const |
virtual void | setMaxItemTextLength ( int w ) |
This property holds the maximum width that an item may have.
The default is 100 pixels.
Note that if the gridX() value is set Q3IconView will ignore this property.
Access functions:
int | maxItemWidth () const |
virtual void | setMaxItemWidth ( int w ) |
This property holds the resize mode of the icon view.
This can be Fixed or Adjust. The default is Fixed. See ResizeMode.
Access functions:
ResizeMode | resizeMode () const |
virtual void | setResizeMode ( ResizeMode am ) |
This property holds the selection mode of the icon view.
This can be Single (the default), Extended, Multi or NoSelection.
Access functions:
SelectionMode | selectionMode () const |
virtual void | setSelectionMode ( SelectionMode m ) |
This property holds whether the icon view will display a tool tip with the complete text for any truncated item text.
The default is true. Note that this has no effect if setWordWrapIconText() is true, as it is by default.
Access functions:
bool | showToolTips () const |
virtual void | setShowToolTips ( bool b ) |
This property holds whether the sort direction for inserting new items is ascending;.
The default is true (i.e. ascending). This sort direction is only meaningful if both sorting() and autoArrange() are true.
To set the sort direction, use setSorting()
Access functions:
bool | sortDirection () const |
This property holds whether the icon view sorts on insertion.
The default is false, i.e. no sorting on insertion.
To set the sorting, use setSorting().
Access functions:
bool | sorting () const |
This property holds the space in pixels between icon view items.
The default is 5 pixels.
Negative values for spacing are illegal.
Access functions:
int | spacing () const |
virtual void | setSpacing ( int sp ) |
This property holds whether the item text will be word-wrapped if it is too long.
The default is true.
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().
Access functions:
bool | wordWrapIconText () const |
virtual void | setWordWrapIconText ( bool b ) |
Constructs an empty icon view called name, with parent parent and using the widget flags f.
Destroys the icon view and deletes all items.
Adjusts the positions of the items to the geometry of the icon view.
This variant uses grid instead of (gridX(), gridY()). If grid is invalid (see QSize::isValid()), arrangeItemsInGrid() calculates a valid grid itself and uses that.
If update is true (the default) the viewport is repainted.
This is an overloaded function.
Arranges all the items in the grid specified by gridX() and gridY().
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()).
If update is true (the default), the viewport is repainted as well.
See also Q3IconView::setGridX(), Q3IconView::setGridY(), and Q3IconView::sort().
Reimplemented from QWidget::changeEvent().
Clears the icon view. All items are deleted.
Unselects all the items.
This signal is emitted when the user clicks any mouse button. If item is non-null, the cursor is on item. If item is null, the mouse cursor isn't on any item.
See also mouseButtonClicked(), rightButtonClicked(), and pressed().
This is an overloaded function.
This signal is emitted when the user clicks any mouse button on an icon view item. item is a pointer to the item that has been clicked.
pos 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, pos is the position at release time.)
See also mouseButtonClicked(), rightButtonClicked(), and pressed().
Reimplemented from Q3ScrollView::contentsContextMenuEvent().
Reimplemented from Q3ScrollView::contentsDragEnterEvent().
Reimplemented from Q3ScrollView::contentsDragLeaveEvent().
Reimplemented from Q3ScrollView::contentsDragMoveEvent().
Reimplemented from Q3ScrollView::contentsDropEvent().
Reimplemented from Q3ScrollView::contentsMouseDoubleClickEvent().
Reimplemented from Q3ScrollView::contentsMouseMoveEvent().
Reimplemented from Q3ScrollView::contentsMousePressEvent().
Reimplemented from Q3ScrollView::contentsMouseReleaseEvent().
This signal is emitted when the user invokes a context menu with the right mouse button or with special system keys, with item being the item under the mouse cursor or the current item, respectively.
pos is the position for the context menu in the global coordinate system.
This signal is emitted when a new item becomes current. item is the new current item (or 0 if no item is now current).
See also currentItem().
Returns a pointer to the current item of the icon view, or 0 if no item is current.
See also setCurrentItem(), firstItem(), and lastItem().
Performs autoscrolling when selecting multiple icons with the rubber band.
This signal is emitted when the user double-clicks on item.
Returns the Q3DragObject 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.
See also Q3IconDrag.
This function is called to draw the rectangle r of the background using the painter p.
The default implementation fills r with the viewport's backgroundBrush(). Subclasses can reimplement this to draw custom backgrounds.
See also drawContents().
Reimplemented from Q3ScrollView::drawContents().
Draws the rubber band using the painter p.
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.
e provides all the information about the drop. If the drag object of the drop was a Q3IconDrag, lst contains the list of the dropped items. You can get the data using Q3IconDragItem::data() on each item. If the lst is empty, i.e. the drag was not a Q3IconDrag, you have to decode the data in e and work with that.
Note Q3IconViewItems may be drop targets; if a drop event occurs on an item the item handles the drop.
Emits a signal to indicate selection changes. i is the Q3IconViewItem that was selected or de-selected.
You should never need to call this function.
Makes sure that item is entirely visible. If necessary, ensureItemVisible() scrolls the icon view.
See also ensureVisible().
Reimplemented from QWidget::enterEvent().
Reimplemented from QObject::eventFilter().
Finds the first item whose bounding rectangle overlaps r and returns a pointer to that item. r is given in content coordinates. Returns 0 if no item overlaps r.
If you want to find all items that touch r, you will need to use this function and nextItem() in a loop ending at findLastVisibleItem() and test Q3IconViewItem::rect() for each of these items.
See also findLastVisibleItem() and Q3IconViewItem::rect().
Returns a pointer to the item that contains point pos, which is given in contents coordinates, or 0 if no item contains point pos.
This is an overloaded function.
Returns a pointer to the first item whose text begins with text, or 0 if no such item could be found. Use the compare flag to control the comparison behavior.
Finds the last item whose bounding rectangle overlaps r and returns a pointer to that item. r is given in content coordinates. Returns 0 if no item overlaps r.
See also findFirstVisibleItem().
Returns a pointer to the first item of the icon view, or 0 if there are no items in the icon view.
See also lastItem() and currentItem().
Reimplemented from QWidget::focusInEvent().
Reimplemented from QWidget::focusOutEvent().
Returns the index of item, or -1 if item doesn't exist in this icon view.
Reimplemented from QWidget::inputMethodQuery().
Inserts the Q3IconViewItem item in the icon view's grid. You should never need to call this function. Instead, insert Q3IconViewItems by creating them with a pointer to the Q3IconView that they are to be inserted into.
Inserts the icon view item item after after. If after is 0, item is appended after the last item.
You should never need to call this function. Instead create Q3IconViewItem's and associate them with your icon view like this:
(void) new Q3IconViewItem(myIconview, "The text of the item", aPixmap);
Inverts the selection. Works only in Multi and Extended selection mode.
Returns true if an iconview item is being renamed; otherwise returns false.
This signal is emitted when item has been renamed to name, usually by in-place renaming.
See also Q3IconViewItem::setRenameEnabled() and Q3IconViewItem::rename().
This is an overloaded function.
This signal is emitted when item has been renamed, usually by in-place renaming.
See also Q3IconViewItem::setRenameEnabled() and Q3IconViewItem::rename().
Reimplemented from QWidget::keyPressEvent().
Returns a pointer to the last item of the icon view, or 0 if there are no items in the icon view.
See also firstItem() and currentItem().
Lays out a row of icons (if 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 (column) and sets the new starting coordinate to y. The changed parameter is used internally.
Warning: This function may be made private in a future version of Qt. We do not recommend calling it.
Reimplemented from QWidget::minimumSizeHint().
This signal is emitted when the user clicks mouse button button. If item is non-null, the cursor is on item. If item is null, the mouse cursor isn't on any item.
pos 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, pos is the position at release time.)
See also mouseButtonPressed(), rightButtonClicked(), and clicked().
This signal is emitted when the user presses mouse button button. If item is non-null, the cursor is on item. If item is null, the mouse cursor isn't on any item.
pos is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
See also rightButtonClicked(), mouseButtonClicked(), and pressed().
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.
This signal is emitted when the user moves the mouse cursor onto an item, similar to the QWidget::enterEvent() function.
This signal is emitted when the user moves the mouse cursor from an item to an empty part of the icon view.
See also onItem().
This signal is emitted when the user presses any mouse button. If item is non-null, the cursor is on item. If item is null, the mouse cursor isn't on any item.
See also mouseButtonPressed(), rightButtonPressed(), and clicked().
This is an overloaded function.
This signal is emitted when the user presses any mouse button. If item is non-null, the cursor is on item. If item is null, the mouse cursor isn't on any item.
pos 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, pos is the position at release time.)
See also mouseButtonPressed(), rightButtonPressed(), and clicked().
Repaints the item.
Repaints the selected items.
Reimplemented from QWidget::resizeEvent().
This signal is emitted if the user presses the Return or Enter key. item is the currentItem() at the time of the keypress.
This signal is emitted when the user clicks the right mouse button. If item is non-null, the cursor is on item. If item is null, the mouse cursor isn't on any item.
pos 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, pos is the position at release time.)
See also rightButtonPressed(), mouseButtonClicked(), and clicked().
This signal is emitted when the user presses the right mouse button. If item is non-null, the cursor is on item. If item is null, the mouse cursor isn't on any item.
pos is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
In Multi and Extended modes, this function sets all items to be selected if select is true, and to be unselected if select is false.
In Single and NoSelection modes, this function only changes the selection status of currentItem().
This signal is emitted when the selection has been changed. It's emitted in each selection mode.
This is an overloaded function.
This signal is emitted when the selection changes. item is the newly selected item. This signal is emitted only in single selection mode.
Reimplemented from Q3ScrollView::setContentsPos().
Makes item the new current item of the icon view.
See also currentItem().
Selects or unselects item depending on s, and may also unselect other items, depending on Q3IconView::selectionMode() and cb.
If s is false, item is unselected.
If s is true and Q3IconView::selectionMode() is Single, item is selected, and the item which was selected is unselected.
If s is true and Q3IconView::selectionMode() is Extended, item is selected. If cb is true, the selection state of the icon view's other items is left unchanged. If cb is false (the default) all other items are unselected.
If s is true and Q3IconView::selectionMode() is Multi item is selected.
Note that cb is used only if Q3IconView::selectionMode() is Extended. cb defaults to false.
All items whose selection status is changed repaint themselves.
If sort is true, this function sets the icon view to sort items when a new item is inserted. If sort is false, the icon view will not be sorted.
Note that autoArrange() must be true for sorting to take place.
If ascending is true (the default), items are sorted in ascending order. If ascending is false, items are sorted in descending order.
Q3IconViewItem::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.
See also sorting(), Q3IconView::setAutoArrange(), Q3IconView::autoArrange(), sortDirection(), sort(), and Q3IconViewItem::setKey().
Reimplemented from QWidget::showEvent().
Reimplemented from QWidget::sizeHint().
This slot is used for a slightly-delayed update.
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.
Sorts and rearranges all the items in the icon view. If ascending is true, the items are sorted in increasing order, otherwise they are sorted in decreasing order.
Q3IconViewItem::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.
Note that this function sets the sort order to ascending.
See also Q3IconViewItem::key(), Q3IconViewItem::setKey(), Q3IconViewItem::compare(), Q3IconView::setSorting(), and Q3IconView::sortDirection().
Starts a drag.
Takes the icon view item item 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 Q3IconViewItem::~Q3IconViewItem() calls it. The normal way to delete an item is to delete it.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.6-snapshot | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com