diff options
| author | Peter Penz <[email protected]> | 2007-02-05 23:18:22 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-02-05 23:18:22 +0000 |
| commit | 9eb1cac4b7661ff154c782c9d2933e5a060b2542 (patch) | |
| tree | 5d3e072ac06d1d7799e848636c4ee3d481c6d477 /src | |
| parent | fe1cb386e4234fcc22efcbbce1c792de24273875 (diff) | |
update the header indicators corresponding to the current sort column and sort order
svn path=/trunk/playground/utils/dolphin/; revision=630675
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphindetailsview.cpp | 27 | ||||
| -rw-r--r-- | src/dolphindetailsview.h | 16 |
2 files changed, 40 insertions, 3 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index e04ff7618..fc40d9585 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -19,19 +19,32 @@ ***************************************************************************/ #include "dolphindetailsview.h" + +#include <assert.h> #include "dolphinmainwindow.h" #include "dolphinview.h" - +#include "viewproperties.h" #include <QHeaderView> DolphinDetailsView::DolphinDetailsView(DolphinView* parent) : QTreeView(parent), m_parentView(parent) { + assert(parent != 0); + setAcceptDrops(true); setRootIsDecorated(false); setSortingEnabled(true); setUniformRowHeights(true); + + const ViewProperties props(parent->url()); + setSortIndicatorSection(props.sorting()); + setSortIndicatorOrder(props.sortOrder()); + + connect(parent, SIGNAL(sortingChanged(DolphinView::Sorting)), + this, SLOT(setSortIndicatorSection(DolphinView::Sorting))); + connect(parent, SIGNAL(sortOrderChanged(Qt::SortOrder)), + this, SLOT(setSortIndicatorOrder(Qt::SortOrder))); } DolphinDetailsView::~DolphinDetailsView() @@ -107,4 +120,16 @@ void DolphinDetailsView::dropEvent(QDropEvent* event) } } +void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting) +{ + QHeaderView* headerView = header(); + headerView->setSortIndicator(sorting, headerView->sortIndicatorOrder()); +} + +void DolphinDetailsView::setSortIndicatorOrder(Qt::SortOrder sortOrder) +{ + QHeaderView* headerView = header(); + headerView->setSortIndicator(headerView->sortIndicatorSection(), sortOrder); +} + #include "dolphindetailsview.moc" diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h index b438b3a33..e035d3c12 100644 --- a/src/dolphindetailsview.h +++ b/src/dolphindetailsview.h @@ -21,10 +21,9 @@ #ifndef DOLPHINDETAILSVIEW_H #define DOLPHINDETAILSVIEW_H +#include <dolphinview.h> #include <QTreeView> -class DolphinView; - /** * @brief Represents the details view which shows the name, size, * date, permissions, owner and group of an item. @@ -49,6 +48,19 @@ protected: virtual void dragEnterEvent(QDragEnterEvent* event); virtual void dropEvent(QDropEvent* event); +private slots: + /** + * Sets the sort indicator section of the header view + * corresponding to \a sorting. + */ + void setSortIndicatorSection(DolphinView::Sorting sorting); + + /** + * Sets the sort indicator order of the header view + * corresponding to \a sortOrder. + */ + void setSortIndicatorOrder(Qt::SortOrder sortOrder); + private: DolphinView* m_parentView; }; |
