[Kde-bindings] KDE/kdelibs/kdeui/itemviews
Stephen Kelly
steveire at gmail.com
Mon May 17 12:51:11 UTC 2010
SVN commit 1127727 by skelly:
Move some methods to the private class
CCMAIL: kde-bindings at kde.org
M +25 -16 kbreadcrumbselectionmodel.cpp
M +3 -14 kbreadcrumbselectionmodel.h
--- trunk/KDE/kdelibs/kdeui/itemviews/kbreadcrumbselectionmodel.cpp #1127726:1127727
@@ -41,6 +41,16 @@
}
+ /**
+ Returns a selection containing the breadcrumbs for @p index
+ */
+ QItemSelection getBreadcrumbSelection(const QModelIndex &index);
+
+ /**
+ Returns a selection containing the breadcrumbs for @p selection
+ */
+ QItemSelection getBreadcrumbSelection(const QItemSelection &selection);
+
void sourceSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
bool m_includeActualSelection;
@@ -95,30 +105,28 @@
d->m_selectionDepth = breadcrumbLength;
}
-QItemSelection KBreadcrumbSelectionModel::getBreadcrumbSelection(const QModelIndex& index)
+QItemSelection KBreadcrumbSelectionModelPrivate::getBreadcrumbSelection(const QModelIndex& index)
{
- Q_D(KBreadcrumbSelectionModel);
QItemSelection breadcrumbSelection;
- if (d->m_includeActualSelection)
+ if (m_includeActualSelection)
breadcrumbSelection.append(QItemSelectionRange(index));
QModelIndex parent = index.parent();
int sumBreadcrumbs = 0;
- bool includeAll = d->m_selectionDepth < 0;
- while (parent.isValid() && (includeAll || sumBreadcrumbs < d->m_selectionDepth)) {
+ bool includeAll = m_selectionDepth < 0;
+ while (parent.isValid() && (includeAll || sumBreadcrumbs < m_selectionDepth)) {
breadcrumbSelection.append(QItemSelectionRange(parent));
parent = parent.parent();
}
return breadcrumbSelection;
}
-QItemSelection KBreadcrumbSelectionModel::getBreadcrumbSelection(const QItemSelection& selection)
+QItemSelection KBreadcrumbSelectionModelPrivate::getBreadcrumbSelection(const QItemSelection& selection)
{
- Q_D(KBreadcrumbSelectionModel);
QItemSelection breadcrumbSelection;
- if (d->m_includeActualSelection)
+ if (m_includeActualSelection)
breadcrumbSelection = selection;
QItemSelection::const_iterator it = selection.constBegin();
@@ -128,8 +136,8 @@
{
QModelIndex parent = it->parent();
int sumBreadcrumbs = 0;
- bool includeAll = d->m_selectionDepth < 0;
- while (parent.isValid() && (includeAll || sumBreadcrumbs < d->m_selectionDepth))
+ bool includeAll = m_selectionDepth < 0;
+ while (parent.isValid() && (includeAll || sumBreadcrumbs < m_selectionDepth))
{
breadcrumbSelection.append(QItemSelectionRange(parent));
parent = parent.parent();
@@ -139,8 +147,9 @@
return breadcrumbSelection;
}
-void KBreadcrumbSelectionModel::sourceSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
+void KBreadcrumbSelectionModelPrivate::sourceSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
{
+ Q_Q(KBreadcrumbSelectionModel);
QItemSelection deselectedCrumbs = getBreadcrumbSelection(deselected);
QItemSelection selectedCrumbs = getBreadcrumbSelection(selected);
@@ -158,11 +167,11 @@
if (!removed.isEmpty())
{
- QItemSelectionModel::select(removed, QItemSelectionModel::Deselect);
+ q->QItemSelectionModel::select(removed, QItemSelectionModel::Deselect);
}
if (!added.isEmpty())
{
- QItemSelectionModel::select(added, QItemSelectionModel::Select);
+ q->QItemSelectionModel::select(added, QItemSelectionModel::Select);
}
}
@@ -178,18 +187,18 @@
}
if ( d->m_direction == Forward )
{
- d->m_selectionModel->select(getBreadcrumbSelection(index), command);
+ d->m_selectionModel->select(d->getBreadcrumbSelection(index), command);
QItemSelectionModel::select(index, command);
} else {
d->m_selectionModel->select(index, command);
- QItemSelectionModel::select(getBreadcrumbSelection(index), command);
+ QItemSelectionModel::select(d->getBreadcrumbSelection(index), command);
}
}
void KBreadcrumbSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
{
Q_D(KBreadcrumbSelectionModel);
- QItemSelection bcc = getBreadcrumbSelection(selection);
+ QItemSelection bcc = d->getBreadcrumbSelection(selection);
if ( d->m_direction == Forward )
{
d->m_selectionModel->select(selection, command);
--- trunk/KDE/kdelibs/kdeui/itemviews/kbreadcrumbselectionmodel.h #1127726:1127727
@@ -150,23 +150,12 @@
/* reimp */ void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command);
protected:
- /**
- Returns a selection containing the breadcrumbs for @p index
- */
- QItemSelection getBreadcrumbSelection(const QModelIndex &index);
-
- /**
- Returns a selection containing the breadcrumbs for @p selection
- */
- QItemSelection getBreadcrumbSelection(const QItemSelection &selection);
-
-private slots:
- void sourceSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
-
-protected:
KBreadcrumbSelectionModelPrivate * const d_ptr;
private:
+ //@cond PRIVATE
Q_DECLARE_PRIVATE(KBreadcrumbSelectionModel)
+ Q_PRIVATE_SLOT( d_func(),void sourceSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected))
+ //@cond PRIVATE
};
More information about the Kde-bindings
mailing list