Skip to content

Commit

Permalink
Make values in attribute form better readable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rduivenvoorde authored and nyalldawson committed Sep 29, 2018
1 parent db65b9a commit fc7df32
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/editorwidgets/qgstexteditwrapper.cpp
Expand Up @@ -137,7 +137,6 @@ void QgsTextEditWrapper::initWidget( QWidget *editor )

mWritablePalette = mLineEdit->palette();
mReadOnlyPalette = mLineEdit->palette();
mReadOnlyPalette.setColor( QPalette::Text, mWritablePalette.color( QPalette::Disabled, QPalette::Text ) );
}
}

Expand Down Expand Up @@ -195,7 +194,13 @@ void QgsTextEditWrapper::setEnabled( bool enabled )
if ( enabled )
mLineEdit->setPalette( mWritablePalette );
else
{
mLineEdit->setPalette( mReadOnlyPalette );
// removing frame + setting transparent background to distinguish the readonly lineEdit from a normal one
// did not get this working via the Palette:
mLineEdit->setStyleSheet( QStringLiteral( "background-color: rgba(255, 255, 255, 75%);" ) );
}
mLineEdit->setFrame( enabled );
}
}

Expand Down

0 comments on commit fc7df32

Please sign in to comment.