File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -112,13 +112,31 @@ EditDialog::~EditDialog()
112112
113113void EditDialog::setCurrentIndex (const QModelIndex& idx)
114114{
115+ if (m_currentIndex != QPersistentModelIndex (idx) && ui->buttonApply ->isEnabled () &&
116+ (sciEdit->isModified () || ui->qtEdit ->document ()->isModified () || hexEdit->isModified ())) {
117+
118+ QMessageBox::StandardButton reply = QMessageBox::question (
119+ this ,
120+ tr (" Unsaved data in the cell editor" ),
121+ tr (" The cell editor contains data not yet applied to the database.\n "
122+ " Do you want to apply the edited data?" ),
123+ QMessageBox::Apply | QMessageBox::Discard);
124+
125+ if (reply == QMessageBox::Apply)
126+ accept ();
127+ }
128+
129+ setDisabled (!idx.isValid ());
130+
115131 m_currentIndex = QPersistentModelIndex (idx);
116132
117133 QByteArray bArrData = idx.data (Qt::EditRole).toByteArray ();
118134 loadData (bArrData);
119135 updateCellInfoAndMode (bArrData);
120136
121137 ui->buttonApply ->setDisabled (true );
138+ sciEdit->setModified (false );
139+ ui->qtEdit ->document ()->setModified (false );
122140}
123141
124142void EditDialog::showEvent (QShowEvent*)
You can’t perform that action at this time.
0 commit comments