fix result table display in dark mode

This commit is contained in:
Jean-Francois Dockes 2020-09-10 13:53:12 +02:00
parent 199abb9980
commit a6c53ff651
4 changed files with 39 additions and 46 deletions

View File

@ -556,7 +556,8 @@ python/samples/recollqsd.py \
\
sampleconf/fields sampleconf/fragbuts.xml sampleconf/mimeconf \
sampleconf/mimemap sampleconf/mimeview sampleconf/mimeview.mac \
sampleconf/recoll.conf sampleconf/recoll.qss sampleconf/recoll-dark.qss \
sampleconf/recoll.conf sampleconf/recoll.qss \
sampleconf/recoll-dark.qss sampleconf/recoll-dark.css \
\
testmains/Makefile.am \
\
@ -645,6 +646,8 @@ sampleconf/fields \
sampleconf/recoll.conf \
sampleconf/mimeconf \
sampleconf/recoll.qss \
sampleconf/recoll-dark.qss \
sampleconf/recoll-dark.css \
sampleconf/mimemap \
sampleconf/mimeview
@ -754,7 +757,7 @@ dist_man5_MANS = doc/man/recoll.conf.5
dist-hook:
(cd $(top_srcdir); find . \
\( -name '*.pyc' -o -name '#*' -o -name '*~' \) -delete)
if test -z "$(NOTAG)";then \
if test -z "$(NOTAG)";then \
test -z "`git status -s|grep -v recoll-$(VERSION)`"||exit 1; \
vers=`echo $(VERSION) | sed -e 's/~/_/g'`;\
git tag -a RECOLL-$$vers -m "Release $$vers tagged"; \

View File

@ -483,8 +483,7 @@ public:
// difficult. Anyway, the display seems fast enough as is.
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const {
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
QVariant value = index.data(Qt::DisplayRole);
QString text;
if (value.isValid() && !value.isNull()) {
@ -495,39 +494,29 @@ public:
return;
}
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
painter->save();
QTextDocument document;
QString color = opt.palette.color(QPalette::Text).name();
QString selcolor = opt.palette.color(QPalette::BrightText).name();
QString fstyle;
if (prefs.reslistfontsize > 0) {
int fs = prefs.reslistfontsize <= fsadjusttable ?
prefs.reslistfontsize :
prefs.reslistfontsize - fsadjusttable;
prefs.reslistfontsize : prefs.reslistfontsize - fsadjusttable;
fstyle = QString("font-size: %1pt").arg(fs);
}
if (opt.state & QStyle::State_Selected) {
painter->fillRect(opt.rect, opt.palette.highlight());
// Set the foreground color. Tried with pen
// approach did not seem to work, probably it's
// reset by the textdocument. Couldn't use
// setdefaultstylesheet() either. the div thing is
// an ugly hack. Works for now
QString ntxt("<div style='color: white");
if (!fstyle.isEmpty()) {
ntxt += QString(";") + fstyle;
}
ntxt += "'>";
ntxt += text + QString::fromUtf8("</div>");
text.swap(ntxt);
} else {
if (!fstyle.isEmpty()) {
QString ntxt("<div style='");
ntxt += fstyle;
ntxt += QString("'>") + text + QString("</div>");
text.swap(ntxt);
}
}
painter->setClipRect(option.rect);
QString ntxt("<div style='");
ntxt += " color:";
ntxt += (opt.state & QStyle::State_Selected)? selcolor:color;
ntxt += ";";
ntxt += fstyle;
ntxt += QString("'>") + text + QString("</div>");
text.swap(ntxt);
painter->setClipRect(opt.rect);
QPoint where = option.rect.topLeft();
where.ry() += TEXTINCELLVTRANS;
painter->translate(where);

View File

@ -0,0 +1,14 @@
/* Result list HTML Header insert */
<style>
a {
color: #F0FFFF;
}
body, table {
background: #373737;
color: #ffffff;
}
</style>

View File

@ -15,16 +15,7 @@
result list:
Preferences->GUI configuration->Result list->
Edit result page html header insert
For example:
<style type="text/css">
html {
background-color: #505050;
color: #D8D8D8;
selection-background-color: #424e72;
}
</style>
See recoll-dark.css in src/sampleconf of share/examples
*/
/* Light on dark text everywhere*/
@ -57,13 +48,9 @@ QTabWidget QTabBar::tab:selected {
color: #ffffff;
}
/*
* Slightly *darker* background for text entry areas, and brighter
* (lighter) foreground.
* QTableView excluded until we fix the font color...
*/
QComboBox[editable="true"], QTextEdit, QLineEdit,
QTextBrowser, QWebView, QPlainTextEdit {
/* Slightly *darker* background for text entry areas. */
QComboBox[editable="true"], QTextEdit[editable="true"], QLineEdit,
QPlainTextEdit {
background-color: #101010;
color: #ffffff;
}