void WidgetMain::slotClickNewProject() { affirmType_ = PRESSED_NEW_PROJECT; AffirmForm *pAffirmForm = new AffirmForm(this->rect(), this); connect(pAffirmForm, SIGNAL(signalBack()), this, SLOT(slotPressBack())); connect(pAffirmForm, SIGNAL(signalNotSave()), this, SLOT(slotPressNotSave())); connect(pAffirmForm, SIGNAL(signalSave()), this, SLOT(slotPressSave())); pAffirmForm->setAttribute(Qt::WA_DeleteOnClose); //this->activateWindow(); pAffirmForm->show(); }
//关闭按钮 void WidgetMain::on_pushButtonClose_clicked() { affirmType_ = PRESSED_CLOSE; AffirmForm *pAffirmForm = new AffirmForm(this->rect(), this); connect(pAffirmForm, SIGNAL(signalBack()), this, SLOT(slotPressBack())); connect(pAffirmForm, SIGNAL(signalNotSave()), this, SLOT(slotPressNotSave())); connect(pAffirmForm, SIGNAL(signalSave()), this, SLOT(slotPressSave())); pAffirmForm->setAttribute(Qt::WA_DeleteOnClose); //this->activateWindow(); pAffirmForm->show(); }
void ViewDepartments::slotCancel() { if (m_model->cancel()) { m_editMode = false; emit signalSave(-1, false); } else QMessageBox::critical(this, "", "Не удалось отменить изменения", QMessageBox::Ok); auto index = ui->tableView->selectionModel()->currentIndex(); ui->tableView->reset(); ui->tableView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select | QItemSelectionModel::Rows); slotSelectionChanged(QItemSelection(), QItemSelection()); }
COBase::Status Text::pointerClick (QPoint &point, QDateTime &x, double y) { switch (status) { case None: if (isSelected(point)) { status = Selected; emit signalDraw(); } break; case Selected: if (isGrabSelected(point)) status = Moving; else { if (! isSelected(point)) { status = None; emit signalDraw(); } } break; case Moving: status = Selected; break; case ClickWait: setDate(x); setValue(y); setSaveFlag(TRUE); setColor(defaultColor); emit signalDraw(); status = None; emit message(""); emit signalSave(name); break; default: break; } return status; }
void ViewDepartments::slotSave() { auto m_index = ui->tableView->selectionModel()->currentIndex(); auto row = m_index.row() + 1; auto column = m_index.column(); auto child = m_model->index(row, column, m_index); ui->tableView->selectionModel()->setCurrentIndex(child, QItemSelectionModel::Select | QItemSelectionModel::Rows); if (m_model->save()) { m_editMode = false; int value = m_model->data(ui->tableView->selectionModel()->selectedRows()[0], Qt::UserRole).toInt(); emit signalSave(value, true); QMessageBox::information(this, "", "Сохранено", QMessageBox::Ok); } else { QMessageBox::critical(this, "", "Не удалось применить изменения", QMessageBox::Ok); } auto index = ui->tableView->selectionModel()->currentIndex(); slotSelectionChanged(QItemSelection(), QItemSelection()); }