Skip to content

Commit

Permalink
Add optional drop shadow behind InfoText
Browse files Browse the repository at this point in the history
  • Loading branch information
gzotti committed Dec 11, 2024
1 parent 8e2d0db commit 7332318
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 3 additions & 1 deletion guide/app_config_ini.tex
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ \subsection{\big[gui\big]}
flag\_show\_cardinal\_button & bool & true & Show a button to toggle cardinals via button press\\
flag\_show\_compass\_button & bool & false & Show a button to toggle compass marks via button press\\
flag\_show\_buttons\_background & bool & true & If \emph{true}, use background under buttons on bottom bar.\\\midrule
flag\_overwrite\_info\_color & bool & false & Set \emph{true} to use one color for test in info panel for all objects.\\\midrule
flag\_overwrite\_info\_color & bool & false & Set \emph{true} to use one color for test in info panel for all objects.\\
flag\_info\_shadow & bool & false & Set \emph{true} to apply a slight shadow behind the infotext for increased readability.\\
pixmaps\_brightness & float & 1.0 & Brighten the gray of GUI buttons. Usable: [1\ldots1.8]\\\midrule
%
selected\_object\_info & string & all & Values: \emph{default}, \emph{all}, \emph{short}, \emph{none},
and \emph{custom} (see~\ref{sec:gui:configuration:info}).\\\midrule
Expand Down
9 changes: 8 additions & 1 deletion guide/ch_advanced_use.tex
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ \section{Environment Variables}
or \texttt{warp} for another software-only solution. Note that command line options take precedence over this environment variable.
\end{description}

\section{Customized GUI Colors}
\section{GUI Customizations}
\subsection{User interface colors}
\label{sec:CommandLineOptions:Special:CSS}

Expand Down Expand Up @@ -666,6 +666,13 @@ \subsection{Button brightness}
\end{configfile}
The value is clamped to [1\ldots1.8] to avoid making active and inactive buttons equally bright.

\subsection{Text shadow}
\label{sec:CommandLineOptions:Special:TextShadow}
Some users complain the infotext is badly visible when there are trees or the Milky Way in the background.\newFeature{24.4} This can also be mitigated in \file{config.ini}.
\begin{configfile}
[gui]
flag_info_shadow=true
\end{configfile}

\section{Spout}\newFeature{0.15.1}
\label{sec:CommandLineOptions:Special:Spout}
Expand Down
11 changes: 11 additions & 0 deletions src/gui/SkyGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <QSettings>
#include <QTextDocument>
#include <QRegularExpression>
#include <QGraphicsDropShadowEffect>

InfoPanel::InfoPanel(QGraphicsItem* parent) : QGraphicsTextItem("", parent),
infoPixmap(nullptr)
Expand Down Expand Up @@ -73,6 +74,16 @@ InfoPanel::InfoPanel(QGraphicsItem* parent) : QGraphicsTextItem("", parent),
font.setPixelSize(StelApp::getInstance().getScreenFontSize());
setFont(font);
});

if (conf->value("gui/flag_info_shadow", false).toBool())
{
// Add a drop shadow for better visibility (not on the infopixmap, though)
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
effect->setBlurRadius(6);
effect->setColor(QColor(0, 0, 0));
effect->setOffset(0,0);
setGraphicsEffect(effect);
}
}

InfoPanel::~InfoPanel()
Expand Down

0 comments on commit 7332318

Please sign in to comment.