Skip to content

Commit fc7df32

Browse files
rduivenvoordenyalldawson
authored andcommitted
Make values in attribute form better readable
Currently in readonly modus of a form, the line-edits get a 'disabled'-palette. But because text is then so light readability is bad. Removing the palette make the lineedits look like they are writable input fields. So to distinguish them from input field, the frame is removed and the background (of the lineEdit) is set to almost transparent.
1 parent db65b9a commit fc7df32

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/gui/editorwidgets/qgstexteditwrapper.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ void QgsTextEditWrapper::initWidget( QWidget *editor )
137137

138138
mWritablePalette = mLineEdit->palette();
139139
mReadOnlyPalette = mLineEdit->palette();
140-
mReadOnlyPalette.setColor( QPalette::Text, mWritablePalette.color( QPalette::Disabled, QPalette::Text ) );
141140
}
142141
}
143142

@@ -195,7 +194,13 @@ void QgsTextEditWrapper::setEnabled( bool enabled )
195194
if ( enabled )
196195
mLineEdit->setPalette( mWritablePalette );
197196
else
197+
{
198198
mLineEdit->setPalette( mReadOnlyPalette );
199+
// removing frame + setting transparent background to distinguish the readonly lineEdit from a normal one
200+
// did not get this working via the Palette:
201+
mLineEdit->setStyleSheet( QStringLiteral( "background-color: rgba(255, 255, 255, 75%);" ) );
202+
}
203+
mLineEdit->setFrame( enabled );
199204
}
200205
}
201206

0 commit comments

Comments
 (0)