From 2aaf530e85c84497c024b195c9305177ec135e6e Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 4 Dec 2014 13:34:48 +0200 Subject: [PATCH] Translation will not work for class that inherits VProperty if class doesn't containe macross Q_OBJECT. --HG-- branch : develop --- src/app/widgets/vformulaproperty.cpp | 4 ++-- src/app/widgets/vformulaproperty.h | 2 +- .../plugins/Vector3d/vvector3dproperty.h | 3 +++ src/libs/vpropertyexplorer/plugins/vboolproperty.cpp | 4 ++-- src/libs/vpropertyexplorer/plugins/vboolproperty.h | 4 ++++ src/libs/vpropertyexplorer/plugins/vcolorproperty.h | 4 +++- .../vpropertyexplorer/plugins/vcolorpropertyeditor.cpp | 9 ++------- src/libs/vpropertyexplorer/plugins/vemptyproperty.h | 4 ++++ src/libs/vpropertyexplorer/plugins/vfileproperty.h | 4 ++++ .../vpropertyexplorer/plugins/vfilepropertyeditor.cpp | 2 +- src/libs/vpropertyexplorer/plugins/vnumberproperty.h | 6 ++++++ src/libs/vpropertyexplorer/plugins/vpointfproperty.h | 3 +++ src/libs/vpropertyexplorer/plugins/vshortcutproperty.h | 4 ++++ src/libs/vpropertyexplorer/plugins/vstringproperty.h | 4 ++++ src/libs/vpropertyexplorer/vpropertyformview.h | 3 ++- 15 files changed, 45 insertions(+), 15 deletions(-) diff --git a/src/app/widgets/vformulaproperty.cpp b/src/app/widgets/vformulaproperty.cpp index 0fc8108ba..444a9fca6 100644 --- a/src/app/widgets/vformulaproperty.cpp +++ b/src/app/widgets/vformulaproperty.cpp @@ -39,8 +39,8 @@ enum class ChildType : char {Invalid = 0, Value = 1, Formula = 2}; using namespace VPE; //--------------------------------------------------------------------------------------------------------------------- -VFormulaProperty::VFormulaProperty(const QString &name) : - VProperty(name, static_cast(VFormula::FormulaTypeId())) +VFormulaProperty::VFormulaProperty(const QString &name) + : VProperty(name, static_cast(VFormula::FormulaTypeId())) { d_ptr->type = Property::Complex; diff --git a/src/app/widgets/vformulaproperty.h b/src/app/widgets/vformulaproperty.h index 57167fecc..90c177aed 100644 --- a/src/app/widgets/vformulaproperty.h +++ b/src/app/widgets/vformulaproperty.h @@ -35,7 +35,7 @@ class VFormula; class VFormulaProperty : public VPE::VProperty { - + Q_OBJECT public: VFormulaProperty(const QString &name); diff --git a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h index 7aec52e94..0f6435d0d 100644 --- a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h +++ b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h @@ -51,6 +51,7 @@ Q_DECLARE_METATYPE(QPE::Vector3D) // todo class VPROPERTYEXPLORERSHARED_EXPORT QVector3DProperty : public VProperty { + Q_OBJECT public: QVector3DProperty(const QString& name); @@ -87,6 +88,8 @@ public: //! Returns the value of the property as a QVariant virtual QVariant getValue() const; +private: + Q_DISABLE_COPY(QVector3DProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp b/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp index 677ed09d7..f635c4293 100644 --- a/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp @@ -43,11 +43,11 @@ VBoolProperty::VBoolProperty(const QString& name) : // I'm not sure, how Qt handles the translations... if (TrueText.isNull()) { - TrueText = QObject::tr("True"); + TrueText = tr("True"); } if (FalseText.isNull()) { - FalseText = QObject::tr("False"); + FalseText = tr("False"); } } diff --git a/src/libs/vpropertyexplorer/plugins/vboolproperty.h b/src/libs/vpropertyexplorer/plugins/vboolproperty.h index 589bfe67f..603cd2ef0 100644 --- a/src/libs/vpropertyexplorer/plugins/vboolproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vboolproperty.h @@ -29,6 +29,7 @@ namespace VPE //! The VBoolProperty can take two states: True or False. class VPROPERTYEXPLORERSHARED_EXPORT VBoolProperty : public VProperty { + Q_OBJECT public: //! Default constructor VBoolProperty(const QString& name); @@ -64,6 +65,9 @@ protected: //! The (translatable) text displayed when the property is set to false (default: "False") static QVariant FalseText; + +private: + Q_DISABLE_COPY(VBoolProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vcolorproperty.h b/src/libs/vpropertyexplorer/plugins/vcolorproperty.h index ba4600bfa..ef84b47fc 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vcolorproperty.h @@ -30,7 +30,7 @@ namespace VPE class VPROPERTYEXPLORERSHARED_EXPORT VColorProperty : public VProperty { - + Q_OBJECT public: VColorProperty(const QString &name); @@ -61,6 +61,8 @@ public: //! \return Returns the newly created property (or container, if it was not NULL) virtual VProperty* clone(bool include_children = true, VProperty* container = NULL) const; +private: + Q_DISABLE_COPY(VColorProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp index 29d173ef4..ab55c2378 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp @@ -38,7 +38,7 @@ VColorPropertyEditor::VColorPropertyEditor(QWidget *parent) // Create the tool button ToolButton = new QToolButton(this); ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); - ToolButton->setText(tr("...")); + ToolButton->setText("..."); ToolButton->setFixedWidth(20); ToolButton->installEventFilter(this); setFocusProxy(ToolButton); // Make the ToolButton the focus proxy @@ -88,12 +88,7 @@ QPixmap VColorPropertyEditor::getColorPixmap(const QColor& color, unsigned int s QString VColorPropertyEditor::getColorString(const QColor& color) { - return QApplication::translate("QtPropertyExplorer", "[%1, %2, %3] (%4)", "Colors as string") - .arg(QString::number(color.red())) - .arg(QString::number(color.green())) - .arg(QString::number(color.blue())) - .arg(QString::number(color.alpha())); - + return QString("[%1, %2, %3] (%4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha()); } void VColorPropertyEditor::onToolButtonClicked() diff --git a/src/libs/vpropertyexplorer/plugins/vemptyproperty.h b/src/libs/vpropertyexplorer/plugins/vemptyproperty.h index a91d6003e..f19c9bc1d 100644 --- a/src/libs/vpropertyexplorer/plugins/vemptyproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vemptyproperty.h @@ -28,6 +28,7 @@ namespace VPE class VPROPERTYEXPLORERSHARED_EXPORT VEmptyProperty : public VProperty { + Q_OBJECT public: //! Standard constructor, takes a name and a parent property as argument explicit VEmptyProperty(const QString& name); @@ -65,6 +66,9 @@ public: protected: //! Protected constructor VEmptyProperty(VPropertyPrivate* d); + +private: + Q_DISABLE_COPY(VEmptyProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vfileproperty.h b/src/libs/vpropertyexplorer/plugins/vfileproperty.h index c7a0c616e..64611cf23 100644 --- a/src/libs/vpropertyexplorer/plugins/vfileproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vfileproperty.h @@ -32,6 +32,7 @@ namespace VPE class VPROPERTYEXPLORERSHARED_EXPORT VFileProperty : public VProperty { + Q_OBJECT public: VFileProperty(const QString &name); @@ -93,6 +94,9 @@ public: //! Sets whether this is a file (false) or a directory (true) virtual void setDirectory(bool is_directory); + +private: + Q_DISABLE_COPY(VFileProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp index acc4d2b1d..a9d70d535 100644 --- a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp @@ -36,7 +36,7 @@ VFileEditWidget::VFileEditWidget(QWidget *parent, bool is_directory) // Create the tool button,ToolButton = new QToolButton(this); ToolButton = new QToolButton(this); ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); - ToolButton->setText(tr("...")); + ToolButton->setText("..."); ToolButton->setFixedWidth(20); ToolButton->installEventFilter(this); setFocusProxy(ToolButton); // Make the ToolButton the focus proxy diff --git a/src/libs/vpropertyexplorer/plugins/vnumberproperty.h b/src/libs/vpropertyexplorer/plugins/vnumberproperty.h index bf39d60ec..c76a4382d 100644 --- a/src/libs/vpropertyexplorer/plugins/vnumberproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vnumberproperty.h @@ -76,6 +76,9 @@ protected: static const int StandardMin;// = -1000000; static const int StandardMax;// = 1000000; + +private: + Q_DISABLE_COPY(VIntegerProperty) }; @@ -126,6 +129,9 @@ protected: int Precision; const static double StandardPrecision;// = 5; + +private: + Q_DISABLE_COPY(VDoubleProperty) }; diff --git a/src/libs/vpropertyexplorer/plugins/vpointfproperty.h b/src/libs/vpropertyexplorer/plugins/vpointfproperty.h index c8e082529..7c74cd0a2 100644 --- a/src/libs/vpropertyexplorer/plugins/vpointfproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vpointfproperty.h @@ -30,6 +30,7 @@ namespace VPE class VPROPERTYEXPLORERSHARED_EXPORT VPointFProperty : public VProperty { + Q_OBJECT public: VPointFProperty(const QString& name); @@ -66,6 +67,8 @@ public: //! Returns the value of the property as a QVariant virtual QVariant getValue() const; +private: + Q_DISABLE_COPY(VPointFProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h b/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h index ad994f12f..db8e03cb5 100644 --- a/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h @@ -30,6 +30,7 @@ namespace VPE //! This property can be used to handle key shortcuts class VPROPERTYEXPLORERSHARED_EXPORT VShortcutProperty : public VProperty { + Q_OBJECT public: VShortcutProperty(const QString &name); @@ -65,6 +66,9 @@ public: //! Sets the value of the property virtual void setValue(const QVariant& value); + +private: + Q_DISABLE_COPY(VShortcutProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vstringproperty.h b/src/libs/vpropertyexplorer/plugins/vstringproperty.h index 87afc829c..247801ce3 100644 --- a/src/libs/vpropertyexplorer/plugins/vstringproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vstringproperty.h @@ -31,6 +31,7 @@ namespace VPE //! Class for holding a string property class VPROPERTYEXPLORERSHARED_EXPORT VStringProperty : public VProperty { + Q_OBJECT public: VStringProperty(const QString& name, const QMap& settings); @@ -76,6 +77,9 @@ public: protected: bool readOnly; int typeForParent; + +private: + Q_DISABLE_COPY(VStringProperty) }; } diff --git a/src/libs/vpropertyexplorer/vpropertyformview.h b/src/libs/vpropertyexplorer/vpropertyformview.h index 1d7c67a4f..3493ac539 100644 --- a/src/libs/vpropertyexplorer/vpropertyformview.h +++ b/src/libs/vpropertyexplorer/vpropertyformview.h @@ -95,7 +95,8 @@ protected: //! Function to handle newly created VPropertyWidgets virtual void connectPropertyFormWidget(VPropertyFormWidget* widget); - +private: + Q_DISABLE_COPY(VPropertyFormView) }; } // Namespace VPE