Replaced pointers by QPointers

--HG--
branch : develop
This commit is contained in:
Valentina Zhuravska 2015-09-17 23:46:45 +03:00
parent 07f928cba7
commit e3a049715d
2 changed files with 15 additions and 18 deletions

View File

@ -1184,28 +1184,25 @@ void MainWindow::SyncMeasurements()
void MainWindow::ToolBarOption() void MainWindow::ToolBarOption()
{ {
ui->toolBarOption->clear(); ui->toolBarOption->clear();
if (mouseCoordinate != nullptr) if (not mouseCoordinate.isNull())
{ {
delete mouseCoordinate; delete mouseCoordinate;
mouseCoordinate = nullptr;
} }
if (gradationHeights != nullptr) if (not gradationHeights.isNull())
{ {
delete gradationHeights; delete gradationHeights;
gradationHeights = nullptr;
} }
if (gradationSizes != nullptr) if (not gradationSizes.isNull())
{ {
delete gradationSizes; delete gradationSizes;
gradationSizes = nullptr;
} }
if (not gradationHeightsLabel.isNull()) if (not gradationHeightsLabel.isNull())
{ {
gradationHeightsLabel.clear(); delete gradationHeightsLabel;
} }
if (not gradationSizesLabel.isNull()) if (not gradationSizesLabel.isNull())
{ {
gradationSizesLabel.clear(); delete gradationSizesLabel;
} }
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
@ -1233,9 +1230,9 @@ void MainWindow::ToolBarOption()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QComboBox *MainWindow::SetGradationList(QPointer<QLabel> &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); QComboBox *comboBox = new QComboBox(this);
comboBox->addItems(list); comboBox->addItems(list);
@ -1809,10 +1806,7 @@ void MainWindow::ActionLayout(bool checked)
actionDockWidgetToolOptions->setEnabled(false); actionDockWidgetToolOptions->setEnabled(false);
undoAction->setEnabled(false); undoAction->setEnabled(false);
redoAction->setEnabled(false); redoAction->setEnabled(false);
if (mouseCoordinate != nullptr) mouseCoordinate->setText("");
{
mouseCoordinate->setText("");
}
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
{ {
@ -2356,6 +2350,9 @@ void MainWindow::New()
VMainGraphicsView::NewSceneRect(sceneDetails, ui->view); VMainGraphicsView::NewSceneRect(sceneDetails, ui->view);
AddPP(patternPieceName); AddPP(patternPieceName);
mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(doc->UnitsToStr(qApp->patternUnit(), true)));
ui->toolBarOption->addWidget(mouseCoordinate);
} }
else else
{ {

View File

@ -193,7 +193,7 @@ private:
VMainGraphicsScene *sceneDetails; VMainGraphicsScene *sceneDetails;
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */ /** @brief mouseCoordinate pointer to label who show mouse coordinate. */
QLabel *mouseCoordinate; QPointer<QLabel> mouseCoordinate;
/** @brief helpLabel help show tooltip. */ /** @brief helpLabel help show tooltip. */
QLabel *helpLabel; QLabel *helpLabel;
@ -228,8 +228,8 @@ private:
QLabel *rightGoToStage; QLabel *rightGoToStage;
QTimer *autoSaveTimer; QTimer *autoSaveTimer;
bool guiEnabled; bool guiEnabled;
QComboBox *gradationHeights; QPointer<QComboBox> gradationHeights;
QComboBox *gradationSizes; QPointer<QComboBox> gradationSizes;
QPointer<QLabel> gradationHeightsLabel; QPointer<QLabel> gradationHeightsLabel;
QPointer<QLabel> gradationSizesLabel; QPointer<QLabel> gradationSizesLabel;
VToolOptionsPropertyBrowser *toolOptions; VToolOptionsPropertyBrowser *toolOptions;
@ -279,7 +279,7 @@ private:
void InitAutoSave(); void InitAutoSave();
QString PatternPieceName(const QString &text); QString PatternPieceName(const QString &text);
QString CheckPathToMeasurements(const QString &patternPath, const QString &path); QString CheckPathToMeasurements(const QString &patternPath, const QString &path);
QComboBox *SetGradationList(QPointer<QLabel> &label, const QStringList &list); QComboBox *SetGradationList(QLabel *label, const QStringList &list);
void ChangePP(int index, bool zoomBestFit = true); void ChangePP(int index, bool zoomBestFit = true);
/** /**
* @brief EndVisualization try show dialog after and working with tool visualization. * @brief EndVisualization try show dialog after and working with tool visualization.