diff options
author | Ken Moore <ken@ixsystems.com> | 2018-03-22 14:03:13 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-03-22 14:06:39 -0400 |
commit | b0e4e608da9563cf0e01490cc3e8a0b8c05b5137 (patch) | |
tree | 26763511b60a468f4c98294817cb2cb59e2e4d4b /src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp | |
parent | Added a splitter for the bookmarks menu to be able to change size (diff) | |
download | lumina-b0e4e608da9563cf0e01490cc3e8a0b8c05b5137.tar.gz lumina-b0e4e608da9563cf0e01490cc3e8a0b8c05b5137.tar.bz2 lumina-b0e4e608da9563cf0e01490cc3e8a0b8c05b5137.zip |
Add a signal/slot path for detecting/setting the sort column for tree widgets.
Current problems:
1. Still need to detect when the sort column has changed in the DDTreeWidget subclass to emit the first signal.
2. Need to listed for the signal from the BrowserWidget in the MainUI and save that column into the settings.
3. As needed, the MainUI needs to run "setTreeWidgetSortColumn(int,bool)" on a new BrowserWidget based on the last-saved sorting column.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp index fcbcdbed..51d633e4 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp @@ -33,6 +33,7 @@ BrowserWidget::BrowserWidget(QString objID, QWidget *parent) : QWidget(parent){ connect(this, SIGNAL(dirChange(QString, bool)), BROWSER, SLOT(loadDirectory(QString, bool)) ); listWidget = 0; treeWidget = 0; + treeSortColumn = 0; readDateFormat(); freshload = true; //nothing loaded yet numItems = 0; @@ -98,8 +99,10 @@ void BrowserWidget::showDetails(bool show){ connect(treeWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SIGNAL(contextMenuRequested()) ); connect(treeWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(DataDropped(QString, QStringList)) ); connect(treeWidget, SIGNAL(GotFocus()), this, SLOT(selectionChanged()) ); + connect(treeWidget, SIGNAL(sortColumnChanged(int)), this, SIGNAL(treeWidgetSortColumn(int)) ); + connect(treeWidget, SIGNAL(sortColumnChanged(int)), this, SIGNAL(setTreeWidgetSortColumn(int)) ); retranslate(); - treeWidget->sortItems(0, Qt::AscendingOrder); + treeWidget->sortItems(treeSortColumn, Qt::AscendingOrder); treeWidget->setColumnWidth(0, treeWidget->fontMetrics().width("W")*20); if(!BROWSER->currentDirectory().isEmpty()){ emit dirChange("", true); } }else if(!show && listWidget==0){ @@ -191,6 +194,13 @@ void BrowserWidget::setShowActive(bool show){ this->setStyleSheet(base); } +void BrowserWidget::setTreeWidgetSortColumn(int col, bool now){ + treeSortColumn = col; + if(now && treeWidget!=0){ + treeWidget->sortItems(treeSortColumn, Qt::AscendingOrder); + } +} + // This function is only called if user changes sessionsettings. By doing so, operations like sorting by date // are faster because the date format is already stored in DirWidget::date_format static variable void BrowserWidget::readDateFormat() { |