Operator new throw exception bad_alloc, so does not make sense to use
Q_CHECK_PTR macros for check. --HG-- branch : feature
This commit is contained in:
parent
e3f412567e
commit
db2a3e9ca9
|
@ -65,7 +65,6 @@ public:
|
||||||
void CopyGObject(const VContainer &data, const quint32 &id)
|
void CopyGObject(const VContainer &data, const quint32 &id)
|
||||||
{
|
{
|
||||||
T *obj = new T(*data.GeometricObject<const T *>(id));
|
T *obj = new T(*data.GeometricObject<const T *>(id));
|
||||||
Q_CHECK_PTR(obj);
|
|
||||||
UpdateGObject(id, obj);
|
UpdateGObject(id, obj);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,6 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr)
|
QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr)
|
||||||
{
|
{
|
||||||
contentsWidget = new QListWidget;
|
contentsWidget = new QListWidget;
|
||||||
Q_CHECK_PTR(contentsWidget);
|
|
||||||
contentsWidget->setViewMode(QListView::IconMode);
|
contentsWidget->setViewMode(QListView::IconMode);
|
||||||
contentsWidget->setIconSize(QSize(96, 84));
|
contentsWidget->setIconSize(QSize(96, 84));
|
||||||
contentsWidget->setMovement(QListView::Static);
|
contentsWidget->setMovement(QListView::Static);
|
||||||
|
@ -41,20 +40,14 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
contentsWidget->setSpacing(12);
|
contentsWidget->setSpacing(12);
|
||||||
|
|
||||||
pagesWidget = new QStackedWidget;
|
pagesWidget = new QStackedWidget;
|
||||||
Q_CHECK_PTR(pagesWidget);
|
|
||||||
configurationPage = new ConfigurationPage();
|
configurationPage = new ConfigurationPage();
|
||||||
Q_CHECK_PTR(configurationPage);
|
|
||||||
pagesWidget->addWidget(configurationPage);
|
pagesWidget->addWidget(configurationPage);
|
||||||
patternPage = new PatternPage();
|
patternPage = new PatternPage();
|
||||||
Q_CHECK_PTR(patternPage);
|
|
||||||
pagesWidget->addWidget(patternPage);
|
pagesWidget->addWidget(patternPage);
|
||||||
|
|
||||||
QPushButton *applyButton = new QPushButton(tr("Apply"));
|
QPushButton *applyButton = new QPushButton(tr("Apply"));
|
||||||
Q_CHECK_PTR(applyButton);
|
|
||||||
QPushButton *canselButton = new QPushButton(tr("&Cancel"));
|
QPushButton *canselButton = new QPushButton(tr("&Cancel"));
|
||||||
Q_CHECK_PTR(canselButton);
|
|
||||||
QPushButton *okButton = new QPushButton(tr("&Ok"));
|
QPushButton *okButton = new QPushButton(tr("&Ok"));
|
||||||
Q_CHECK_PTR(okButton);
|
|
||||||
|
|
||||||
createIcons();
|
createIcons();
|
||||||
contentsWidget->setCurrentRow(0);
|
contentsWidget->setCurrentRow(0);
|
||||||
|
@ -64,19 +57,16 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
connect(okButton, &QPushButton::clicked, this, &ConfigDialog::Ok);
|
connect(okButton, &QPushButton::clicked, this, &ConfigDialog::Ok);
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout;
|
QHBoxLayout *horizontalLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(horizontalLayout);
|
|
||||||
horizontalLayout->addWidget(contentsWidget);
|
horizontalLayout->addWidget(contentsWidget);
|
||||||
horizontalLayout->addWidget(pagesWidget, 1);
|
horizontalLayout->addWidget(pagesWidget, 1);
|
||||||
|
|
||||||
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(buttonsLayout);
|
|
||||||
buttonsLayout->addStretch(1);
|
buttonsLayout->addStretch(1);
|
||||||
buttonsLayout->addWidget(applyButton);
|
buttonsLayout->addWidget(applyButton);
|
||||||
buttonsLayout->addWidget(canselButton);
|
buttonsLayout->addWidget(canselButton);
|
||||||
buttonsLayout->addWidget(okButton);
|
buttonsLayout->addWidget(okButton);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
Q_CHECK_PTR(mainLayout);
|
|
||||||
mainLayout->addLayout(horizontalLayout);
|
mainLayout->addLayout(horizontalLayout);
|
||||||
mainLayout->addStretch(1);
|
mainLayout->addStretch(1);
|
||||||
mainLayout->addSpacing(12);
|
mainLayout->addSpacing(12);
|
||||||
|
@ -107,14 +97,12 @@ void ConfigDialog::closeEvent(QCloseEvent *event)
|
||||||
void ConfigDialog::createIcons()
|
void ConfigDialog::createIcons()
|
||||||
{
|
{
|
||||||
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
|
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
|
||||||
Q_CHECK_PTR(configButton);
|
|
||||||
configButton->setIcon(QIcon("://icon/config.png"));
|
configButton->setIcon(QIcon("://icon/config.png"));
|
||||||
configButton->setText(tr("Configuration"));
|
configButton->setText(tr("Configuration"));
|
||||||
configButton->setTextAlignment(Qt::AlignHCenter);
|
configButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QListWidgetItem *patternButton = new QListWidgetItem(contentsWidget);
|
QListWidgetItem *patternButton = new QListWidgetItem(contentsWidget);
|
||||||
Q_CHECK_PTR(patternButton);
|
|
||||||
patternButton->setIcon(QIcon("://icon/pattern_config.png"));
|
patternButton->setIcon(QIcon("://icon/pattern_config.png"));
|
||||||
patternButton->setText(tr("Pattern"));
|
patternButton->setText(tr("Pattern"));
|
||||||
patternButton->setTextAlignment(Qt::AlignHCenter);
|
patternButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
|
|
@ -140,14 +140,12 @@ void DialogHistory::FillTable()
|
||||||
|
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString());
|
QTableWidgetItem *item = new QTableWidgetItem(QString());
|
||||||
Q_CHECK_PTR(item);
|
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
item->setData(Qt::UserRole, tool.getId());
|
item->setData(Qt::UserRole, tool.getId());
|
||||||
ui->tableWidget->setItem(currentRow, 0, item);
|
ui->tableWidget->setItem(currentRow, 0, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(historyRecord);
|
QTableWidgetItem *item = new QTableWidgetItem(historyRecord);
|
||||||
Q_CHECK_PTR(item);
|
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
|
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
|
||||||
ui->tableWidget->setItem(currentRow, 1, item);
|
ui->tableWidget->setItem(currentRow, 1, item);
|
||||||
|
|
|
@ -39,10 +39,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
TextDelegate *textDelegate = new TextDelegate(ui->tableWidgetIncrement);
|
TextDelegate *textDelegate = new TextDelegate(ui->tableWidgetIncrement);
|
||||||
Q_CHECK_PTR(textDelegate);
|
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);
|
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);
|
||||||
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
|
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
|
||||||
Q_CHECK_PTR(doubleDelegate);
|
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);
|
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);
|
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);
|
ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);
|
||||||
|
|
|
@ -71,18 +71,14 @@ QGroupBox *ConfigurationPage::SaveGroup()
|
||||||
QApplication::applicationName());
|
QApplication::applicationName());
|
||||||
|
|
||||||
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
|
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
|
||||||
Q_CHECK_PTR(saveGroup);
|
|
||||||
|
|
||||||
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
|
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
|
||||||
Q_CHECK_PTR(autoSaveCheck);
|
|
||||||
bool autoSaveValue = settings.value("configuration/autosave/state", 1).toBool();
|
bool autoSaveValue = settings.value("configuration/autosave/state", 1).toBool();
|
||||||
autoSaveCheck->setChecked(autoSaveValue);
|
autoSaveCheck->setChecked(autoSaveValue);
|
||||||
|
|
||||||
QLabel *intervalLabel = new QLabel(tr("Interval:"));
|
QLabel *intervalLabel = new QLabel(tr("Interval:"));
|
||||||
Q_CHECK_PTR(intervalLabel);
|
|
||||||
|
|
||||||
autoTime = new QSpinBox();
|
autoTime = new QSpinBox();
|
||||||
Q_CHECK_PTR(autoTime);
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
qint32 autoTimeValue = settings.value("configuration/autosave/time", 5).toInt(&ok);
|
qint32 autoTimeValue = settings.value("configuration/autosave/time", 5).toInt(&ok);
|
||||||
if (ok == false)
|
if (ok == false)
|
||||||
|
@ -94,13 +90,11 @@ QGroupBox *ConfigurationPage::SaveGroup()
|
||||||
autoTime->setSuffix(tr("min"));
|
autoTime->setSuffix(tr("min"));
|
||||||
|
|
||||||
QHBoxLayout *autosaveLayout = new QHBoxLayout;
|
QHBoxLayout *autosaveLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(autosaveLayout);
|
|
||||||
autosaveLayout->addWidget(autoSaveCheck);
|
autosaveLayout->addWidget(autoSaveCheck);
|
||||||
autosaveLayout->addWidget(intervalLabel);
|
autosaveLayout->addWidget(intervalLabel);
|
||||||
autosaveLayout->addWidget(autoTime);
|
autosaveLayout->addWidget(autoTime);
|
||||||
|
|
||||||
QVBoxLayout *saveLayout = new QVBoxLayout;
|
QVBoxLayout *saveLayout = new QVBoxLayout;
|
||||||
Q_CHECK_PTR(saveLayout);
|
|
||||||
saveLayout->addLayout(autosaveLayout);
|
saveLayout->addLayout(autosaveLayout);
|
||||||
saveGroup->setLayout(saveLayout);
|
saveGroup->setLayout(saveLayout);
|
||||||
return saveGroup;
|
return saveGroup;
|
||||||
|
@ -112,13 +106,8 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
QApplication::applicationName());
|
QApplication::applicationName());
|
||||||
|
|
||||||
QGroupBox *langGroup = new QGroupBox(tr("Language"));
|
QGroupBox *langGroup = new QGroupBox(tr("Language"));
|
||||||
Q_CHECK_PTR(langGroup);
|
|
||||||
|
|
||||||
QLabel *guiLabel = new QLabel(tr("GUI language"));
|
QLabel *guiLabel = new QLabel(tr("GUI language"));
|
||||||
Q_CHECK_PTR(guiLabel);
|
|
||||||
|
|
||||||
langCombo = new QComboBox;
|
langCombo = new QComboBox;
|
||||||
Q_CHECK_PTR(langCombo);
|
|
||||||
|
|
||||||
// format systems language
|
// format systems language
|
||||||
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
|
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
|
||||||
|
@ -158,26 +147,21 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
&ConfigurationPage::LangChenged);
|
&ConfigurationPage::LangChenged);
|
||||||
|
|
||||||
QHBoxLayout *guiLangLayout = new QHBoxLayout;
|
QHBoxLayout *guiLangLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(guiLangLayout);
|
|
||||||
guiLangLayout->addWidget(guiLabel);
|
guiLangLayout->addWidget(guiLabel);
|
||||||
guiLangLayout->addWidget(langCombo);
|
guiLangLayout->addWidget(langCombo);
|
||||||
|
|
||||||
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
||||||
Q_CHECK_PTR(separatorLabel);
|
|
||||||
|
|
||||||
osOptionCheck = new QCheckBox(tr("With OS options (.)"));
|
osOptionCheck = new QCheckBox(tr("With OS options (.)"));
|
||||||
Q_CHECK_PTR(osOptionCheck);
|
|
||||||
//bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool();
|
//bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool();
|
||||||
//osOptionCheck->setChecked(osOptionValue);
|
//osOptionCheck->setChecked(osOptionValue);
|
||||||
osOptionCheck->setEnabled(false);
|
osOptionCheck->setEnabled(false);
|
||||||
|
|
||||||
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(separatorLayout);
|
|
||||||
separatorLayout->addWidget(separatorLabel);
|
separatorLayout->addWidget(separatorLabel);
|
||||||
separatorLayout->addWidget(osOptionCheck);
|
separatorLayout->addWidget(osOptionCheck);
|
||||||
|
|
||||||
QVBoxLayout *langLayout = new QVBoxLayout;
|
QVBoxLayout *langLayout = new QVBoxLayout;
|
||||||
Q_CHECK_PTR(langLayout);
|
|
||||||
langLayout->addLayout(guiLangLayout);
|
langLayout->addLayout(guiLangLayout);
|
||||||
langLayout->addLayout(separatorLayout);
|
langLayout->addLayout(separatorLayout);
|
||||||
langGroup->setLayout(langLayout);
|
langGroup->setLayout(langLayout);
|
||||||
|
@ -215,13 +199,9 @@ QGroupBox *PatternPage::UserGroup()
|
||||||
QApplication::applicationName());
|
QApplication::applicationName());
|
||||||
|
|
||||||
QGroupBox *userGroup = new QGroupBox(tr("User"));
|
QGroupBox *userGroup = new QGroupBox(tr("User"));
|
||||||
Q_CHECK_PTR(userGroup);
|
|
||||||
|
|
||||||
QLabel *nameLabel = new QLabel(tr("User name"));
|
QLabel *nameLabel = new QLabel(tr("User name"));
|
||||||
Q_CHECK_PTR(nameLabel);
|
|
||||||
|
|
||||||
userName = new QLineEdit;
|
userName = new QLineEdit;
|
||||||
Q_CHECK_PTR(userName);
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
|
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
|
||||||
#else
|
#else
|
||||||
|
@ -230,12 +210,10 @@ QGroupBox *PatternPage::UserGroup()
|
||||||
userName->setText(user);
|
userName->setText(user);
|
||||||
|
|
||||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(nameLayout);
|
|
||||||
nameLayout->addWidget(nameLabel);
|
nameLayout->addWidget(nameLabel);
|
||||||
nameLayout->addWidget(userName);
|
nameLayout->addWidget(userName);
|
||||||
|
|
||||||
QVBoxLayout *userLayout = new QVBoxLayout;
|
QVBoxLayout *userLayout = new QVBoxLayout;
|
||||||
Q_CHECK_PTR(userLayout);
|
|
||||||
userLayout->addLayout(nameLayout);
|
userLayout->addLayout(nameLayout);
|
||||||
userGroup->setLayout(userLayout);
|
userGroup->setLayout(userLayout);
|
||||||
return userGroup;
|
return userGroup;
|
||||||
|
@ -247,20 +225,16 @@ QGroupBox *PatternPage::GraphOutputGroup()
|
||||||
// QApplication::applicationName());
|
// QApplication::applicationName());
|
||||||
|
|
||||||
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
||||||
Q_CHECK_PTR(graphOutputGroup);
|
|
||||||
|
|
||||||
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
||||||
Q_CHECK_PTR(graphOutputCheck);
|
|
||||||
//bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
//bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
||||||
//graphOutputCheck->setChecked(graphOutputValue);
|
//graphOutputCheck->setChecked(graphOutputValue);
|
||||||
graphOutputCheck->setEnabled(false);
|
graphOutputCheck->setEnabled(false);
|
||||||
|
|
||||||
QHBoxLayout *graphLayout = new QHBoxLayout;
|
QHBoxLayout *graphLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(graphLayout);
|
|
||||||
graphLayout->addWidget(graphOutputCheck);
|
graphLayout->addWidget(graphOutputCheck);
|
||||||
|
|
||||||
QVBoxLayout *graphOutputLayout = new QVBoxLayout;
|
QVBoxLayout *graphOutputLayout = new QVBoxLayout;
|
||||||
Q_CHECK_PTR(graphOutputLayout);
|
|
||||||
graphOutputLayout->addLayout(graphLayout);
|
graphOutputLayout->addLayout(graphLayout);
|
||||||
graphOutputGroup->setLayout(graphOutputLayout);
|
graphOutputGroup->setLayout(graphOutputLayout);
|
||||||
return graphOutputGroup;
|
return graphOutputGroup;
|
||||||
|
@ -272,13 +246,8 @@ QGroupBox *PatternPage::UndoneGroup()
|
||||||
// QApplication::applicationName());
|
// QApplication::applicationName());
|
||||||
|
|
||||||
QGroupBox *undoneGroup = new QGroupBox(tr("Undone"));
|
QGroupBox *undoneGroup = new QGroupBox(tr("Undone"));
|
||||||
Q_CHECK_PTR(undoneGroup);
|
|
||||||
|
|
||||||
QLabel *undoneLabel = new QLabel(tr("Count steps"));
|
QLabel *undoneLabel = new QLabel(tr("Count steps"));
|
||||||
Q_CHECK_PTR(undoneLabel);
|
|
||||||
|
|
||||||
undoneCount = new QSpinBox;
|
undoneCount = new QSpinBox;
|
||||||
Q_CHECK_PTR(undoneCount);
|
|
||||||
// bool ok = true;
|
// bool ok = true;
|
||||||
// qint32 count = settings.value("pattern/undone", 100).toInt(&ok);
|
// qint32 count = settings.value("pattern/undone", 100).toInt(&ok);
|
||||||
// if (ok == false)
|
// if (ok == false)
|
||||||
|
@ -289,12 +258,10 @@ QGroupBox *PatternPage::UndoneGroup()
|
||||||
undoneCount->setEnabled(false);
|
undoneCount->setEnabled(false);
|
||||||
|
|
||||||
QHBoxLayout *countLayout = new QHBoxLayout;
|
QHBoxLayout *countLayout = new QHBoxLayout;
|
||||||
Q_CHECK_PTR(countLayout);
|
|
||||||
countLayout->addWidget(undoneLabel);
|
countLayout->addWidget(undoneLabel);
|
||||||
countLayout->addWidget(undoneCount);
|
countLayout->addWidget(undoneCount);
|
||||||
|
|
||||||
QVBoxLayout *undoneLayout = new QVBoxLayout;
|
QVBoxLayout *undoneLayout = new QVBoxLayout;
|
||||||
Q_CHECK_PTR(undoneLayout);
|
|
||||||
undoneLayout->addLayout(countLayout);
|
undoneLayout->addLayout(countLayout);
|
||||||
undoneGroup->setLayout(undoneLayout);
|
undoneGroup->setLayout(undoneLayout);
|
||||||
return undoneGroup;
|
return undoneGroup;
|
||||||
|
|
|
@ -276,6 +276,7 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
|
||||||
Q_CHECK_PTR(lineEdit);
|
Q_CHECK_PTR(lineEdit);
|
||||||
Q_CHECK_PTR(listWidget);
|
Q_CHECK_PTR(listWidget);
|
||||||
QListWidgetItem *item = listWidget->currentItem();
|
QListWidgetItem *item = listWidget->currentItem();
|
||||||
|
Q_CHECK_PTR(item);
|
||||||
int pos = lineEdit->cursorPosition();
|
int pos = lineEdit->cursorPosition();
|
||||||
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
||||||
lineEdit->setFocus();
|
lineEdit->setFocus();
|
||||||
|
|
|
@ -56,7 +56,6 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent)
|
||||||
}
|
}
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
Q_CHECK_PTR(horizontalSpacer);
|
|
||||||
QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
|
QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
|
||||||
Q_CHECK_PTR(layout);
|
Q_CHECK_PTR(layout);
|
||||||
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||||
|
|
|
@ -166,7 +166,6 @@ void MainWindow::ActionNewDraw()
|
||||||
const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5,
|
const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5,
|
||||||
10));
|
10));
|
||||||
VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Tool::FromGui);
|
VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Tool::FromGui);
|
||||||
Q_CHECK_PTR(spoint);
|
|
||||||
sceneDraw->addItem(spoint);
|
sceneDraw->addItem(spoint);
|
||||||
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
|
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
||||||
|
@ -218,7 +217,6 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso
|
||||||
view->setCursor(cur);
|
view->setCursor(cur);
|
||||||
helpLabel->setText(toolTip);
|
helpLabel->setText(toolTip);
|
||||||
dialogTool = new Dialog(pattern, this);
|
dialogTool = new Dialog(pattern, this);
|
||||||
Q_CHECK_PTR(dialogTool);
|
|
||||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject);
|
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject);
|
||||||
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
||||||
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
||||||
|
@ -1001,7 +999,6 @@ void MainWindow::ActionTable(bool checked)
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
dialogTable = new DialogIncrements(pattern, doc, this);
|
dialogTable = new DialogIncrements(pattern, doc, this);
|
||||||
Q_CHECK_PTR(dialogTable);
|
|
||||||
connect(dialogTable, &DialogIncrements::DialogClosed, this, &MainWindow::ClosedActionTable);
|
connect(dialogTable, &DialogIncrements::DialogClosed, this, &MainWindow::ClosedActionTable);
|
||||||
dialogTable->show();
|
dialogTable->show();
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1021,6 @@ void MainWindow::ActionHistory(bool checked)
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
dialogHistory = new DialogHistory(pattern, doc, this);
|
dialogHistory = new DialogHistory(pattern, doc, this);
|
||||||
Q_CHECK_PTR(dialogHistory);
|
|
||||||
dialogHistory->setWindowFlags(Qt::Window);
|
dialogHistory->setWindowFlags(Qt::Window);
|
||||||
connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory);
|
connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory);
|
||||||
dialogHistory->show();
|
dialogHistory->show();
|
||||||
|
@ -1284,7 +1280,6 @@ void MainWindow::CreateMenus()
|
||||||
ui->menuFile->insertAction(ui->actionExit, recentFileActs[i]);
|
ui->menuFile->insertAction(ui->actionExit, recentFileActs[i]);
|
||||||
}
|
}
|
||||||
separatorAct = new QAction(this);
|
separatorAct = new QAction(this);
|
||||||
Q_CHECK_PTR(separatorAct);
|
|
||||||
separatorAct->setSeparator(true);
|
separatorAct->setSeparator(true);
|
||||||
ui->menuFile->insertAction(ui->actionExit, separatorAct);
|
ui->menuFile->insertAction(ui->actionExit, separatorAct);
|
||||||
UpdateRecentFileActions();
|
UpdateRecentFileActions();
|
||||||
|
@ -1315,7 +1310,6 @@ void MainWindow::CreateActions()
|
||||||
for (int i = 0; i < MaxRecentFiles; ++i)
|
for (int i = 0; i < MaxRecentFiles; ++i)
|
||||||
{
|
{
|
||||||
recentFileActs[i] = new QAction(this);
|
recentFileActs[i] = new QAction(this);
|
||||||
Q_CHECK_PTR(recentFileActs[i]);
|
|
||||||
recentFileActs[i]->setVisible(false);
|
recentFileActs[i]->setVisible(false);
|
||||||
connect(recentFileActs[i], &QAction::triggered, this, &MainWindow::OpenRecentFile);
|
connect(recentFileActs[i], &QAction::triggered, this, &MainWindow::OpenRecentFile);
|
||||||
}
|
}
|
||||||
|
@ -1340,7 +1334,6 @@ void MainWindow::InitAutoSave()
|
||||||
}
|
}
|
||||||
|
|
||||||
autoSaveTimer = new QTimer(this);
|
autoSaveTimer = new QTimer(this);
|
||||||
Q_CHECK_PTR(autoSaveTimer);
|
|
||||||
autoSaveTimer->setTimerType(Qt::VeryCoarseTimer);
|
autoSaveTimer->setTimerType(Qt::VeryCoarseTimer);
|
||||||
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
||||||
autoSaveTimer->start(autoTime*60000);
|
autoSaveTimer->start(autoTime*60000);
|
||||||
|
@ -1350,7 +1343,6 @@ void MainWindow::InitAutoSave()
|
||||||
QString MainWindow::PatternPieceName(const QString &text)
|
QString MainWindow::PatternPieceName(const QString &text)
|
||||||
{
|
{
|
||||||
QInputDialog *dlg = new QInputDialog(this);
|
QInputDialog *dlg = new QInputDialog(this);
|
||||||
Q_CHECK_PTR(dlg);
|
|
||||||
dlg->setInputMode( QInputDialog::TextInput );
|
dlg->setInputMode( QInputDialog::TextInput );
|
||||||
dlg->setLabelText(tr("Pattern piece:"));
|
dlg->setLabelText(tr("Pattern piece:"));
|
||||||
dlg->setTextEchoMode(QLineEdit::Normal);
|
dlg->setTextEchoMode(QLineEdit::Normal);
|
||||||
|
|
|
@ -112,7 +112,6 @@ void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &r
|
||||||
|
|
||||||
VPointF c = *data->GeometricObject<const VPointF *>(center);
|
VPointF c = *data->GeometricObject<const VPointF *>(center);
|
||||||
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
||||||
Q_CHECK_PTR(arc);
|
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,13 +44,11 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con
|
||||||
Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0");
|
Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0");
|
||||||
|
|
||||||
firstArc = new VSimpleArc(arc1id, ¤tColor, &factor);
|
firstArc = new VSimpleArc(arc1id, ¤tColor, &factor);
|
||||||
Q_CHECK_PTR(firstArc);
|
|
||||||
RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint);
|
RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint);
|
||||||
firstArc->setParentItem(this);
|
firstArc->setParentItem(this);
|
||||||
connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
||||||
|
|
||||||
secondArc = new VSimpleArc(arc2id, ¤tColor, &factor);
|
secondArc = new VSimpleArc(arc2id, ¤tColor, &factor);
|
||||||
Q_CHECK_PTR(secondArc);
|
|
||||||
RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint);
|
RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint);
|
||||||
secondArc->setParentItem(this);
|
secondArc->setParentItem(this);
|
||||||
connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
||||||
|
@ -108,32 +106,26 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_CHECK_PTR(p);
|
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
|
|
||||||
VArc * ar1 = new VArc(arc1);
|
VArc * ar1 = new VArc(arc1);
|
||||||
Q_CHECK_PTR(ar1);
|
|
||||||
arc1id = data->AddGObject(ar1);
|
arc1id = data->AddGObject(ar1);
|
||||||
|
|
||||||
VArc * ar2 = new VArc(arc2);
|
VArc * ar2 = new VArc(arc2);
|
||||||
Q_CHECK_PTR(ar2);
|
|
||||||
arc2id = data->AddGObject(ar2);
|
arc2id = data->AddGObject(ar2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_CHECK_PTR(p);
|
|
||||||
data->UpdateGObject(id, p);
|
data->UpdateGObject(id, p);
|
||||||
|
|
||||||
arc1id = id + 1;
|
arc1id = id + 1;
|
||||||
arc2id = id + 2;
|
arc2id = id + 2;
|
||||||
|
|
||||||
VArc * ar1 = new VArc(arc1);
|
VArc * ar1 = new VArc(arc1);
|
||||||
Q_CHECK_PTR(ar1);
|
|
||||||
data->UpdateGObject(arc1id, ar1);
|
data->UpdateGObject(arc1id, ar1);
|
||||||
|
|
||||||
VArc * ar2 = new VArc(arc2);
|
VArc * ar2 = new VArc(arc2);
|
||||||
Q_CHECK_PTR(ar2);
|
|
||||||
data->UpdateGObject(arc2id, ar2);
|
data->UpdateGObject(arc2id, ar2);
|
||||||
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
|
|
|
@ -44,13 +44,11 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i
|
||||||
Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||||
|
|
||||||
firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor);
|
firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor);
|
||||||
Q_CHECK_PTR(firstSpline);
|
|
||||||
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||||
firstSpline->setParentItem(this);
|
firstSpline->setParentItem(this);
|
||||||
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
||||||
|
|
||||||
secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor);
|
secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor);
|
||||||
Q_CHECK_PTR(secondSpline);
|
|
||||||
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
||||||
secondSpline->setParentItem(this);
|
secondSpline->setParentItem(this);
|
||||||
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
||||||
|
@ -108,35 +106,29 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName,
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_CHECK_PTR(p);
|
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
|
|
||||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||||
Q_CHECK_PTR(spline1);
|
|
||||||
spl1id = data->AddGObject(spline1);
|
spl1id = data->AddGObject(spline1);
|
||||||
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||||
Q_CHECK_PTR(spline2);
|
|
||||||
spl2id = data->AddGObject(spline2);
|
spl2id = data->AddGObject(spline2);
|
||||||
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_CHECK_PTR(p);
|
|
||||||
data->UpdateGObject(id, p);
|
data->UpdateGObject(id, p);
|
||||||
|
|
||||||
spl1id = id + 1;
|
spl1id = id + 1;
|
||||||
spl2id = id + 2;
|
spl2id = id + 2;
|
||||||
|
|
||||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||||
Q_CHECK_PTR(spline1);
|
|
||||||
data->UpdateGObject(spl1id, spline1);
|
data->UpdateGObject(spl1id, spline1);
|
||||||
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||||
Q_CHECK_PTR(spline2);
|
|
||||||
data->UpdateGObject(spl2id, spline2);
|
data->UpdateGObject(spl2id, spline2);
|
||||||
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
||||||
|
|
||||||
|
|
|
@ -45,13 +45,11 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu
|
||||||
Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||||
|
|
||||||
firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor);
|
firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor);
|
||||||
Q_CHECK_PTR(firstSpline);
|
|
||||||
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
||||||
firstSpline->setParentItem(this);
|
firstSpline->setParentItem(this);
|
||||||
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||||
|
|
||||||
secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor);
|
secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor);
|
||||||
Q_CHECK_PTR(secondSpline);
|
|
||||||
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
||||||
secondSpline->setParentItem(this);
|
secondSpline->setParentItem(this);
|
||||||
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||||
|
@ -106,7 +104,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
|
||||||
|
|
||||||
const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3);
|
const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3);
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_CHECK_PTR(p);
|
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
|
@ -125,9 +122,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
|
||||||
const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve());
|
const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve());
|
||||||
|
|
||||||
VSplinePath *splPath1 = new VSplinePath();
|
VSplinePath *splPath1 = new VSplinePath();
|
||||||
Q_CHECK_PTR(splPath1);
|
|
||||||
VSplinePath *splPath2 = new VSplinePath();
|
VSplinePath *splPath2 = new VSplinePath();
|
||||||
Q_CHECK_PTR(splPath2);
|
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
for (qint32 i = 0; i < splPath->CountPoint(); i++)
|
for (qint32 i = 0; i < splPath->CountPoint(); i++)
|
||||||
|
@ -220,7 +215,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
|
||||||
{
|
{
|
||||||
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
|
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
|
||||||
splPath2id, typeCreation);
|
splPath2id, typeCreation);
|
||||||
Q_CHECK_PTR(point);
|
|
||||||
scene->addItem(point);
|
scene->addItem(point);
|
||||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||||
|
|
|
@ -104,7 +104,6 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation);
|
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation);
|
||||||
Q_CHECK_PTR(line);
|
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
|
||||||
|
|
|
@ -34,11 +34,9 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
|
||||||
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0)
|
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0)
|
||||||
{
|
{
|
||||||
namePoint = new VGraphicsSimpleTextItem(this);
|
namePoint = new VGraphicsSimpleTextItem(this);
|
||||||
Q_CHECK_PTR(namePoint);
|
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
|
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
|
||||||
namePoint->setBrush(Qt::black);
|
namePoint->setBrush(Qt::black);
|
||||||
lineName = new QGraphicsLineItem(this);
|
lineName = new QGraphicsLineItem(this);
|
||||||
Q_CHECK_PTR(lineName);
|
|
||||||
lineName->setPen(QPen(Qt::black));
|
lineName->setPen(QPen(Qt::black));
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
this->setBrush(QBrush(Qt::NoBrush));
|
||||||
|
@ -51,7 +49,6 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
|
||||||
void VToolPoint::NameChangePosition(const QPointF &pos)
|
void VToolPoint::NameChangePosition(const QPointF &pos)
|
||||||
{
|
{
|
||||||
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||||
Q_CHECK_PTR(point);
|
|
||||||
QPointF p = pos - this->pos();
|
QPointF p = pos - this->pos();
|
||||||
point->setMx(p.x());
|
point->setMx(p.x());
|
||||||
point->setMy(p.y());
|
point->setMy(p.y());
|
||||||
|
|
|
@ -111,7 +111,6 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
|
||||||
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
|
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
|
||||||
VPointF point4 = *data->GeometricObject<const VPointF *>(p4);
|
VPointF point4 = *data->GeometricObject<const VPointF *>(p4);
|
||||||
VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve);
|
VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve);
|
||||||
Q_CHECK_PTR(spline);
|
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,6 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat
|
||||||
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
|
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
|
||||||
Q_CHECK_PTR(dialogTool);
|
Q_CHECK_PTR(dialogTool);
|
||||||
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
|
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
|
||||||
Q_CHECK_PTR(path);
|
|
||||||
for (qint32 i = 0; i < path->CountPoint(); ++i)
|
for (qint32 i = 0; i < path->CountPoint(); ++i)
|
||||||
{
|
{
|
||||||
doc->IncrementReferens((*path)[i].P().id());
|
doc->IncrementReferens((*path)[i].P().id());
|
||||||
|
|
|
@ -57,7 +57,6 @@ void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent);
|
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent);
|
||||||
Q_CHECK_PTR(arc);
|
|
||||||
doc->AddTool(id, arc);
|
doc->AddTool(id, arc);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,6 @@ void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idP
|
||||||
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
||||||
//Better check garbage before each saving file. Check only modeling tags.
|
//Better check garbage before each saving file. Check only modeling tags.
|
||||||
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
||||||
Q_CHECK_PTR(point);
|
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,6 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent);
|
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent);
|
||||||
Q_CHECK_PTR(splPath);
|
|
||||||
doc->AddTool(id, splPath);
|
doc->AddTool(id, splPath);
|
||||||
const VSplinePath *path = data->GeometricObject<const VSplinePath *>(id);
|
const VSplinePath *path = data->GeometricObject<const VSplinePath *>(id);
|
||||||
const QVector<VSplinePoint> *points = path->GetPoint();
|
const QVector<VSplinePoint> *points = path->GetPoint();
|
||||||
|
|
|
@ -67,7 +67,6 @@ public:
|
||||||
{
|
{
|
||||||
//We can't use exist object. Need create new.
|
//We can't use exist object. Need create new.
|
||||||
T *node = new T(*data->GeometricObject<const T *>(id));
|
T *node = new T(*data->GeometricObject<const T *>(id));
|
||||||
Q_CHECK_PTR(node);
|
|
||||||
node->setMode(Draw::Modeling);
|
node->setMode(Draw::Modeling);
|
||||||
return data->AddGObject(node);
|
return data->AddGObject(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,13 +72,11 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
||||||
Q_CHECK_PTR(point);
|
|
||||||
point->setMode(Draw::Modeling);
|
point->setMode(Draw::Modeling);
|
||||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
idObject = data->AddGObject(point);
|
idObject = data->AddGObject(point);
|
||||||
VPointF *point1 = new VPointF(*point);
|
VPointF *point1 = new VPointF(*point);
|
||||||
Q_CHECK_PTR(point1);
|
|
||||||
point1->setMode(Draw::Modeling);
|
point1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(point1);
|
id = data->AddGObject(point1);
|
||||||
VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
||||||
|
@ -99,7 +97,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
VPointF p2 = VPointF(arc->GetP2().x(), arc->GetP2().y(), "A", 0, 0);
|
VPointF p2 = VPointF(arc->GetP2().x(), arc->GetP2().y(), "A", 0, 0);
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
VPointF *center = new VPointF(arc->GetCenter());
|
VPointF *center = new VPointF(arc->GetCenter());
|
||||||
Q_CHECK_PTR(center);
|
|
||||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
|
@ -111,12 +108,10 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(),
|
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(),
|
||||||
l1.angle(), QString().setNum(l1.angle()), l2.angle(),
|
l1.angle(), QString().setNum(l1.angle()), l2.angle(),
|
||||||
QString().setNum(l2.angle()));
|
QString().setNum(l2.angle()));
|
||||||
Q_CHECK_PTR(arc1);
|
|
||||||
arc1->setMode(Draw::Modeling);
|
arc1->setMode(Draw::Modeling);
|
||||||
idObject = data->AddGObject(arc1);
|
idObject = data->AddGObject(arc1);
|
||||||
|
|
||||||
VArc *arc2 = new VArc(*arc1);
|
VArc *arc2 = new VArc(*arc1);
|
||||||
Q_CHECK_PTR(arc2);
|
|
||||||
arc2->setMode(Draw::Modeling);
|
arc2->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(arc2);
|
id = data->AddGObject(arc2);
|
||||||
|
|
||||||
|
@ -135,7 +130,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
VPointF *p1 = new VPointF(spline->GetP1());
|
||||||
Q_CHECK_PTR(p1);
|
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
quint32 idP1 = data->AddGObject(p1);
|
quint32 idP1 = data->AddGObject(p1);
|
||||||
|
|
||||||
|
@ -146,17 +140,14 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline->GetP4());
|
VPointF *p4 = new VPointF(spline->GetP4());
|
||||||
Q_CHECK_PTR(p4);
|
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
quint32 idP4 = data->AddGObject(p4);
|
quint32 idP4 = data->AddGObject(p4);
|
||||||
|
|
||||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
||||||
Draw::Modeling);
|
Draw::Modeling);
|
||||||
Q_CHECK_PTR(spl);
|
|
||||||
idObject = data->AddGObject(spl);
|
idObject = data->AddGObject(spl);
|
||||||
|
|
||||||
VSpline *spl1 = new VSpline(*spl);
|
VSpline *spl1 = new VSpline(*spl);
|
||||||
Q_CHECK_PTR(spl1);
|
|
||||||
spl1->setMode(Draw::Modeling);
|
spl1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(spl1);
|
id = data->AddGObject(spl1);
|
||||||
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
||||||
|
@ -172,7 +163,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath();
|
VSplinePath *path = new VSplinePath();
|
||||||
Q_CHECK_PTR(path);
|
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
qint32 k = splinePath->getMaxCountPoints();
|
qint32 k = splinePath->getMaxCountPoints();
|
||||||
|
@ -183,7 +173,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline.GetP1());
|
VPointF *p1 = new VPointF(spline.GetP1());
|
||||||
Q_CHECK_PTR(p1);
|
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
quint32 idP1 = data->AddGObject(p1);
|
quint32 idP1 = data->AddGObject(p1);
|
||||||
|
@ -198,7 +187,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline.GetP4());
|
VPointF *p4 = new VPointF(spline.GetP4());
|
||||||
Q_CHECK_PTR(p4);
|
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
quint32 idP4 = data->AddGObject(p4);
|
quint32 idP4 = data->AddGObject(p4);
|
||||||
|
@ -221,7 +209,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
idObject = data->AddGObject(path);
|
idObject = data->AddGObject(path);
|
||||||
|
|
||||||
VSplinePath *path1 = new VSplinePath(*path);
|
VSplinePath *path1 = new VSplinePath(*path);
|
||||||
Q_CHECK_PTR(path1);
|
|
||||||
path1->setMode(Draw::Modeling);
|
path1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(path1);
|
id = data->AddGObject(path1);
|
||||||
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
||||||
|
@ -246,7 +233,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
||||||
{
|
{
|
||||||
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
||||||
Q_CHECK_PTR(point);
|
|
||||||
point->setMode(Draw::Modeling);
|
point->setMode(Draw::Modeling);
|
||||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
|
@ -266,7 +252,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
VPointF p2 = VPointF(arc->GetP2());
|
VPointF p2 = VPointF(arc->GetP2());
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
VPointF *center = new VPointF(arc->GetCenter());
|
VPointF *center = new VPointF(arc->GetCenter());
|
||||||
Q_CHECK_PTR(center);
|
|
||||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
|
@ -277,7 +262,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
data->UpdateGObject(idDetail+idCount, center);
|
data->UpdateGObject(idDetail+idCount, center);
|
||||||
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
|
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
|
||||||
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
||||||
Q_CHECK_PTR(arc1);
|
|
||||||
arc1->setMode(Draw::Modeling);
|
arc1->setMode(Draw::Modeling);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, arc1);
|
data->UpdateGObject(idDetail+idCount, arc1);
|
||||||
|
@ -293,7 +277,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
VPointF *p1 = new VPointF(spline->GetP1());
|
||||||
Q_CHECK_PTR(p1);
|
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p1);
|
data->UpdateGObject(idDetail+idCount, p1);
|
||||||
|
@ -305,7 +288,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline->GetP4());
|
VPointF *p4 = new VPointF(spline->GetP4());
|
||||||
Q_CHECK_PTR(p4);
|
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p4);
|
data->UpdateGObject(idDetail+idCount, p4);
|
||||||
|
@ -313,7 +295,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
||||||
Draw::Modeling);
|
Draw::Modeling);
|
||||||
|
|
||||||
Q_CHECK_PTR(spl);
|
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, spl);
|
data->UpdateGObject(idDetail+idCount, spl);
|
||||||
|
|
||||||
|
@ -326,7 +307,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath();
|
VSplinePath *path = new VSplinePath();
|
||||||
Q_CHECK_PTR(path);
|
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
Q_CHECK_PTR(splinePath);
|
Q_CHECK_PTR(splinePath);
|
||||||
|
@ -338,7 +318,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline.GetP1());
|
VPointF *p1 = new VPointF(spline.GetP1());
|
||||||
Q_CHECK_PTR(p1);
|
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
|
@ -354,7 +333,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline.GetP4());
|
VPointF *p4 = new VPointF(spline.GetP4());
|
||||||
Q_CHECK_PTR(p4);
|
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
|
|
|
@ -37,7 +37,6 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
|
||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
||||||
Q_CHECK_PTR(editor);
|
|
||||||
editor->setMinimum(-10000.0);
|
editor->setMinimum(-10000.0);
|
||||||
editor->setMaximum(10000.0);
|
editor->setMaximum(10000.0);
|
||||||
connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor);
|
connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor);
|
||||||
|
|
|
@ -41,10 +41,8 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
|
||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
QLineEdit *editor = new QLineEdit(parent);
|
QLineEdit *editor = new QLineEdit(parent);
|
||||||
Q_CHECK_PTR(editor);
|
|
||||||
QRegExp re("^(([^+ -/()\\^*%:;\"\'=.,><0-9]){1,1}[^+ -/()\\^*%:;\"\'=><]([0-9]){0,}){0,}$");
|
QRegExp re("^(([^+ -/()\\^*%:;\"\'=.,><0-9]){1,1}[^+ -/()\\^*%:;\"\'=><]([0-9]){0,}){0,}$");
|
||||||
QRegExpValidator *v = new QRegExpValidator(re);
|
QRegExpValidator *v = new QRegExpValidator(re);
|
||||||
Q_CHECK_PTR(v);
|
|
||||||
editor->setValidator( v );
|
editor->setValidator( v );
|
||||||
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
||||||
return editor;
|
return editor;
|
||||||
|
|
|
@ -54,7 +54,6 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimeLine *anim = new QTimeLine(300, this);
|
QTimeLine *anim = new QTimeLine(300, this);
|
||||||
Q_CHECK_PTR(anim);
|
|
||||||
anim->setUpdateInterval(20);
|
anim->setUpdateInterval(20);
|
||||||
|
|
||||||
if (QApplication::keyboardModifiers() == Qt::ControlModifier)
|
if (QApplication::keyboardModifiers() == Qt::ControlModifier)
|
||||||
|
|
|
@ -402,7 +402,6 @@ bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element)
|
||||||
void VPattern::FullUpdateTree()
|
void VPattern::FullUpdateTree()
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
||||||
Q_CHECK_PTR(scene);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Parse(Document::LiteParse, scene, scene);
|
Parse(Document::LiteParse, scene, scene);
|
||||||
|
@ -482,7 +481,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
|
||||||
{
|
{
|
||||||
Q_CHECK_PTR(sceneDraw);
|
Q_CHECK_PTR(sceneDraw);
|
||||||
Q_CHECK_PTR(sceneDetail);
|
Q_CHECK_PTR(sceneDetail);
|
||||||
VMainGraphicsScene *scene = 0;
|
VMainGraphicsScene *scene = nullptr;
|
||||||
if (mode == Draw::Calculation)
|
if (mode == Draw::Calculation)
|
||||||
{
|
{
|
||||||
scene = sceneDraw;
|
scene = sceneDraw;
|
||||||
|
@ -652,7 +651,6 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
|
spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
|
||||||
Q_CHECK_PTR(spoint);
|
|
||||||
scene->addItem(spoint);
|
scene->addItem(spoint);
|
||||||
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
||||||
|
@ -1042,7 +1040,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
||||||
const quint32 id = GetParametrId(domElement);
|
const quint32 id = GetParametrId(domElement);
|
||||||
const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0");
|
const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0");
|
||||||
VSplinePath *path = new VSplinePath(kCurve);
|
VSplinePath *path = new VSplinePath(kCurve);
|
||||||
Q_CHECK_PTR(path);
|
|
||||||
|
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
const qint32 num = nodeList.size();
|
const qint32 num = nodeList.size();
|
||||||
|
@ -1088,7 +1085,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
||||||
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
||||||
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
||||||
VSpline *spl = new VSpline(*data->GeometricObject<const VSpline *>(idObject));
|
VSpline *spl = new VSpline(*data->GeometricObject<const VSpline *>(idObject));
|
||||||
Q_CHECK_PTR(spl);
|
|
||||||
spl->setIdObject(idObject);
|
spl->setIdObject(idObject);
|
||||||
spl->setMode(Draw::Modeling);
|
spl->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, spl);
|
data->UpdateGObject(id, spl);
|
||||||
|
@ -1108,7 +1104,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
||||||
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
||||||
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
||||||
VSplinePath *path = new VSplinePath(*data->GeometricObject<const VSplinePath *>(idObject));
|
VSplinePath *path = new VSplinePath(*data->GeometricObject<const VSplinePath *>(idObject));
|
||||||
Q_CHECK_PTR(path);
|
|
||||||
path->setIdObject(idObject);
|
path->setIdObject(idObject);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, path);
|
data->UpdateGObject(id, path);
|
||||||
|
@ -1164,7 +1159,6 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom
|
||||||
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
||||||
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
||||||
VArc *arc = new VArc(*data->GeometricObject<const VArc *>(idObject));
|
VArc *arc = new VArc(*data->GeometricObject<const VArc *>(idObject));
|
||||||
Q_CHECK_PTR(arc);
|
|
||||||
arc->setIdObject(idObject);
|
arc->setIdObject(idObject);
|
||||||
arc->setMode(Draw::Modeling);
|
arc->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, arc);
|
data->UpdateGObject(id, arc);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user