diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
| commit | 7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch) | |
| tree | 27fb39be241fdb5ac2734c574de678977d1856d0 /libs/uibase/src/widgetutility.cpp | |
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 <noreply@anthropic.com>
Diffstat (limited to 'libs/uibase/src/widgetutility.cpp')
| -rw-r--r-- | libs/uibase/src/widgetutility.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
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 <uibase/widgetutility.h> +#include <uibase/eventfilter.h> +#include <QCheckBox> +#include <QHeaderView> +#include <QMenu> +#include <QWidgetAction> + +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 |
