1 /****************************************************************************
3 ** Copyright (C) Qxt Foundation. Some rights reserved.
5 ** This file is part of the QxtGui module of the Qt eXTension library
7 ** This library is free software; you can redistribute it and/or modify it
8 ** under the terms of th Common Public License, version 1.0, as published by
11 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
12 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
13 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
14 ** FITNESS FOR A PARTICULAR PURPOSE.
16 ** You should have received a copy of the CPL along with this file.
17 ** See the LICENSE file and the cpl1.0.txt file included with the source
18 ** distribution for more information. If you did not receive a copy of the
19 ** license, contact the Qxt Foundation.
21 ** <http://libqxt.sourceforge.net> <foundation@libqxt.org>
23 ****************************************************************************/
24 #include "qxtlistwidget.h"
25 #include "qxtitemdelegate.h"
26 #include "qxtlistwidget_p.h"
28 QxtListWidgetPrivate::QxtListWidgetPrivate()
31 void QxtListWidgetPrivate::informStartEditing(const QModelIndex& index)
33 QListWidgetItem* item = qxt_p().itemFromIndex(index);
35 emit qxt_p().itemEditingStarted(item);
38 void QxtListWidgetPrivate::informFinishEditing(const QModelIndex& index)
40 QListWidgetItem* item = qxt_p().itemFromIndex(index);
42 emit qxt_p().itemEditingFinished(item);
46 \class QxtListWidget QxtListWidget
48 \brief An extended QListWidget with additional signals.
50 QxtListWidget offers a few most commonly requested signals.
52 \image html qxtlistwidget.png "QxtListWidget in Plastique style."
56 \fn QxtListWidget::itemEditingStarted(QListWidgetItem* item)
58 This signal is emitted after the editing of \a item has been started.
60 \sa itemEditingFinished()
64 \fn QxtListWidget::itemEditingFinished(QListWidgetItem* item)
66 This signal is emitted after the editing of \a item has been finished.
68 \sa itemEditingStarted()
72 \fn QxtListWidget::itemCheckStateChanged(QxtListWidgetItem* item)
74 This signal is emitted whenever the check state of \a item has changed.
76 \note Use QxtListWidgetItem in order to enable this feature.
78 \sa QxtListWidgetItem, QListWidgetItem::checkState()
82 Constructs a new QxtListWidget with \a parent.
84 QxtListWidget::QxtListWidget(QWidget* parent) : QListWidget(parent)
86 QXT_INIT_PRIVATE(QxtListWidget);
87 QxtItemDelegate* delegate = new QxtItemDelegate(this);
88 connect(delegate, SIGNAL(editingStarted(const QModelIndex&)),
89 &qxt_d(), SLOT(informStartEditing(const QModelIndex&)));
90 connect(delegate, SIGNAL(editingFinished(const QModelIndex&)),
91 &qxt_d(), SLOT(informFinishEditing(const QModelIndex&)));
92 setItemDelegate(delegate);
96 Destructs the list widget.
98 QxtListWidget::~QxtListWidget()