+ reset built-in scheme when setting global style sheet
This commit is contained in:
parent
997001bbd9
commit
7b37841fdc
|
@ -36,6 +36,8 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "PrefWidgets.h"
|
#include "PrefWidgets.h"
|
||||||
#include "Language/Translator.h"
|
#include "Language/Translator.h"
|
||||||
|
#include "Control.h"
|
||||||
|
#include "TaskView/TaskView.h"
|
||||||
|
|
||||||
using namespace Gui::Dialog;
|
using namespace Gui::Dialog;
|
||||||
|
|
||||||
|
@ -148,7 +150,7 @@ void DlgGeneralImp::saveSettings()
|
||||||
|
|
||||||
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");
|
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");
|
||||||
hGrp->SetBool("TiledBackground", this->tiledBackground->isChecked());
|
hGrp->SetBool("TiledBackground", this->tiledBackground->isChecked());
|
||||||
QMdiArea* mdi = getMainWindow()->findChild<QMdiArea*>();
|
QMdiArea* mdi = getMainWindow()->findChild<QMdiArea*>();
|
||||||
mdi->setProperty("showImage", this->tiledBackground->isChecked());
|
mdi->setProperty("showImage", this->tiledBackground->isChecked());
|
||||||
|
|
||||||
QVariant sheet = this->StyleSheets->itemData(this->StyleSheets->currentIndex());
|
QVariant sheet = this->StyleSheets->itemData(this->StyleSheets->currentIndex());
|
||||||
|
@ -159,9 +161,13 @@ void DlgGeneralImp::saveSettings()
|
||||||
if (!sheet.toString().isEmpty()) {
|
if (!sheet.toString().isEmpty()) {
|
||||||
QFile f(sheet.toString());
|
QFile f(sheet.toString());
|
||||||
if (f.open(QFile::ReadOnly)) {
|
if (f.open(QFile::ReadOnly)) {
|
||||||
mdi->setBackground(QBrush(Qt::NoBrush));
|
mdi->setBackground(QBrush(Qt::NoBrush));
|
||||||
QTextStream str(&f);
|
QTextStream str(&f);
|
||||||
qApp->setStyleSheet(str.readAll());
|
qApp->setStyleSheet(str.readAll());
|
||||||
|
|
||||||
|
Gui::TaskView::TaskView* taskPanel = Control().taskPanel();
|
||||||
|
if (taskPanel)
|
||||||
|
taskPanel->clearActionStyle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,11 +175,17 @@ void DlgGeneralImp::saveSettings()
|
||||||
if (sheet.toString().isEmpty()) {
|
if (sheet.toString().isEmpty()) {
|
||||||
if (this->tiledBackground->isChecked()) {
|
if (this->tiledBackground->isChecked()) {
|
||||||
qApp->setStyleSheet(QString());
|
qApp->setStyleSheet(QString());
|
||||||
mdi->setBackground(QPixmap(QLatin1String(":/icons/background.png")));
|
Gui::TaskView::TaskView* taskPanel = Control().taskPanel();
|
||||||
|
if (taskPanel)
|
||||||
|
taskPanel->restoreActionStyle();
|
||||||
|
mdi->setBackground(QPixmap(QLatin1String(":/icons/background.png")));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qApp->setStyleSheet(QString());
|
qApp->setStyleSheet(QString());
|
||||||
mdi->setBackground(QBrush(QColor(160,160,160)));
|
Gui::TaskView::TaskView* taskPanel = Control().taskPanel();
|
||||||
|
if (taskPanel)
|
||||||
|
taskPanel->restoreActionStyle();
|
||||||
|
mdi->setBackground(QBrush(QColor(160,160,160)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -619,5 +619,21 @@ void TaskView::clicked (QAbstractButton * button)
|
||||||
ActiveDialog->clicked(id);
|
ActiveDialog->clicked(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskView::clearActionStyle()
|
||||||
|
{
|
||||||
|
#if defined (QSINT_ACTIONPANEL)
|
||||||
|
static_cast<QSint::FreeCADPanelScheme*>(QSint::FreeCADPanelScheme::defaultScheme())->clearActionStyle();
|
||||||
|
taskPanel->setScheme(QSint::FreeCADPanelScheme::defaultScheme());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskView::restoreActionStyle()
|
||||||
|
{
|
||||||
|
#if defined (QSINT_ACTIONPANEL)
|
||||||
|
static_cast<QSint::FreeCADPanelScheme*>(QSint::FreeCADPanelScheme::defaultScheme())->restoreActionStyle();
|
||||||
|
taskPanel->setScheme(QSint::FreeCADPanelScheme::defaultScheme());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "moc_TaskView.cpp"
|
#include "moc_TaskView.cpp"
|
||||||
|
|
|
@ -173,6 +173,9 @@ public:
|
||||||
void addTaskWatcher(const std::vector<TaskWatcher*> &Watcher);
|
void addTaskWatcher(const std::vector<TaskWatcher*> &Watcher);
|
||||||
void clearTaskWatcher(void);
|
void clearTaskWatcher(void);
|
||||||
|
|
||||||
|
void clearActionStyle();
|
||||||
|
void restoreActionStyle();
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user