From c53fce0f24b0ad3e30eefa3add5303bb7c11c8f9 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 27 Mar 2006 06:38:37 +0000 Subject: [PATCH] Fixed bug PAL6829 --- src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 32 +++++++++++++++++++++++++++- src/VISUGUI/VisuGUI_ScalarBarDlg.h | 10 +++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index d6f49d89..c3f9bcf7 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -820,6 +820,7 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) { thePrs->SetLabelColor(aLblColor.red()/255., aLblColor.green()/255., aLblColor.blue()/255.); + myIsStoreTextProp = false; } return 1; @@ -1037,7 +1038,8 @@ bool VisuGUI_ScalarBarPane::check() void VisuGUI_ScalarBarPane::onTextPref() { - myIsStoreTextProp = myTextDlg->exec(); + myTextDlg->storeBeginValues(); + myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp; updatePreview(); } @@ -1181,3 +1183,31 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); } + +void VisuGUI_TextPrefDlg::storeBeginValues() +{ + myTitle = myTitleEdt->text(); + myTitleFont->GetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]); + myLabelFont->GetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]); +} + +/*! + Called when button is clicked, restore begin values +*/ +void VisuGUI_TextPrefDlg::reject() +{ + myTitleEdt->setText(myTitle); + myTitleFont->SetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]); + myLabelFont->SetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]); + + QDialog::reject(); +} +/*! + Called when button is clicked, store begin values +*/ +void VisuGUI_TextPrefDlg::accept() +{ + storeBeginValues(); + + QDialog::accept(); +} diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.h b/src/VISUGUI/VisuGUI_ScalarBarDlg.h index 4f53a39b..02ac4462 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.h @@ -77,12 +77,22 @@ class VisuGUI_TextPrefDlg: public QDialog void setTitleVisible (bool isVisible) { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); } + void storeBeginValues(); + public: SVTK_FontWidget* myTitleFont; SVTK_FontWidget* myLabelFont; + protected slots: + void accept(); + void reject(); + private: QLineEdit* myTitleEdt; + QString myTitle; + QColor myColors[2]; + int myComboVals[2]; + bool myCheckVals[6]; }; -- 2.39.2