summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarek Wieckowski <wiecko@users.sourceforge.net>2010-06-09 07:11:30 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-06-09 07:11:30 (GMT)
commit7fb445a5cbfb24a7846270ef8da63362c6b6f84d (patch)
tree95bb6bcd59f09fd16ae422ad9cadd5f8831ca84d /tools
parente271abb694c232f746b43544334667f4b3ccc1d0 (diff)
downloadQt-7fb445a5cbfb24a7846270ef8da63362c6b6f84d.zip
Qt-7fb445a5cbfb24a7846270ef8da63362c6b6f84d.tar.gz
Qt-7fb445a5cbfb24a7846270ef8da63362c6b6f84d.tar.bz2
designer: add sorting in signal-slot editor window
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp10
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index a25bd5d..5547761 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -63,6 +63,7 @@
#include <QtGui/QAction>
#include <QtGui/QButtonGroup>
#include <QtGui/QMenu>
+#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStandardItemModel>
#include <QtGui/QComboBox>
#include <QtGui/QApplication>
@@ -712,9 +713,12 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor
m_remove_button(new QToolButton),
m_core(core),
m_model(new ConnectionModel(this)),
+ m_proxy_model(new QSortFilterProxyModel(this)),
m_handling_selection_change(false)
{
- m_view->setModel(m_model);
+ m_proxy_model->setSourceModel(m_model);
+ m_view->setModel(m_proxy_model);
+ m_view->setSortingEnabled(true);
m_view->setItemDelegate(new ConnectionDelegate(this));
m_view->setEditTriggers(QAbstractItemView::DoubleClicked
| QAbstractItemView::EditKeyPressed);
@@ -790,7 +794,7 @@ void SignalSlotEditorWindow::updateDialogSelection(Connection *con)
if (m_handling_selection_change || m_editor == 0)
return;
- QModelIndex index = m_model->connectionToIndex(con);
+ QModelIndex index = m_proxy_model->mapFromSource(m_model->connectionToIndex(con));
if (index == m_view->currentIndex())
return;
m_handling_selection_change = true;
@@ -808,7 +812,7 @@ void SignalSlotEditorWindow::updateEditorSelection(const QModelIndex &index)
if (m_editor == 0)
return;
- Connection *con = m_model->indexToConnection(index);
+ Connection *con = m_model->indexToConnection(m_proxy_model->mapToSource(index));
if (m_editor->selected(con))
return;
m_handling_selection_change = true;
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h
index 9315955..665f0b7 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
class QDesignerFormWindowInterface;
class QDesignerFormEditorInterface;
class QModelIndex;
+class QSortFilterProxyModel;
class QTreeView;
class QToolButton;
@@ -84,6 +85,7 @@ private:
QToolButton *m_add_button, *m_remove_button;
QDesignerFormEditorInterface *m_core;
ConnectionModel *m_model;
+ QSortFilterProxyModel *m_proxy_model;
bool m_handling_selection_change;
};