refactoring qad widgets part 1
c++ cast, nullptr, forward declaration, agregate ui, connect to member functions, order and clear includes
This commit is contained in:
+37
-39
@@ -20,15 +20,14 @@
|
||||
#ifndef EVALSPINBOX_H
|
||||
#define EVALSPINBOX_H
|
||||
|
||||
#include <QAbstractSpinBox>
|
||||
#include <QMouseEvent>
|
||||
#include "qad_widgets_export.h"
|
||||
#include <QAbstractSpinBox>
|
||||
|
||||
|
||||
class QPIEvaluator;
|
||||
|
||||
|
||||
class QLabel;
|
||||
|
||||
|
||||
class QAD_WIDGETS_EXPORT EvalSpinBox: public QAbstractSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -40,8 +39,8 @@ class QAD_WIDGETS_EXPORT EvalSpinBox: public QAbstractSpinBox
|
||||
Q_PROPERTY(int precision READ precision WRITE setPrecision)
|
||||
|
||||
public:
|
||||
explicit EvalSpinBox(QWidget * parent = 0);
|
||||
~EvalSpinBox();
|
||||
explicit EvalSpinBox(QWidget * parent = nullptr);
|
||||
~EvalSpinBox() override;
|
||||
|
||||
double value() const;
|
||||
const QString & expression() const;
|
||||
@@ -51,20 +50,45 @@ public:
|
||||
bool isCleared() const;
|
||||
int precision() const {return precision_;}
|
||||
|
||||
virtual void stepBy(int steps);
|
||||
virtual void clear();
|
||||
virtual QSize sizeHint() const;
|
||||
void stepBy(int steps) override;
|
||||
void clear() override;
|
||||
QSize sizeHint() const override;
|
||||
|
||||
public slots:
|
||||
void setExpression(const QString & expr);
|
||||
void setValue(double val);
|
||||
void setDefaultText(const QString & t);
|
||||
void setClearButtonVisible(bool visible);
|
||||
void setCalculationVisible(bool visible);
|
||||
void setPrecision(int precision) {precision_ = precision;}
|
||||
|
||||
protected:
|
||||
QString text() const {return QAbstractSpinBox::text();}
|
||||
|
||||
virtual StepEnabled stepEnabled() const;
|
||||
virtual void focusInEvent(QFocusEvent *event);
|
||||
virtual void focusOutEvent(QFocusEvent *event);
|
||||
virtual void wheelEvent(QWheelEvent *event);
|
||||
StepEnabled stepEnabled() const override;
|
||||
void focusInEvent(QFocusEvent *event) override;
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
void stepByDouble(double steps);
|
||||
|
||||
private slots:
|
||||
void clearMouseRelease(QMouseEvent * e);
|
||||
void textChanged_(const QString & text);
|
||||
void setExpressionSlot();
|
||||
void resizeIcons();
|
||||
|
||||
signals:
|
||||
void valueChanged(double val);
|
||||
void cleared();
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject * o, QEvent * e) override;
|
||||
void resizeEvent(QResizeEvent * ) override;
|
||||
void changeEvent(QEvent * e) override;
|
||||
void statusPaintEvent();
|
||||
void cwPaintEvent();
|
||||
|
||||
QWidget * status;
|
||||
QWidget * cw;
|
||||
QPIEvaluator * eval;
|
||||
@@ -77,32 +101,6 @@ protected:
|
||||
QString dt;
|
||||
bool cw_visible, calc_visible;
|
||||
int precision_;
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void resizeEvent(QResizeEvent * );
|
||||
void changeEvent(QEvent * e);
|
||||
void statusPaintEvent();
|
||||
void cwPaintEvent();
|
||||
|
||||
private slots:
|
||||
void clearMouseRelease(QMouseEvent * e);
|
||||
void textChanged_(const QString & text);
|
||||
void setExpression_();
|
||||
void resizeIcons();
|
||||
|
||||
public slots:
|
||||
void setExpression(const QString & expr);
|
||||
void setValue(double val);
|
||||
void setDefaultText(const QString & t);
|
||||
void setClearButtonVisible(bool visible);
|
||||
void setCalculationVisible(bool visible);
|
||||
void setPrecision(int precision) {precision_ = precision;}
|
||||
|
||||
signals:
|
||||
void valueChanged(double val);
|
||||
void cleared();
|
||||
|
||||
};
|
||||
|
||||
#endif // EVALSPINBOX_H
|
||||
|
||||
Reference in New Issue
Block a user