Translation will not work for class that inherits VProperty if class doesn't

containe macross Q_OBJECT.

--HG--
branch : develop
This commit is contained in:
dismine 2014-12-04 13:34:48 +02:00
parent ff9ba9601c
commit 2aaf530e85
15 changed files with 45 additions and 15 deletions

View file

@ -39,8 +39,8 @@ enum class ChildType : char {Invalid = 0, Value = 1, Formula = 2};
using namespace VPE; using namespace VPE;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormulaProperty::VFormulaProperty(const QString &name) : VFormulaProperty::VFormulaProperty(const QString &name)
VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId())) : VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId()))
{ {
d_ptr->type = Property::Complex; d_ptr->type = Property::Complex;

View file

@ -35,7 +35,7 @@ class VFormula;
class VFormulaProperty : public VPE::VProperty class VFormulaProperty : public VPE::VProperty
{ {
Q_OBJECT
public: public:
VFormulaProperty(const QString &name); VFormulaProperty(const QString &name);

View file

@ -51,6 +51,7 @@ Q_DECLARE_METATYPE(QPE::Vector3D) // todo
class VPROPERTYEXPLORERSHARED_EXPORT QVector3DProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT QVector3DProperty : public VProperty
{ {
Q_OBJECT
public: public:
QVector3DProperty(const QString& name); QVector3DProperty(const QString& name);
@ -87,6 +88,8 @@ public:
//! Returns the value of the property as a QVariant //! Returns the value of the property as a QVariant
virtual QVariant getValue() const; virtual QVariant getValue() const;
private:
Q_DISABLE_COPY(QVector3DProperty)
}; };
} }

View file

@ -43,11 +43,11 @@ VBoolProperty::VBoolProperty(const QString& name) :
// I'm not sure, how Qt handles the translations... // I'm not sure, how Qt handles the translations...
if (TrueText.isNull()) if (TrueText.isNull())
{ {
TrueText = QObject::tr("True"); TrueText = tr("True");
} }
if (FalseText.isNull()) if (FalseText.isNull())
{ {
FalseText = QObject::tr("False"); FalseText = tr("False");
} }
} }

View file

@ -29,6 +29,7 @@ namespace VPE
//! The VBoolProperty can take two states: True or False. //! The VBoolProperty can take two states: True or False.
class VPROPERTYEXPLORERSHARED_EXPORT VBoolProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT VBoolProperty : public VProperty
{ {
Q_OBJECT
public: public:
//! Default constructor //! Default constructor
VBoolProperty(const QString& name); VBoolProperty(const QString& name);
@ -64,6 +65,9 @@ protected:
//! The (translatable) text displayed when the property is set to false (default: "False") //! The (translatable) text displayed when the property is set to false (default: "False")
static QVariant FalseText; static QVariant FalseText;
private:
Q_DISABLE_COPY(VBoolProperty)
}; };
} }

View file

@ -30,7 +30,7 @@ namespace VPE
class VPROPERTYEXPLORERSHARED_EXPORT VColorProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT VColorProperty : public VProperty
{ {
Q_OBJECT
public: public:
VColorProperty(const QString &name); VColorProperty(const QString &name);
@ -61,6 +61,8 @@ public:
//! \return Returns the newly created property (or container, if it was not NULL) //! \return Returns the newly created property (or container, if it was not NULL)
virtual VProperty* clone(bool include_children = true, VProperty* container = NULL) const; virtual VProperty* clone(bool include_children = true, VProperty* container = NULL) const;
private:
Q_DISABLE_COPY(VColorProperty)
}; };
} }

View file

@ -38,7 +38,7 @@ VColorPropertyEditor::VColorPropertyEditor(QWidget *parent)
// Create the tool button // Create the tool button
ToolButton = new QToolButton(this); ToolButton = new QToolButton(this);
ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
ToolButton->setText(tr("...")); ToolButton->setText("...");
ToolButton->setFixedWidth(20); ToolButton->setFixedWidth(20);
ToolButton->installEventFilter(this); ToolButton->installEventFilter(this);
setFocusProxy(ToolButton); // Make the ToolButton the focus proxy 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) QString VColorPropertyEditor::getColorString(const QColor& color)
{ {
return QApplication::translate("QtPropertyExplorer", "[%1, %2, %3] (%4)", "Colors as string") return QString("[%1, %2, %3] (%4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
.arg(QString::number(color.red()))
.arg(QString::number(color.green()))
.arg(QString::number(color.blue()))
.arg(QString::number(color.alpha()));
} }
void VColorPropertyEditor::onToolButtonClicked() void VColorPropertyEditor::onToolButtonClicked()

View file

@ -28,6 +28,7 @@ namespace VPE
class VPROPERTYEXPLORERSHARED_EXPORT VEmptyProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT VEmptyProperty : public VProperty
{ {
Q_OBJECT
public: public:
//! Standard constructor, takes a name and a parent property as argument //! Standard constructor, takes a name and a parent property as argument
explicit VEmptyProperty(const QString& name); explicit VEmptyProperty(const QString& name);
@ -65,6 +66,9 @@ public:
protected: protected:
//! Protected constructor //! Protected constructor
VEmptyProperty(VPropertyPrivate* d); VEmptyProperty(VPropertyPrivate* d);
private:
Q_DISABLE_COPY(VEmptyProperty)
}; };
} }

View file

@ -32,6 +32,7 @@ namespace VPE
class VPROPERTYEXPLORERSHARED_EXPORT VFileProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT VFileProperty : public VProperty
{ {
Q_OBJECT
public: public:
VFileProperty(const QString &name); VFileProperty(const QString &name);
@ -93,6 +94,9 @@ public:
//! Sets whether this is a file (false) or a directory (true) //! Sets whether this is a file (false) or a directory (true)
virtual void setDirectory(bool is_directory); virtual void setDirectory(bool is_directory);
private:
Q_DISABLE_COPY(VFileProperty)
}; };
} }

View file

@ -36,7 +36,7 @@ VFileEditWidget::VFileEditWidget(QWidget *parent, bool is_directory)
// Create the tool button,ToolButton = new QToolButton(this); // Create the tool button,ToolButton = new QToolButton(this);
ToolButton = new QToolButton(this); ToolButton = new QToolButton(this);
ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
ToolButton->setText(tr("...")); ToolButton->setText("...");
ToolButton->setFixedWidth(20); ToolButton->setFixedWidth(20);
ToolButton->installEventFilter(this); ToolButton->installEventFilter(this);
setFocusProxy(ToolButton); // Make the ToolButton the focus proxy setFocusProxy(ToolButton); // Make the ToolButton the focus proxy

View file

@ -76,6 +76,9 @@ protected:
static const int StandardMin;// = -1000000; static const int StandardMin;// = -1000000;
static const int StandardMax;// = 1000000; static const int StandardMax;// = 1000000;
private:
Q_DISABLE_COPY(VIntegerProperty)
}; };
@ -126,6 +129,9 @@ protected:
int Precision; int Precision;
const static double StandardPrecision;// = 5; const static double StandardPrecision;// = 5;
private:
Q_DISABLE_COPY(VDoubleProperty)
}; };

View file

@ -30,6 +30,7 @@ namespace VPE
class VPROPERTYEXPLORERSHARED_EXPORT VPointFProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT VPointFProperty : public VProperty
{ {
Q_OBJECT
public: public:
VPointFProperty(const QString& name); VPointFProperty(const QString& name);
@ -66,6 +67,8 @@ public:
//! Returns the value of the property as a QVariant //! Returns the value of the property as a QVariant
virtual QVariant getValue() const; virtual QVariant getValue() const;
private:
Q_DISABLE_COPY(VPointFProperty)
}; };
} }

View file

@ -30,6 +30,7 @@ namespace VPE
//! This property can be used to handle key shortcuts //! This property can be used to handle key shortcuts
class VPROPERTYEXPLORERSHARED_EXPORT VShortcutProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT VShortcutProperty : public VProperty
{ {
Q_OBJECT
public: public:
VShortcutProperty(const QString &name); VShortcutProperty(const QString &name);
@ -65,6 +66,9 @@ public:
//! Sets the value of the property //! Sets the value of the property
virtual void setValue(const QVariant& value); virtual void setValue(const QVariant& value);
private:
Q_DISABLE_COPY(VShortcutProperty)
}; };
} }

View file

@ -31,6 +31,7 @@ namespace VPE
//! Class for holding a string property //! Class for holding a string property
class VPROPERTYEXPLORERSHARED_EXPORT VStringProperty : public VProperty class VPROPERTYEXPLORERSHARED_EXPORT VStringProperty : public VProperty
{ {
Q_OBJECT
public: public:
VStringProperty(const QString& name, const QMap<QString, QVariant>& settings); VStringProperty(const QString& name, const QMap<QString, QVariant>& settings);
@ -76,6 +77,9 @@ public:
protected: protected:
bool readOnly; bool readOnly;
int typeForParent; int typeForParent;
private:
Q_DISABLE_COPY(VStringProperty)
}; };
} }

View file

@ -95,7 +95,8 @@ protected:
//! Function to handle newly created VPropertyWidgets //! Function to handle newly created VPropertyWidgets
virtual void connectPropertyFormWidget(VPropertyFormWidget* widget); virtual void connectPropertyFormWidget(VPropertyFormWidget* widget);
private:
Q_DISABLE_COPY(VPropertyFormView)
}; };
} // Namespace VPE } // Namespace VPE