qdesigner_internal::ActionRepository Class Reference

#include <actionrepository_p.h>

Inheritance diagram for qdesigner_internal::ActionRepository:

Inheritance graph
[legend]
Collaboration diagram for qdesigner_internal::ActionRepository:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 44 of file actionrepository_p.h.

Public Types

enum  

Public Slots

void filter (const QString &text)

Signals

void contextMenuRequested (QContextMenuEvent *event, QListWidgetItem *item)

Public Member Functions

 ActionRepository (QWidget *parent=0)
virtual ~ActionRepository ()

Protected Member Functions

virtual void startDrag (Qt::DropActions supportedActions)
virtual QMimeDatamimeData (const QList< QListWidgetItem * > items) const
virtual void focusInEvent (QFocusEvent *event)
virtual void contextMenuEvent (QContextMenuEvent *event)


Member Enumeration Documentation

anonymous enum

Definition at line 48 of file actionrepository_p.h.

00049     {
00050         ActionRole = Qt::UserRole + 1000
00051     };


Constructor & Destructor Documentation

qdesigner_internal::ActionRepository::ActionRepository ( QWidget parent = 0  ) 

Definition at line 34 of file actionrepository.cpp.

References QListView::Adjust, Qt::ElideRight, QListView::IconMode, QAbstractItemView::iconSize(), QWidget::setAcceptDrops(), QAbstractItemView::setDragEnabled(), QAbstractItemView::setIconSize(), QListView::setMovement(), QListView::setResizeMode(), QListView::setSpacing(), QAbstractItemView::setTextElideMode(), QListView::setViewMode(), QListView::Static, and QWidget::width().

00035     : QListWidget(parent)
00036 {
00037     setViewMode(IconMode);
00038     setMovement(Static);
00039     setResizeMode(Adjust);
00040     setIconSize(QSize(24, 24));
00041     setSpacing(iconSize().width() / 3);
00042     setTextElideMode(Qt::ElideRight);
00043 
00044     setDragEnabled(true);
00045     setAcceptDrops(false);
00046 }

Here is the call graph for this function:

qdesigner_internal::ActionRepository::~ActionRepository (  )  [virtual]

Definition at line 48 of file actionrepository.cpp.

00049 {
00050 }


Member Function Documentation

void qdesigner_internal::ActionRepository::contextMenuRequested ( QContextMenuEvent event,
QListWidgetItem item 
) [signal]

Referenced by contextMenuEvent().

void qdesigner_internal::ActionRepository::filter ( const QString text  )  [slot]

Definition at line 78 of file actionrepository.cpp.

References QSet< T >::contains(), QListWidget::count(), QListWidget::findItems(), QSet< T >::fromList(), i, index, QListWidget::item(), Qt::MatchContains, and QListWidget::setItemHidden().

Referenced by qdesigner_internal::ActionEditor::setFilter().

00079 {
00080     QSet<QListWidgetItem*> visibleItems = QSet<QListWidgetItem*>::fromList(findItems(text, Qt::MatchContains));
00081     for (int index=0; index<count(); ++index) {
00082         QListWidgetItem *i = item(index);
00083         setItemHidden(i, !visibleItems.contains(i));
00084     }
00085 }

void qdesigner_internal::ActionRepository::startDrag ( Qt::DropActions  supportedActions  )  [protected, virtual]

Reimplemented from QListView.

Definition at line 52 of file actionrepository.cpp.

References QList< T >::count(), QAbstractItemModel::data(), Qt::DecorationRole, QList< T >::front(), mimeData(), QAbstractItemView::model(), QIcon::pixmap(), QItemSelectionModel::selectedIndexes(), and QAbstractItemView::selectionModel().

00053 {
00054     if (!selectionModel())
00055         return;
00056 
00057     QModelIndexList indexes = selectionModel()->selectedIndexes();
00058 
00059     if (indexes.count() > 0) {
00060         QDrag *drag = new QDrag(this);
00061         QIcon icon = qvariant_cast<QIcon>(model()->data(indexes.front(), Qt::DecorationRole));
00062         drag->setPixmap(icon.pixmap(QSize(22, 22)));
00063         drag->setMimeData(model()->mimeData(indexes));
00064         drag->start(supportedActions);
00065     }
00066 }

Here is the call graph for this function:

QMimeData * qdesigner_internal::ActionRepository::mimeData ( const QList< QListWidgetItem * >  items  )  const [protected, virtual]

Returns an object that contains a serialized description of the specified items. The format used to describe the items is obtained from the mimeTypes() function.

If the list of items is empty, 0 is returned rather than a serialized empty list.

Reimplemented from QListWidget.

Definition at line 68 of file actionrepository.cpp.

References ActionRole, data, QListWidgetItem::data(), QListWidget::item(), and QListWidget::items().

Referenced by startDrag().

00069 {
00070     ActionRepositoryMimeData *data = new ActionRepositoryMimeData();
00071     foreach (QListWidgetItem *item, items) {
00072         QAction *action = qvariant_cast<QAction*>(item->data(ActionRole));
00073         data->items.append(action);
00074     }
00075     return data;
00076 }

Here is the call graph for this function:

void qdesigner_internal::ActionRepository::focusInEvent ( QFocusEvent event  )  [protected, virtual]

This function is called with the given event when the widget obtains the focus. By default, the event is ignored.

See also:
setFocus(), focusOutEvent()

Reimplemented from QAbstractItemView.

Definition at line 87 of file actionrepository.cpp.

References QListWidget::currentItem(), QListWidget::currentItemChanged(), emit, QListWidget::event(), and QAbstractItemView::focusInEvent().

00088 {
00089     QListWidget::focusInEvent(event);
00090     if (currentItem()) {
00091         emit currentItemChanged(currentItem(), currentItem());
00092     }
00093 }

Here is the call graph for this function:

void qdesigner_internal::ActionRepository::contextMenuEvent ( QContextMenuEvent event  )  [protected, virtual]

This event handler can be reimplemented in a subclass to receive context menu events for the viewport() widget. The event is passed in e.

See also:
QWidget::contextMenuEvent()

Reimplemented from QAbstractScrollArea.

Definition at line 95 of file actionrepository.cpp.

References contextMenuRequested(), emit, QListWidget::event(), and QListWidget::itemAt().

00096 {
00097     emit contextMenuRequested(event, itemAt(event->pos()));
00098 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 20:41:23 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1