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;
//---------------------------------------------------------------------------------------------------------------------
VFormulaProperty::VFormulaProperty(const QString &name) :
VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId()))
VFormulaProperty::VFormulaProperty(const QString &name)
: VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId()))
{
d_ptr->type = Property::Complex;

View File

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

View File

@ -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)
};
}

View File

@ -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");
}
}

View File

@ -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)
};
}

View File

@ -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)
};
}

View File

@ -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()

View File

@ -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)
};
}

View File

@ -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)
};
}

View File

@ -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

View File

@ -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)
};

View File

@ -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)
};
}

View File

@ -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)
};
}

View File

@ -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<QString, QVariant>& settings);
@ -76,6 +77,9 @@ public:
protected:
bool readOnly;
int typeForParent;
private:
Q_DISABLE_COPY(VStringProperty)
};
}

View File

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