From 7ee008e150bc5bcf76082d726f719ee0fdfda982 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Wed, 11 Feb 2026 02:37:39 -0600 Subject: Fluorine Manager: full Linux port of Mod Organizer 2 Complete native Linux port with FUSE-based virtual filesystem, Proton/umu-run integration, and Flatpak packaging. Key features: - FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak) - Proton/GE-Proton/umu-run launcher with env var forwarding - Flatpak support (sandbox-aware VFS, NXM handler, umu-run) - Wine prefix management UI - Case-insensitive path resolution for Linux filesystems - QSettings-safe INI handling (avoids Bethesda INI corruption) - Portable instance support with auto-generated launcher scripts Co-Authored-By: Claude Opus 4.6 --- libs/uibase/src/widgetutility.cpp | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 libs/uibase/src/widgetutility.cpp (limited to 'libs/uibase/src/widgetutility.cpp') diff --git a/libs/uibase/src/widgetutility.cpp b/libs/uibase/src/widgetutility.cpp new file mode 100644 index 0000000..e3a4b06 --- /dev/null +++ b/libs/uibase/src/widgetutility.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include + +namespace MOBase +{ + +void onHeaderContextMenu(QTreeView* view, const QPoint& pos) +{ + auto* header = view->header(); + + QMenu menu; + + // display a list of all headers as checkboxes + QAbstractItemModel* model = header->model(); + + for (int i = 1; i < model->columnCount(); ++i) { + const QString columnName = model->headerData(i, Qt::Horizontal).toString(); + + auto* checkBox = new QCheckBox(&menu); + checkBox->setText(columnName); + checkBox->setChecked(!header->isSectionHidden(i)); + + // Enable the checkbox if 1) the section is visible, or 2) the + // EnabledColumnRole is not found, or 3) the value for the role is true. + auto display = model->headerData(i, Qt::Horizontal, EnabledColumnRole); + checkBox->setEnabled(!header->isSectionHidden(i) || !display.isValid() || + display.toBool()); + + auto* checkableAction = new QWidgetAction(&menu); + checkableAction->setDefaultWidget(checkBox); + + QObject::connect(checkBox, &QCheckBox::clicked, [=] { + header->setSectionHidden(i, !checkBox->isChecked()); + }); + + menu.addAction(checkableAction); + } + + menu.exec(header->viewport()->mapToGlobal(pos)); +} + +void setCustomizableColumns(QTreeView* view) +{ + auto* header = view->header(); + + header->setSectionsMovable(true); + header->setContextMenuPolicy(Qt::CustomContextMenu); + + QObject::connect(header, &QWidget::customContextMenuRequested, view, + [view](auto&& pos) { + onHeaderContextMenu(view, pos); + }); +} + +} // namespace MOBase -- cgit v1.3.1