forked from qt-creator/qt-creator
QmlDesigner: Suppress datatype warning when creating new column
- Ignores datatype warnings for cells with null values and cells with Unknown datatype Task-number: QDS-11645 Change-Id: I0f0247bcfcbd8bd2a7377e587351c1a984c269be Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -221,9 +221,18 @@ Rectangle {
|
||||
clip: true
|
||||
implicitWidth: 100
|
||||
implicitHeight: StudioTheme.Values.baseHeight
|
||||
border.color: dataTypeWarning !== CollectionDetails.Warning.None ?
|
||||
StudioTheme.Values.themeWarning : StudioTheme.Values.themeControlBackgroundInteraction
|
||||
color: itemSelected ? StudioTheme.Values.themeControlBackgroundInteraction
|
||||
: StudioTheme.Values.themeControlBackground
|
||||
border.width: 1
|
||||
border.color: {
|
||||
if (dataTypeWarning !== CollectionDetails.Warning.None)
|
||||
return StudioTheme.Values.themeWarning
|
||||
|
||||
if (itemSelected)
|
||||
return StudioTheme.Values.themeControlOutlineInteraction
|
||||
|
||||
return StudioTheme.Values.themeControlBackgroundInteraction
|
||||
}
|
||||
|
||||
HelperWidgets.ToolTipArea {
|
||||
anchors.fill: parent
|
||||
@@ -254,9 +263,8 @@ Rectangle {
|
||||
|
||||
Text {
|
||||
text: display
|
||||
color: itemSelected
|
||||
? StudioTheme.Values.themeInteraction
|
||||
: StudioTheme.Values.themePlaceholderTextColorInteraction
|
||||
color: itemSelected ? StudioTheme.Values.themeInteraction
|
||||
: StudioTheme.Values.themePlaceholderTextColorInteraction
|
||||
leftPadding: 5
|
||||
topPadding: 3
|
||||
bottomPadding: 3
|
||||
@@ -274,7 +282,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function resetSource() {
|
||||
if (columnType == CollectionDetails.DataType.Color)
|
||||
if (columnType === CollectionDetails.DataType.Color)
|
||||
cellContentLoader.sourceComponent = colorEditorComponent
|
||||
else
|
||||
cellContentLoader.sourceComponent = cellText
|
||||
@@ -291,28 +299,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "default"
|
||||
when: !itemSelected
|
||||
|
||||
PropertyChanges {
|
||||
target: itemCell
|
||||
color: StudioTheme.Values.themeControlBackground
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "selected"
|
||||
when: itemSelected
|
||||
|
||||
PropertyChanges {
|
||||
target: itemCell
|
||||
color: StudioTheme.Values.themeControlBackgroundInteraction
|
||||
border.color: StudioTheme.Values.themeControlBackground
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
StudioControls.Menu {
|
||||
id: cellContextMenu
|
||||
|
||||
|
@@ -375,8 +375,10 @@ DataTypeWarning::Warning CollectionDetails::cellWarningCheck(int row, int column
|
||||
const QString &propertyName = d->properties.at(column).name;
|
||||
const QJsonObject &element = d->elements.at(row);
|
||||
|
||||
if (element.isEmpty())
|
||||
if (typeAt(column) == DataType::Unknown || element.isEmpty()
|
||||
|| data(row, column) == QVariant::fromValue(nullptr)) {
|
||||
return DataTypeWarning::Warning::None;
|
||||
}
|
||||
|
||||
if (element.contains(propertyName) && typeAt(column) != typeAt(row, column))
|
||||
return DataTypeWarning::Warning::CellDataTypeMismatch;
|
||||
|
Reference in New Issue
Block a user