From e3a049715ded2877682f7e9bd1f7e48a691e1b0e Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Thu, 17 Sep 2015 23:46:45 +0300 Subject: [PATCH] Replaced pointers by QPointers --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 25 +++++++++++-------------- src/app/valentina/mainwindow.h | 8 ++++---- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index af59bd5ea..fdac76a2c 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1184,28 +1184,25 @@ void MainWindow::SyncMeasurements() void MainWindow::ToolBarOption() { ui->toolBarOption->clear(); - if (mouseCoordinate != nullptr) + if (not mouseCoordinate.isNull()) { delete mouseCoordinate; - mouseCoordinate = nullptr; } - if (gradationHeights != nullptr) + if (not gradationHeights.isNull()) { delete gradationHeights; - gradationHeights = nullptr; } - if (gradationSizes != nullptr) + if (not gradationSizes.isNull()) { delete gradationSizes; - gradationSizes = nullptr; } if (not gradationHeightsLabel.isNull()) { - gradationHeightsLabel.clear(); + delete gradationHeightsLabel; } if (not gradationSizesLabel.isNull()) { - gradationSizesLabel.clear(); + delete gradationSizesLabel; } if (qApp->patternType() == MeasurementsType::Standard) @@ -1233,9 +1230,9 @@ void MainWindow::ToolBarOption() } //--------------------------------------------------------------------------------------------------------------------- -QComboBox *MainWindow::SetGradationList(QPointer &label, const QStringList &list) +QComboBox *MainWindow::SetGradationList(QLabel *label, const QStringList &list) { - ui->toolBarOption->addWidget(label.data()); + ui->toolBarOption->addWidget(label); QComboBox *comboBox = new QComboBox(this); comboBox->addItems(list); @@ -1809,10 +1806,7 @@ void MainWindow::ActionLayout(bool checked) actionDockWidgetToolOptions->setEnabled(false); undoAction->setEnabled(false); redoAction->setEnabled(false); - if (mouseCoordinate != nullptr) - { - mouseCoordinate->setText(""); - } + mouseCoordinate->setText(""); if (qApp->patternType() == MeasurementsType::Standard) { @@ -2356,6 +2350,9 @@ void MainWindow::New() VMainGraphicsView::NewSceneRect(sceneDetails, ui->view); AddPP(patternPieceName); + + mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(doc->UnitsToStr(qApp->patternUnit(), true))); + ui->toolBarOption->addWidget(mouseCoordinate); } else { diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 436d5e0c5..a71b6639e 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -193,7 +193,7 @@ private: VMainGraphicsScene *sceneDetails; /** @brief mouseCoordinate pointer to label who show mouse coordinate. */ - QLabel *mouseCoordinate; + QPointer mouseCoordinate; /** @brief helpLabel help show tooltip. */ QLabel *helpLabel; @@ -228,8 +228,8 @@ private: QLabel *rightGoToStage; QTimer *autoSaveTimer; bool guiEnabled; - QComboBox *gradationHeights; - QComboBox *gradationSizes; + QPointer gradationHeights; + QPointer gradationSizes; QPointer gradationHeightsLabel; QPointer gradationSizesLabel; VToolOptionsPropertyBrowser *toolOptions; @@ -279,7 +279,7 @@ private: void InitAutoSave(); QString PatternPieceName(const QString &text); QString CheckPathToMeasurements(const QString &patternPath, const QString &path); - QComboBox *SetGradationList(QPointer &label, const QStringList &list); + QComboBox *SetGradationList(QLabel *label, const QStringList &list); void ChangePP(int index, bool zoomBestFit = true); /** * @brief EndVisualization try show dialog after and working with tool visualization.