summaryrefslogtreecommitdiffstats
path: root/examples/activeqt/multiple
diff options
context:
space:
mode:
authorAndre de la Rocha <andre.rocha@qt.io>2017-08-21 13:23:48 +0200
committerAndre de la Rocha <andre.rocha@qt.io>2017-08-23 11:01:43 +0000
commitc2751b1d664748cfbd05d2e397f95f2cc0bec13f (patch)
tree6a7a884caf28250927ee66f395e0634470ac0851 /examples/activeqt/multiple
parentb3e88744f36144db7cda0b85c161cdb10026eb65 (diff)
Active Qt Examples: Brush up to C++ 11
Use nullptr, member initialization, new connect syntax, QStringLiteral, etc. Change-Id: Ia79473ca302216f91eec6a32f670cf606761ed0d Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples/activeqt/multiple')
-rw-r--r--examples/activeqt/multiple/ax1.h13
-rw-r--r--examples/activeqt/multiple/ax2.h27
2 files changed, 21 insertions, 19 deletions
diff --git a/examples/activeqt/multiple/ax1.h b/examples/activeqt/multiple/ax1.h
index 286645f..2cd6b33 100644
--- a/examples/activeqt/multiple/ax1.h
+++ b/examples/activeqt/multiple/ax1.h
@@ -54,18 +54,19 @@ class QAxWidget1 : public QWidget
Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor)
public:
- QAxWidget1(QWidget *parent = 0)
- : QWidget(parent), fill_color(Qt::red)
+ explicit QAxWidget1(QWidget *parent = nullptr)
+ : QWidget(parent), m_fillColor(Qt::red)
{
}
QColor fillColor() const
{
- return fill_color;
+ return m_fillColor;
}
+
void setFillColor(const QColor &fc)
{
- fill_color = fc;
+ m_fillColor = fc;
repaint();
}
@@ -75,11 +76,11 @@ protected:
QPainter paint(this);
QRect r = rect();
r.adjust(10, 10, -10, -10);
- paint.fillRect(r, fill_color);
+ paint.fillRect(r, m_fillColor);
}
private:
- QColor fill_color;
+ QColor m_fillColor;
};
//! [0]
diff --git a/examples/activeqt/multiple/ax2.h b/examples/activeqt/multiple/ax2.h
index 8b04653..211878c 100644
--- a/examples/activeqt/multiple/ax2.h
+++ b/examples/activeqt/multiple/ax2.h
@@ -55,38 +55,39 @@ class QAxWidget2 : public QWidget
Q_CLASSINFO("StockEvents", "yes")
Q_CLASSINFO("Insertable", "yes")
- Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
+ Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
public:
- QAxWidget2(QWidget *parent = 0)
- : QWidget(parent), line_width( 1 )
+ explicit QAxWidget2(QWidget *parent = nullptr)
+ : QWidget(parent), m_lineWidth(1)
{
}
int lineWidth() const
{
- return line_width;
+ return m_lineWidth;
}
- void setLineWidth( int lw )
+
+ void setLineWidth(int lw)
{
- line_width = lw;
+ m_lineWidth = lw;
repaint();
}
protected:
- void paintEvent( QPaintEvent *e )
+ void paintEvent(QPaintEvent *e)
{
- QPainter paint( this );
+ QPainter paint(this);
QPen pen = paint.pen();
- pen.setWidth( line_width );
- paint.setPen( pen );
+ pen.setWidth(m_lineWidth);
+ paint.setPen(pen);
QRect r = rect();
- r.adjust( 10, 10, -10, -10 );
- paint.drawEllipse( r );
+ r.adjust(10, 10, -10, -10);
+ paint.drawEllipse(r);
}
private:
- int line_width;
+ int m_lineWidth;
};
//! [0]