Fixes and improvement of NULL value handling in Edit DB Cell dock

Fix: NULL data are correctly indicated in the Cell Info footer when loading
data from the database. Previously, the automatic trigger of
editModeChanged when setting the text in the widget was causing the change
to Text data type. Now the modified flag of the widget is taken into
account.

Fix: NULL values could not be overwritten with empty strings, since the
old vs. new check was incorrectly returning false as the conversion to
string was discarding the NULL information.

Improvement: NULL values are visually indicated using the placeholder as
already done in the Add Record dialog. The italic style is applied to both
cases now for better indication and coherence to the browse data widget.

Known problem: when the cell is changed from a JSON cell to a NULL cell
and the automatic switch is on, the NULL information and visual indication
are still lost.
This commit is contained in:
mgr
2018-09-21 23:19:48 +02:00
parent dd3417e1c4
commit a5d6b5018b
2 changed files with 23 additions and 7 deletions

View File

@@ -22,9 +22,11 @@ public:
void setNull(bool value) {
if (value) {
clear();
setStyleSheet("QLineEdit{ font-style: italic; }");
setPlaceholderText(Settings::getValue("databrowser", "null_text").toString());
setModified(false);
} else
setStyleSheet("");
setPlaceholderText("");
m_isNull = value;
}
@@ -51,6 +53,7 @@ protected:
setNull(true);
else {
// Remove any possible NULL mark when user starts typing
setStyleSheet("");
setPlaceholderText("");
QLineEdit::keyPressEvent(evt);
}