mirror of https://github.com/fooyin/fooyin
[gui,utils,filters] Fix multiple columns (#761)
This commit is contained in:
parent
5383d47671
commit
28240aab2b
|
|
@ -72,10 +72,14 @@ Cntr filter(const Cntr& container, Pred pred)
|
|||
template <typename Cntr>
|
||||
Cntr sortByIndexes(const Cntr& target, const std::vector<int>& indexes)
|
||||
{
|
||||
Cntr sorted(indexes.size());
|
||||
Cntr sorted;
|
||||
sorted.reserve(indexes.size());
|
||||
|
||||
for(size_t i{0}; i < indexes.size(); ++i) {
|
||||
sorted[i] = target[indexes.at(i)];
|
||||
const auto targetSize = static_cast<int>(target.size());
|
||||
for(const int index : indexes) {
|
||||
if(index >= 0 && index < targetSize) {
|
||||
sorted.push_back(target[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return sorted;
|
||||
|
|
|
|||
|
|
@ -630,12 +630,17 @@ void AutoHeaderView::restoreHeaderState(const QByteArray& state)
|
|||
|
||||
qCDebug(AUTO_HEADER) << "Restoring state for" << sectionCount << "section(s)";
|
||||
|
||||
for(int section{0}; section < sectionCount; ++section) {
|
||||
setSectionHidden(section, pixelWidths[section] < MinSectionWidth);
|
||||
moveSection(visualIndex(logicalIndexes[section]), section);
|
||||
for(int targetVisual{0}; targetVisual < sectionCount; ++targetVisual) {
|
||||
setSectionHidden(targetVisual, pixelWidths[targetVisual] < MinSectionWidth);
|
||||
|
||||
const int targetLogical = logicalIndexes[targetVisual];
|
||||
const int currentVisual = visualIndex(targetLogical);
|
||||
if(currentVisual != targetVisual) {
|
||||
moveSection(currentVisual, targetVisual);
|
||||
}
|
||||
|
||||
if(!p->m_stretchEnabled) {
|
||||
resizeSection(section, pixelWidths[section]);
|
||||
resizeSection(targetVisual, pixelWidths[targetVisual]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -560,8 +560,11 @@ void FilterWidget::setupConnections()
|
|||
m_model->setColumnOrder(Utils::logicalIndexOrder(m_header));
|
||||
}
|
||||
});
|
||||
QObject::connect(m_header, &QHeaderView::sectionMoved, this,
|
||||
[this]() { m_model->setColumnOrder(Utils::logicalIndexOrder(m_header)); });
|
||||
QObject::connect(m_header, &QHeaderView::sectionMoved, this, [this]() {
|
||||
if(m_view->viewMode() == ExpandedTreeView::ViewMode::Icon) {
|
||||
m_model->setColumnOrder(Utils::logicalIndexOrder(m_header));
|
||||
}
|
||||
});
|
||||
QObject::connect(m_header, &QHeaderView::sortIndicatorChanged, m_sortProxy, &QSortFilterProxyModel::sort);
|
||||
QObject::connect(m_header, &ExpandedTreeView::customContextMenuRequested, this, &FilterWidget::filterHeaderMenu);
|
||||
QObject::connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||
|
|
|
|||
Loading…
Reference in New Issue