GCC warnings.

--HG--
branch : develop
This commit is contained in:
dismine 2014-09-11 17:15:49 +03:00
parent 1d4f0a6a55
commit e4bf36e68e
18 changed files with 64 additions and 61 deletions

View File

@ -79,7 +79,7 @@ bool VFormula::operator==(const VFormula &formula) const
if (this->formula == formula.getFormula() && this->value == formula.getStringValue() && if (this->formula == formula.getFormula() && this->value == formula.getStringValue() &&
this->checkZero == formula.getCheckZero() && this->data == formula.getData() && this->checkZero == formula.getCheckZero() && this->data == formula.getData() &&
this->toolId == formula.getToolId() && this->postfix == formula.getPostfix() && this->toolId == formula.getToolId() && this->postfix == formula.getPostfix() &&
this->_error == formula.error() && this->dValue == formula.getDoubleValue()) this->_error == formula.error() && qFuzzyCompare(this->dValue, formula.getDoubleValue()))
{ {
isEqual = true; isEqual = true;
} }

View File

@ -67,7 +67,7 @@ MainWindow::MainWindow(QWidget *parent)
comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
currentToolBoxIndex(0), drawMode(true), recentFileActs{nullptr, nullptr, nullptr, nullptr, nullptr}, currentToolBoxIndex(0), drawMode(true), recentFileActs{nullptr, nullptr, nullptr, nullptr, nullptr},
separatorAct(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr), separatorAct(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr),
gradationSizes(nullptr) gradationSizes(nullptr), toolOptions(nullptr)
{ {
CreateActions(); CreateActions();
CreateMenus(); CreateMenus();

View File

@ -113,7 +113,11 @@ void VisToolSplinePath::setMode(const Mode &value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGraphicsEllipseItem *VisToolSplinePath::getPoint(unsigned int i) QGraphicsEllipseItem *VisToolSplinePath::getPoint(unsigned int i)
{ {
if (points.size() - 1 >= i && points.isEmpty() == false) if (points.size() == 0)
{
nullptr;
}
else if (static_cast<unsigned int>(points.size() - 1) >= i && points.isEmpty() == false)
{ {
return points.at(i); return points.at(i);
} }

View File

@ -41,8 +41,8 @@ using namespace VPE;
// VFormulaPropertyEditor // VFormulaPropertyEditor
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent) : VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
QWidget(parent) : QWidget(parent), formula(VFormula()), ToolButton(nullptr), TextLabel(nullptr), Spacer(nullptr)
{ {
setAutoFillBackground(true); setAutoFillBackground(true);

View File

@ -68,6 +68,7 @@ private slots:
void onToolButtonClicked(); void onToolButtonClicked();
private: private:
Q_DISABLE_COPY(VFormulaPropertyEditor)
VFormula formula; VFormula formula;
QToolButton* ToolButton; QToolButton* ToolButton;
QLabel* TextLabel; QLabel* TextLabel;

View File

@ -41,12 +41,11 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
GraphicsViewZoom::GraphicsViewZoom(QGraphicsView* view) GraphicsViewZoom::GraphicsViewZoom(QGraphicsView* view)
: QObject(view), _view(view), _numScheduledScalings(0) : QObject(view), _view(view), _modifiers(Qt::ControlModifier), _zoom_factor_base(1.0015),
target_scene_pos(QPointF()), target_viewport_pos(QPointF()), _numScheduledScalings(0)
{ {
_view->viewport()->installEventFilter(this); _view->viewport()->installEventFilter(this);
_view->setMouseTracking(true); _view->setMouseTracking(true);
_modifiers = Qt::ControlModifier;
_zoom_factor_base = 1.0015;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -79,7 +79,7 @@ private:
QGraphicsView* _view; QGraphicsView* _view;
Qt::KeyboardModifiers _modifiers; Qt::KeyboardModifiers _modifiers;
double _zoom_factor_base; double _zoom_factor_base;
QPointF target_scene_pos; QPointF target_scene_pos;
QPointF target_viewport_pos; QPointF target_viewport_pos;
bool eventFilter(QObject* object, QEvent* event); bool eventFilter(QObject* object, QEvent* event);

View File

@ -43,8 +43,7 @@ using namespace VPE;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent) VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
:QObject(parent), :QObject(parent), PropertyModel(nullptr), formView(nullptr), currentItem(nullptr),
currentItem(nullptr),
propertyToId(QMap<VProperty *, QString>()), propertyToId(QMap<VProperty *, QString>()),
idToProperty(QMap<QString, VProperty *>()) idToProperty(QMap<QString, VProperty *>())
{ {
@ -58,7 +57,7 @@ VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
parent->setWidget(scroll); parent->setWidget(scroll);
connect(PropertyModel, SIGNAL(onDataChangedByEditor(VProperty*)), this, SLOT(userChangedData(VProperty*))); connect(PropertyModel, &VPropertyModel::onDataChangedByEditor, this, &VToolOptionsPropertyBrowser::userChangedData);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -326,6 +326,23 @@ public:
return m_pCallback->GetAssociativity(); return m_pCallback->GetAssociativity();
} }
//------------------------------------------------------------------------------
template < class FunctionPtr >
FunctionPtr union_cast( void* objectPtr ) const
{
union
{
void* obj;
FunctionPtr func;
} var;
Q_STATIC_ASSERT_X(sizeof(void *) == sizeof(void (*)(void)),
"object pointer and function pointer sizes must equal");
var.obj = objectPtr;
return var.func;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* @brief Return the address of the callback function assoziated with function and operator tokens. * @brief Return the address of the callback function assoziated with function and operator tokens.
@ -343,8 +360,8 @@ public:
*/ */
generic_fun_type GetFuncAddr() const generic_fun_type GetFuncAddr() const
{ {
return ( m_pCallback.get() ) ? reinterpret_cast<generic_fun_type> ( m_pCallback->GetAddr() ) : return ( union_cast<generic_fun_type>( m_pCallback.get() ) ) ?
reinterpret_cast<generic_fun_type> (0); union_cast<generic_fun_type>( m_pCallback->GetAddr() ) : union_cast<generic_fun_type>(0);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -32,16 +32,12 @@ struct VPROPERTYEXPLORERSHARED_EXPORT Vector3D
{ {
public: public:
Vector3D() Vector3D()
{ :X(0), Y(0), Z(0)
X = Y = Z = 0; {}
}
Vector3D(const Vector3D& other) Vector3D(const Vector3D& other)
{ :X(other.X), Y(other.Y), Z(other.Z)
X = other.X; {}
Y = other.Y;
Z = other.Z;
}
~Vector3D() {} ~Vector3D() {}

View File

@ -80,26 +80,19 @@ QVariant VIntegerProperty::getEditorData(QWidget* editor) const
return QVariant(0); return QVariant(0);
} }
void VIntegerProperty::setSettings(int minimum, int maxiumum, int singleStep)
{
minValue = minimum;
maxValue = maxiumum;
this->singleStep = singleStep;
}
void VIntegerProperty::setSetting(const QString& key, const QVariant& value) void VIntegerProperty::setSetting(const QString& key, const QVariant& value)
{ {
if (key == QLatin1String("Min")) if (key == QLatin1String("Min"))
{ {
setSettings(value.toInt(), maxValue); maxValue = value.toInt();
} }
else if (key == QLatin1String("Max")) else if (key == QLatin1String("Max"))
{ {
setSettings(minValue, value.toInt()); minValue = value.toInt();
} }
else if (key == QLatin1String("Step")) else if (key == QLatin1String("Step"))
{ {
setSettings(singleStep, value.toInt()); singleStep = value.toInt();
} }
} }
@ -194,31 +187,23 @@ QVariant VDoubleProperty::getEditorData(QWidget* editor) const
return QVariant(0); return QVariant(0);
} }
void VDoubleProperty::setSettings(double minimum, double maxiumum, double singleStep, int precision)
{
minValue = minimum;
maxValue = maxiumum;
this->singleStep = singleStep;
Precision = precision;
}
void VDoubleProperty::setSetting(const QString& key, const QVariant& value) void VDoubleProperty::setSetting(const QString& key, const QVariant& value)
{ {
if (key == QLatin1String("Min")) if (key == QLatin1String("Min"))
{ {
setSettings(value.toDouble(), maxValue, singleStep, Precision); minValue = value.toDouble();
} }
else if (key == QLatin1String("Max")) else if (key == QLatin1String("Max"))
{ {
setSettings(minValue, value.toDouble(), singleStep, Precision); maxValue = value.toDouble();
} }
else if (key == QLatin1String("Step")) else if (key == QLatin1String("Step"))
{ {
setSettings(minValue, maxValue, value.toDouble(), Precision); singleStep = value.toDouble();
} }
else if (key == QLatin1String("Precision")) else if (key == QLatin1String("Precision"))
{ {
setSettings(minValue, maxValue, singleStep, value.toDouble()); Precision = value.toDouble();
} }
} }

View File

@ -48,11 +48,6 @@ public:
//! Gets the data from the widget //! Gets the data from the widget
virtual QVariant getEditorData(QWidget* editor) const; virtual QVariant getEditorData(QWidget* editor) const;
//! Sets the settings of a basic integer property
//! \param minimum The minimum value
//! \param maxiumum The maximum value
virtual void setSettings(int minimum, int maxiumum, int singleStep = 1.0);
//! Sets the settings. Available settings: //! Sets the settings. Available settings:
//! //!
//! key: "Min" - value: Minimum number as integer //! key: "Min" - value: Minimum number as integer
@ -104,12 +99,6 @@ public:
//! Gets the data from the widget //! Gets the data from the widget
virtual QVariant getEditorData(QWidget* editor) const; virtual QVariant getEditorData(QWidget* editor) const;
//! Sets the settings of a double property
//! \param minimum The minimum value
//! \param maxiumum The maximum value
//! \param precision The number of decimal places
virtual void setSettings(double minimum, double maxiumum, double singleStep, int precision);
//! Sets the settings. Available settings: //! Sets the settings. Available settings:
//! //!
//! key: "Min" - value: Minimum number as integer //! key: "Min" - value: Minimum number as integer

View File

@ -411,5 +411,6 @@ void VProperty::UpdateParent(const QVariant &value)
void VProperty::ValueChildChanged(const QVariant &value, int typeForParent) void VProperty::ValueChildChanged(const QVariant &value, int typeForParent)
{ {
Q_UNUSED(value)
Q_UNUSED(typeForParent)
} }

View File

@ -40,7 +40,7 @@ static const int MyCustomEventType = 1099;
class UserChangeEvent : public QEvent class UserChangeEvent : public QEvent
{ {
public: public:
UserChangeEvent() : QEvent((QEvent::Type)MyCustomEventType) {} UserChangeEvent() : QEvent(static_cast<QEvent::Type>(MyCustomEventType)) {}
}; };
class VPropertyPrivate; class VPropertyPrivate;
@ -210,6 +210,7 @@ protected:
private: private:
// Provide access functions for the d_ptr // Provide access functions for the d_ptr
Q_DECLARE_PRIVATE(VProperty) Q_DECLARE_PRIVATE(VProperty)
Q_DISABLE_COPY(VProperty)
}; };
} }

View File

@ -69,15 +69,19 @@ public:
//! Constructor passing name and type //! Constructor passing name and type
VPropertyPrivate(const QString& name, QVariant::Type type) VPropertyPrivate(const QString& name, QVariant::Type type)
: VariantValue(type), Name(name), PropertyVariantType(type), UpdateParent(false), UpdateChildren(false), : VariantValue(type), Name(name), Description(QString()), IsEmpty(false), PropertyVariantType(type),
Parent(nullptr), editor(nullptr), type(Property::Simple) UpdateParent(false), UpdateChildren(false), Parent(nullptr), editor(nullptr), type(Property::Simple),
Children(QList<VProperty*>())
{} {}
//! Constructor //! Constructor
VPropertyPrivate() VPropertyPrivate()
: VariantValue(), Name(), PropertyVariantType(QVariant::Invalid), UpdateParent(false), UpdateChildren(false), : VariantValue(), Name(), Description(QString()), IsEmpty(false), PropertyVariantType(QVariant::Invalid),
Parent(nullptr), editor(nullptr) UpdateParent(false), UpdateChildren(false), Parent(nullptr), editor(nullptr), type(Property::Simple),
Children(QList<VProperty*>())
{} {}
private:
Q_DISABLE_COPY(VPropertyPrivate)
}; };
} }

View File

@ -136,6 +136,8 @@ void VPropertyFormView::modelDestroyed()
void VPropertyFormView::dataChanged(const QModelIndex &top_left, const QModelIndex &bottom_right) void VPropertyFormView::dataChanged(const QModelIndex &top_left, const QModelIndex &bottom_right)
{ {
Q_UNUSED(top_left)
Q_UNUSED(bottom_right)
if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->IgnoreDataChangedSignal) if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->IgnoreDataChangedSignal)
{ {
return; return;

View File

@ -93,6 +93,8 @@ protected:
//! Commits data of an editor //! Commits data of an editor
void commitData(QWidget* editor); void commitData(QWidget* editor);
private:
Q_DISABLE_COPY(VPropertyFormWidget)
}; };
} // Namespace VPE } // Namespace VPE

View File

@ -159,6 +159,9 @@ protected:
//! The model data //! The model data
VPropertyModelPrivate* d_ptr; VPropertyModelPrivate* d_ptr;
private:
Q_DISABLE_COPY(VPropertyModel)
}; };
} }