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()
{
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<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);
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
{

View file

@ -193,7 +193,7 @@ private:
VMainGraphicsScene *sceneDetails;
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
QLabel *mouseCoordinate;
QPointer<QLabel> mouseCoordinate;
/** @brief helpLabel help show tooltip. */
QLabel *helpLabel;
@ -228,8 +228,8 @@ private:
QLabel *rightGoToStage;
QTimer *autoSaveTimer;
bool guiEnabled;
QComboBox *gradationHeights;
QComboBox *gradationSizes;
QPointer<QComboBox> gradationHeights;
QPointer<QComboBox> gradationSizes;
QPointer<QLabel> gradationHeightsLabel;
QPointer<QLabel> 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<QLabel> &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.