mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Merge branch 'ifcviewer-wgpu' of https://github.com/IfcOpenShell/IfcOpenShell into ifcviewer-wgpu
This commit is contained in:
@@ -187,6 +187,22 @@ void renameGroup(SessionState& session, QWidget& host, const QString& group_id)
|
||||
session.setStatusMessage("Models", "Group renamed");
|
||||
}
|
||||
|
||||
void renameModel(SessionState& session, QWidget& host, const QString& model_id) {
|
||||
const Federation::Model* model = session.federation()->findById(model_id);
|
||||
if (!model) return;
|
||||
|
||||
bool ok = false;
|
||||
const QString name = QInputDialog::getText(
|
||||
&host, "Rename Model", "Model name:", QLineEdit::Normal, model->display_name, &ok);
|
||||
if (!ok) return;
|
||||
const QString trimmed = name.trimmed();
|
||||
if (trimmed.isEmpty()) return;
|
||||
|
||||
session.federation()->setModelDisplayName(model_id, trimmed);
|
||||
session.notifyFederationChanged();
|
||||
session.setStatusMessage("Models", "Model renamed");
|
||||
}
|
||||
|
||||
void moveGroup(SessionState& session, const QString& id, const QString& parent_group_id) {
|
||||
session.federation()->setGroupParent(id, parent_group_id);
|
||||
session.notifyFederationChanged();
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace bonsaiviewer::modules::models::commands {
|
||||
void toggleVisibility(SessionState& session, ItemKind kind, const QString& id);
|
||||
void addGroup(SessionState& session, QWidget& host, const QString& parent_group_id);
|
||||
void renameGroup(SessionState& session, QWidget& host, const QString& group_id);
|
||||
void renameModel(SessionState& session, QWidget& host, const QString& model_id);
|
||||
void moveGroup(SessionState& session, const QString& id, const QString& parent_group_id);
|
||||
void moveModels(SessionState& session, const QStringList& ids, const QString& parent_group_id);
|
||||
void removeGroup(SessionState& session, QWidget& host, const QString& group_id);
|
||||
|
||||
@@ -321,6 +321,12 @@ ModelsPanel::ModelsPanel(bonsaiviewer::SessionState* session_state,
|
||||
parent_group_id = idOf(parent_index);
|
||||
}
|
||||
|
||||
QAction* rename = menu.addAction(
|
||||
components::icons::makeSvgIcon(":/icons/cube.svg"), "Rename");
|
||||
connect(rename, &QAction::triggered, this, [this, id]() {
|
||||
commands::renameModel(*session_state_, *this, id);
|
||||
});
|
||||
|
||||
QAction* add_group = menu.addAction(
|
||||
components::icons::makeSvgIcon(":/icons/folder-plus.svg"), "New Group");
|
||||
connect(add_group, &QAction::triggered, this, [this, parent_group_id]() {
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
#define NOMCX
|
||||
#define NOSERVICE
|
||||
#include <Windows.h>
|
||||
#elif defined(Q_OS_MAC)
|
||||
// Cocoa bridge declared here, implemented in the adjacent .mm file. Must be
|
||||
// visible before createWgpuSurface() below calls wgpu_macos_attach_metal_layer.
|
||||
#include "MetalSurface_mac.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
@@ -832,10 +836,6 @@ bool ViewportWindow::initWgpu() {
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
#elif defined(Q_OS_MAC)
|
||||
// Cocoa bridge declared in MetalSurface_mac.h, implemented in the
|
||||
// adjacent .mm file. Keeps Objective-C out of this pure-C++ TU.
|
||||
# include "MetalSurface_mac.h"
|
||||
#endif
|
||||
|
||||
// Private bool createSurface() removed in #84-l — its body is now
|
||||
|
||||
Reference in New Issue
Block a user