Set and dynamically refresh locale settings for tool property browser.
--HG-- branch : feature
This commit is contained in:
parent
2726bd4eb6
commit
f6e511e43c
|
@ -84,7 +84,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
recentFileActs[i] = nullptr;
|
||||
}
|
||||
|
||||
WindowsLocale();
|
||||
CreateActions();
|
||||
CreateMenus();
|
||||
ToolBarDraws();
|
||||
|
@ -135,6 +134,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
PropertyBrowser();
|
||||
|
||||
setCurrentFile("");
|
||||
WindowsLocale();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1144,6 +1144,7 @@ void MainWindow::ArrowTool()
|
|||
ui->actionArrowTool->setChecked(true);
|
||||
ui->actionStopTool->setEnabled(false);
|
||||
tool = Tool::Arrow;
|
||||
emit EnableItemMove(true);
|
||||
QCursor cur(Qt::ArrowCursor);
|
||||
ui->view->setCursor(cur);
|
||||
helpLabel->setText("");
|
||||
|
@ -1403,8 +1404,8 @@ void MainWindow::Open()
|
|||
void MainWindow::Preferences()
|
||||
{
|
||||
ConfigDialog dlg(this);
|
||||
connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::UpdateOptions);
|
||||
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale);
|
||||
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first
|
||||
connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
InitAutoSave();
|
||||
|
|
|
@ -53,6 +53,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
|
|||
Q_UNUSED(index);
|
||||
emit NewLastValue(-10001.0);//Here need reset value to default because we begin work with new item
|
||||
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
||||
editor->setLocale(parent->locale());
|
||||
editor->setMinimum(-10000.0);
|
||||
editor->setMaximum(10000.0);
|
||||
connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor);
|
||||
|
|
|
@ -58,6 +58,7 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
|
|||
Q_UNUSED(option);
|
||||
Q_UNUSED(index);
|
||||
QLineEdit *editor = new QLineEdit(parent);
|
||||
editor->setLocale(parent->locale());
|
||||
//Same regex pattern in xsd file
|
||||
editor->setValidator( new QRegExpValidator(QRegExp(regex)) );
|
||||
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
||||
|
|
|
@ -94,7 +94,7 @@ QWidget* VFormulaProperty::createEditor(QWidget* parent, const QStyleOptionViewI
|
|||
|
||||
VFormula formula = VProperty::d_ptr->VariantValue.value<VFormula>();
|
||||
VFormulaPropertyEditor* tmpEditor = new VFormulaPropertyEditor(parent);
|
||||
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
tmpEditor->SetFormula(formula);
|
||||
VProperty::d_ptr->editor = tmpEditor;
|
||||
return VProperty::d_ptr->editor;
|
||||
|
|
|
@ -232,6 +232,14 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::RefreshOptions()
|
||||
{
|
||||
QGraphicsItem *item = currentItem;
|
||||
itemClicked(nullptr);//close options
|
||||
itemClicked(item);//reopen options
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@ public slots:
|
|||
void itemClicked(QGraphicsItem *item);
|
||||
void userChangedData(VPE::VProperty* property);
|
||||
void UpdateOptions();
|
||||
void RefreshOptions();
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolOptionsPropertyBrowser)
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ QWidget* VColorProperty::createEditor(QWidget* parent, const QStyleOptionViewIte
|
|||
Q_UNUSED(delegate);
|
||||
|
||||
VColorPropertyEditor* tmpWidget = new VColorPropertyEditor(parent);
|
||||
tmpWidget->setLocale(parent->locale());
|
||||
tmpWidget->SetColor(d_ptr->VariantValue.value<QColor>());
|
||||
return tmpWidget;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ QWidget* VEnumProperty::createEditor(QWidget * parent, const QStyleOptionViewIte
|
|||
Q_UNUSED(delegate);
|
||||
QComboBox* tmpEditor = new QComboBox(parent);
|
||||
tmpEditor->clear();
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
tmpEditor->addItems(EnumerationLiterals);
|
||||
tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt());
|
||||
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
|
|
|
@ -87,6 +87,7 @@ QWidget* VFileProperty::createEditor(QWidget * parent, const QStyleOptionViewIte
|
|||
VFileEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget*)), delegate, SIGNAL(commitData(QWidget*)));
|
||||
|
||||
}
|
||||
tmpWidget->setLocale(parent->locale());
|
||||
tmpWidget->setFilter(static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters); // todo: parse this string
|
||||
tmpWidget->setFile(d_ptr->VariantValue.toString());
|
||||
tmpWidget->setDirectory(static_cast<VFilePropertyPrivate*>(d_ptr)->Directory);
|
||||
|
|
|
@ -86,6 +86,7 @@ QWidget *VLineColorProperty::createEditor(QWidget *parent, const QStyleOptionVie
|
|||
++i;
|
||||
}
|
||||
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt());
|
||||
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&VLineColorProperty::currentIndexChanged);
|
||||
|
|
|
@ -76,6 +76,7 @@ QWidget *VLineTypeProperty::createEditor(QWidget *parent, const QStyleOptionView
|
|||
Q_UNUSED(delegate);
|
||||
QComboBox* tmpEditor = new QComboBox(parent);
|
||||
tmpEditor->clear();
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
tmpEditor->setIconSize(QSize(80, 14));
|
||||
tmpEditor->setMinimumWidth(80);
|
||||
tmpEditor->setMaximumWidth(110);
|
||||
|
|
|
@ -56,6 +56,7 @@ QWidget* VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionView
|
|||
Q_UNUSED(delegate);
|
||||
|
||||
QSpinBox* tmpEditor = new QSpinBox(parent);
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
tmpEditor->setMinimum(static_cast<int>(minValue));
|
||||
tmpEditor->setMaximum(static_cast<int>(maxValue));
|
||||
tmpEditor->setSingleStep(static_cast<int>(singleStep));
|
||||
|
@ -162,6 +163,7 @@ QWidget* VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewI
|
|||
Q_UNUSED(options);
|
||||
Q_UNUSED(delegate);
|
||||
QDoubleSpinBox* tmpEditor = new QDoubleSpinBox(parent);
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
tmpEditor->setMinimum(minValue);
|
||||
tmpEditor->setMaximum(maxValue);
|
||||
tmpEditor->setDecimals(Precision);
|
||||
|
|
|
@ -64,6 +64,7 @@ QWidget* VObjectProperty::createEditor(QWidget * parent, const QStyleOptionViewI
|
|||
Q_UNUSED(delegate);
|
||||
QComboBox* tmpEditor = new QComboBox(parent);
|
||||
tmpEditor->clear();
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
FillList(tmpEditor, objects);
|
||||
tmpEditor->setCurrentIndex(tmpEditor->findData(VProperty::d_ptr->VariantValue.toUInt()));
|
||||
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
|
|
|
@ -61,7 +61,7 @@ QWidget* VShortcutProperty::createEditor(QWidget * parent, const QStyleOptionVie
|
|||
{
|
||||
VShortcutEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget*)), delegate, SIGNAL(commitData(QWidget*)));
|
||||
}
|
||||
|
||||
tmpWidget->setLocale(parent->locale());
|
||||
return tmpWidget;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionV
|
|||
Q_UNUSED(delegate);
|
||||
|
||||
QLineEdit* tmpEditor = new QLineEdit(parent);
|
||||
tmpEditor->setLocale(parent->locale());
|
||||
tmpEditor->setReadOnly(readOnly);
|
||||
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
tmpEditor->setText(d_ptr->VariantValue.toString());
|
||||
|
|
Loading…
Reference in New Issue
Block a user