diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp index 2d2830e60a..876c24bafb 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include #include "DlgSettingsGeneral.h" @@ -82,13 +84,30 @@ DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent ) recreatePreferencePackMenu(); - connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked); - connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack); - connect(ui->themesCombobox, qOverload(&QComboBox::activated), this, &DlgSettingsGeneral::onThemeChanged); - connect(ui->moreThemesLabel, &QLabel::linkActivated, this, &DlgSettingsGeneral::onLinkActivated); - ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs")); - connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked); + ui->themesCombobox->setEnabled(true); + Gui::Document* doc = Gui::Application::Instance->activeDocument(); + if (doc) { + Gui::View3DInventor* view = static_cast(doc->getActiveView()); + if (view) { + Gui::View3DInventorViewer* viewer = view->getViewer(); + if (viewer->isEditing()) { + ui->ImportConfig->setEnabled(false); + ui->SaveNewPreferencePack->setEnabled(false); + ui->ManagePreferencePacks->setEnabled(false); + ui->themesCombobox->setEnabled(false); + ui->moreThemesLabel->setEnabled(false); + } + } + } + if (ui->themesCombobox->isEnabled()) { + connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked); + connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack); + ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs")); + connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked); + connect(ui->themesCombobox, qOverload(&QComboBox::activated), this, &DlgSettingsGeneral::onThemeChanged); + connect(ui->moreThemesLabel, &QLabel::linkActivated, this, &DlgSettingsGeneral::onLinkActivated); + } // If there are any saved config file backs, show the revert button, otherwise hide it: const auto & backups = Application::Instance->prefPackManager()->configBackups(); @@ -643,8 +662,21 @@ void DlgSettingsGeneral::recreatePreferencePackMenu() auto kind = new QTableWidgetItem(tagString); ui->PreferencePacks->setItem(row, 1, kind); auto button = new QPushButton(icon, tr("Apply")); - button->setToolTip(tr("Apply the %1 preference pack").arg(QString::fromStdString(pack.first))); - connect(button, &QPushButton::clicked, this, [this, pack]() { onLoadPreferencePackClicked(pack.first); }); + button->setEnabled(true); + Gui::Document* doc = Gui::Application::Instance->activeDocument(); + if (doc) { + Gui::View3DInventor* view = static_cast(doc->getActiveView()); + if (view) { + Gui::View3DInventorViewer* viewer = view->getViewer(); + if (viewer->isEditing()) { + button->setEnabled(false); + } + } + } + if (button->isEnabled()) { + button->setToolTip(tr("Apply the %1 preference pack").arg(QString::fromStdString(pack.first))); + connect(button, &QPushButton::clicked, this, [this, pack]() { onLoadPreferencePackClicked(pack.first); }); + } ui->PreferencePacks->setCellWidget(row, 2, button); ++row; } diff --git a/src/Mod/Start/Gui/StartView.cpp b/src/Mod/Start/Gui/StartView.cpp index 185f5ea929..a4769da390 100644 --- a/src/Mod/Start/Gui/StartView.cpp +++ b/src/Mod/Start/Gui/StartView.cpp @@ -49,6 +49,8 @@ #include #include #include +#include +#include #include using namespace StartGui; @@ -476,6 +478,17 @@ void StartView::firstStartWidgetDismissed() void StartView::changeEvent(QEvent* event) { + _openFirstStart->setEnabled(true); + Gui::Document* doc = Gui::Application::Instance->activeDocument(); + if (doc) { + Gui::View3DInventor* view = static_cast(doc->getActiveView()); + if (view) { + Gui::View3DInventorViewer* viewer = view->getViewer(); + if (viewer->isEditing()) { + _openFirstStart->setEnabled(false); + } + } + } if (event->type() == QEvent::LanguageChange) { this->retranslateUi(); }