Modernize-use-nullptr refactors code

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5008 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2017-08-05 02:06:59 +00:00
parent 876d05a338
commit 9f9b127c04
187 changed files with 438 additions and 438 deletions

View File

@@ -74,12 +74,12 @@ class ConductorXmlRetroCompatibility
*/
Conductor::Conductor(Terminal *p1, Terminal* p2) :
QObject(),
QGraphicsPathItem(0),
QGraphicsPathItem(nullptr),
terminal1(p1),
terminal2(p2),
m_mouse_over(false),
m_text_item(0),
segments(NULL),
m_text_item(nullptr),
segments(nullptr),
m_moving_segment(false),
modified_path(false),
has_to_save_profile(false),
@@ -178,7 +178,7 @@ void Conductor::segmentsToPath()
{
QPainterPath path;
if (segments == NULL)
if (segments == nullptr)
setPath(path);
//Start the path
@@ -913,7 +913,7 @@ QList<QPointF> Conductor::segmentsToPoints() const {
QList<QPointF> points_list;
// on retourne la liste tout de suite s'il n'y a pas de segments
if (segments == NULL) return(points_list);
if (segments == nullptr) return(points_list);
// recupere le premier point
points_list << segments -> firstPoint();
@@ -941,7 +941,7 @@ void Conductor::pointsToSegments(QList<QPointF> points_list) {
deleteSegments();
// cree les segments a partir de la liste de points
ConductorSegment *last_segment = NULL;
ConductorSegment *last_segment = nullptr;
for (int i = 0 ; i < points_list.size() - 1 ; ++ i) {
last_segment = new ConductorSegment(points_list.at(i), points_list.at(i + 1), last_segment);
if (!i) segments = last_segment;
@@ -956,8 +956,8 @@ void Conductor::pointsToSegments(QList<QPointF> points_list) {
*/
bool Conductor::fromXml(QDomElement &dom_element)
{
setPos(dom_element.attribute("x", 0).toDouble(),
dom_element.attribute("y", 0).toDouble());
setPos(dom_element.attribute("x", nullptr).toDouble(),
dom_element.attribute("y", nullptr).toDouble());
bool return_ = pathFromXml(dom_element);
@@ -1123,7 +1123,7 @@ QVector<QPointF> Conductor::handlerPoints() const
/// @return les segments de ce conducteur
const QList<ConductorSegment *> Conductor::segmentsList() const {
if (segments == NULL) return(QList<ConductorSegment *>());
if (segments == nullptr) return(QList<ConductorSegment *>());
QList<ConductorSegment *> segments_vector;
ConductorSegment *segment = segments;
@@ -1148,7 +1148,7 @@ qreal Conductor::length() const{
@return Le segment qui contient le point au milieu du conducteur
*/
ConductorSegment *Conductor::middleSegment() {
if (segments == NULL) return(NULL);
if (segments == nullptr) return(nullptr);
qreal half_length = length() / 2.0;
@@ -1532,7 +1532,7 @@ void Conductor::displayedTextChanged()
*/
QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram, QList <Terminal *> *t_list) {
bool declar_t_list = false;
if (t_list == 0) {
if (t_list == nullptr) {
declar_t_list = true;
t_list = new QList <Terminal *>;
}
@@ -1802,10 +1802,10 @@ void Conductor::setProfiles(const ConductorProfilesGroup &cpg) {
/// Supprime les segments
void Conductor::deleteSegments() {
if (segments != NULL) {
if (segments != nullptr) {
while (segments -> hasNextSegment()) delete segments -> nextSegment();
delete segments;
segments = NULL;
segments = nullptr;
}
}

View File

@@ -113,7 +113,7 @@ class Conductor : public QObject, public QGraphicsPathItem
void calculateTextItemPosition();
virtual Highlight highlight() const;
virtual void setHighlighted(Highlight);
QSet<Conductor *> relatedPotentialConductors(const bool all_diagram = true, QList <Terminal *> *t_list=0);
QSet<Conductor *> relatedPotentialConductors(const bool all_diagram = true, QList <Terminal *> *t_list=nullptr);
QETDiagramEditor* diagramEditor() const;
void editProperty ();

View File

@@ -32,8 +32,8 @@ class ConductorTextItem : public DiagramTextItem
// constructors, destructor
public:
ConductorTextItem(Conductor * = 0);
ConductorTextItem(const QString &, Conductor * = 0);
ConductorTextItem(Conductor * = nullptr);
ConductorTextItem(const QString &, Conductor * = nullptr);
virtual ~ConductorTextItem();
private:
ConductorTextItem(const ConductorTextItem &);

View File

@@ -692,7 +692,7 @@ ElementTextItem *CustomElement::parseInput(QDomElement &e) {
!QET::attributeIsAReal(e, "x", &pos_x) ||\
!QET::attributeIsAReal(e, "y", &pos_y) ||\
!QET::attributeIsAnInteger(e, "size", &size)
) return(0);
) return(nullptr);
ElementTextItem *eti = new ElementTextItem(e.attribute("text"), this);
eti -> setFont(QETApp::diagramTextsFont(size));
@@ -733,14 +733,14 @@ Terminal *CustomElement::parseTerminal(QDomElement &e) {
// verifie la presence et la validite des attributs obligatoires
qreal terminalx, terminaly;
Qet::Orientation terminalo;
if (!QET::attributeIsAReal(e, QString("x"), &terminalx)) return(0);
if (!QET::attributeIsAReal(e, QString("y"), &terminaly)) return(0);
if (!e.hasAttribute("orientation")) return(0);
if (!QET::attributeIsAReal(e, QString("x"), &terminalx)) return(nullptr);
if (!QET::attributeIsAReal(e, QString("y"), &terminaly)) return(nullptr);
if (!e.hasAttribute("orientation")) return(nullptr);
if (e.attribute("orientation") == "n") terminalo = Qet::North;
else if (e.attribute("orientation") == "s") terminalo = Qet::South;
else if (e.attribute("orientation") == "e") terminalo = Qet::East;
else if (e.attribute("orientation") == "w") terminalo = Qet::West;
else return(0);
else return(nullptr);
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
new_terminal -> setZValue(420); // valeur arbitraire pour maintenir les bornes au-dessus des champs de texte
list_terminals << new_terminal;
@@ -991,5 +991,5 @@ ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
foreach (ElementTextItem *eti, list_texts_) {
if (eti -> tagg() == tagg) return eti;
}
return NULL;
return nullptr;
}

View File

@@ -36,7 +36,7 @@ class CustomElement : public FixedElement
// constructors, destructor
public:
CustomElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
CustomElement (const ElementsLocation &, QGraphicsItem * = nullptr, int * = nullptr);
virtual ~CustomElement();
@@ -78,7 +78,7 @@ class CustomElement : public FixedElement
ElementTextItem* taggedText(const QString &tagg) const;
protected:
virtual bool buildFromXml(const QDomElement &, int * = 0);
virtual bool buildFromXml(const QDomElement &, int * = nullptr);
virtual bool parseElement(QDomElement &, QPainter &);
virtual bool parseLine(QDomElement &, QPainter &);
virtual bool parseRect(QDomElement &, QPainter &);

View File

@@ -33,8 +33,8 @@ class DiagramImageItem : public QetGraphicsItem {
// constructors, destructor
public:
DiagramImageItem(QetGraphicsItem * = 0);
DiagramImageItem(const QPixmap &pixmap, QetGraphicsItem * = 0);
DiagramImageItem(QetGraphicsItem * = nullptr);
DiagramImageItem(const QPixmap &pixmap, QetGraphicsItem * = nullptr);
virtual ~DiagramImageItem();
// attributes

View File

@@ -41,8 +41,8 @@ class DiagramTextItem : public QGraphicsTextItem
void colorChanged(QColor color);
public:
DiagramTextItem(QGraphicsItem * = 0);
DiagramTextItem(const QString &, QGraphicsItem * = 0);
DiagramTextItem(QGraphicsItem * = nullptr);
DiagramTextItem(const QString &, QGraphicsItem * = nullptr);
private:
void build();

View File

@@ -337,7 +337,7 @@ void Element::updatePixmap() {
// Translation de l'origine du repere de la pixmap
p.translate(hotspot_coord);
// L'element se dessine sur la pixmap
paint(&p, 0);
paint(&p, nullptr);
}
/**

View File

@@ -41,7 +41,7 @@ class Element : public QetGraphicsItem
// constructors, destructor
public:
Element(QGraphicsItem * = 0);
Element(QGraphicsItem * = nullptr);
virtual ~Element();
private:
Element(const Element &);

View File

@@ -31,8 +31,8 @@ class ElementTextItem : public DiagramTextItem {
Q_OBJECT
// constructors, destructor
public:
ElementTextItem(Element * = 0);
ElementTextItem(const QString &, Element * = 0);
ElementTextItem(Element * = nullptr);
ElementTextItem(const QString &, Element * = nullptr);
virtual ~ElementTextItem();
// attributes

View File

@@ -29,7 +29,7 @@ class FixedElement : public Element {
// constructors, destructor
public:
FixedElement(QGraphicsItem * = 0);
FixedElement(QGraphicsItem * = nullptr);
virtual ~FixedElement();
// methods

View File

@@ -36,7 +36,7 @@ class GhostElement : public CustomElement {
// constructor, destructor
public:
GhostElement(const ElementsLocation &, QGraphicsItem * = 0);
GhostElement(const ElementsLocation &, QGraphicsItem * = nullptr);
virtual ~GhostElement();
// methods

View File

@@ -23,7 +23,7 @@
@param parent_diagram Le schema auquel est rattache le champ de texte
*/
IndependentTextItem::IndependentTextItem() :
DiagramTextItem(0)
DiagramTextItem(nullptr)
{}
/**
@@ -32,7 +32,7 @@ IndependentTextItem::IndependentTextItem() :
@param parent_diagram Le schema auquel est rattache le champ de texte
*/
IndependentTextItem::IndependentTextItem(const QString &text) :
DiagramTextItem(text, 0)
DiagramTextItem(text, nullptr)
{}
/// Destructeur

View File

@@ -33,7 +33,7 @@ class MasterElement : public CustomElement
Q_OBJECT
public:
explicit MasterElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
explicit MasterElement(const ElementsLocation &, QGraphicsItem * = nullptr, int * = nullptr);
~MasterElement();
virtual void linkToElement (Element *elmt);

View File

@@ -28,7 +28,7 @@ class QetGraphicsItem : public QGraphicsObject
public:
//constructor destructor
QetGraphicsItem(QGraphicsItem *parent = 0);
QetGraphicsItem(QGraphicsItem *parent = nullptr);
virtual ~QetGraphicsItem() = 0;
//public methode

View File

@@ -606,14 +606,14 @@ bool QetShapeItem::fromXml(const QDomElement &e)
if (m_shapeType != Polygon)
{
m_P1.setX(e.attribute("x1", 0).toDouble());
m_P1.setY(e.attribute("y1", 0).toDouble());
m_P2.setX(e.attribute("x2", 0).toDouble());
m_P2.setY(e.attribute("y2", 0).toDouble());
m_P1.setX(e.attribute("x1", nullptr).toDouble());
m_P1.setY(e.attribute("y1", nullptr).toDouble());
m_P2.setX(e.attribute("x2", nullptr).toDouble());
m_P2.setY(e.attribute("y2", nullptr).toDouble());
}
else
foreach(QDomElement de, QET::findInDomElement(e, "points", "point"))
m_polygon << QPointF(de.attribute("x", 0).toDouble(), de.attribute("y", 0).toDouble());
m_polygon << QPointF(de.attribute("x", nullptr).toDouble(), de.attribute("y", nullptr).toDouble());
return (true);
}

View File

@@ -56,7 +56,7 @@ class QetShapeItem : public QetGraphicsItem
enum { Type = UserType + 1008 };
QetShapeItem(QPointF, QPointF = QPointF(0,0), ShapeType = Line, QGraphicsItem *parent = 0);
QetShapeItem(QPointF, QPointF = QPointF(0,0), ShapeType = Line, QGraphicsItem *parent = nullptr);
virtual ~QetShapeItem();
//Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a QetShapeItem @return the QGraphicsItem type

View File

@@ -59,7 +59,7 @@ ReportElement::~ReportElement()
{
unlinkAllElements();
if (terminals().size())
disconnect(terminals().first(), 0, 0, 0);
disconnect(terminals().first(), nullptr, nullptr, nullptr);
if (m_watched_conductor)
disconnect(m_watched_conductor, &Conductor::propertiesChange, this, &ReportElement::updateLabel);
}

View File

@@ -32,7 +32,7 @@ class ReportElement : public CustomElement
Q_OBJECT
public :
explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, int * = 0);
explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = nullptr, int * = nullptr);
~ReportElement();
virtual void linkToElement(Element *);
virtual void unlinkAllElements();

View File

@@ -32,7 +32,7 @@ class SimpleElement : public CustomElement {
Q_OBJECT
public :
explicit SimpleElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
explicit SimpleElement(const ElementsLocation &, QGraphicsItem * = nullptr, int * = nullptr);
~SimpleElement();
virtual void initLink(QETProject *project);

View File

@@ -110,7 +110,7 @@ void SlaveElement::unlinkElement(Element *elmt)
disconnect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel()));
disconnect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel()));
delete m_xref_item; m_xref_item = NULL;
delete m_xref_item; m_xref_item = nullptr;
if (ElementTextItem *eti = this->taggedText("label"))
eti->setPlainText("_");

View File

@@ -25,7 +25,7 @@ class SlaveElement : public CustomElement
{
Q_OBJECT
public:
explicit SlaveElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
explicit SlaveElement (const ElementsLocation &, QGraphicsItem * = nullptr, int * = nullptr);
~SlaveElement();
virtual void linkToElement(Element *elmt);
virtual void unlinkAllElements();

View File

@@ -62,7 +62,7 @@ void Terminal::init(QPointF pf, Qet::Orientation o, QString number, QString name
// QRectF null
br_ = new QRectF();
previous_terminal_ = 0;
previous_terminal_ = nullptr;
// divers
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::LeftButton);
@@ -559,7 +559,7 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
*/
void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
{
previous_terminal_ = 0;
previous_terminal_ = nullptr;
hovered_color_ = neutralColor;
if (!diagram()) return;

View File

@@ -37,9 +37,9 @@ class Terminal : public QGraphicsObject
// constructors, destructor
public:
Terminal(QPointF, Qet::Orientation, Element * = 0);
Terminal(qreal, qreal, Qet::Orientation, Element * = 0);
Terminal(QPointF, Qet::Orientation, QString number, QString name, bool hiddenName, Element * = 0);
Terminal(QPointF, Qet::Orientation, Element * = nullptr);
Terminal(qreal, qreal, Qet::Orientation, Element * = nullptr);
Terminal(QPointF, Qet::Orientation, QString number, QString name, bool hiddenName, Element * = nullptr);
virtual ~Terminal();
private:

View File

@@ -27,7 +27,7 @@ class TerminalElement : public CustomElement
{
Q_OBJECT
public:
TerminalElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
TerminalElement(const ElementsLocation &, QGraphicsItem * = nullptr, int * = nullptr);
~TerminalElement();
virtual void initLink(QETProject *project);