mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
statistics: make fonts themeable
Move the various font objects the the StatsTheme structure to enable different font weights for different themes. For the dark theme, switch to a bold font, because the thin white font was barely visible. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5f91c69f9c
commit
144e81e8f8
13 changed files with 42 additions and 39 deletions
|
|
@ -20,11 +20,10 @@ Legend::Legend(StatsView &view, const std::vector<QString> &names) :
|
|||
QBrush(view.getCurrentTheme().legendColor), legendBoxBorderRadius),
|
||||
displayedItems(0), width(0.0), height(0.0),
|
||||
theme(view.getCurrentTheme()),
|
||||
font(QFont()), // Make configurable
|
||||
posInitialized(false)
|
||||
{
|
||||
entries.reserve(names.size());
|
||||
QFontMetrics fm(font);
|
||||
QFontMetrics fm(theme.legendFont);
|
||||
fontHeight = fm.height();
|
||||
int idx = 0;
|
||||
for (const QString &name: names)
|
||||
|
|
@ -98,7 +97,7 @@ void Legend::resize()
|
|||
|
||||
// Paint labels
|
||||
painter->setPen(theme.darkLabelColor); // QPainter uses pen not brush for text!
|
||||
painter->setFont(font);
|
||||
painter->setFont(theme.legendFont);
|
||||
for (int i = 0; i < displayedItems; ++i) {
|
||||
QPointF itemPos = entries[i].pos;
|
||||
itemPos.rx() += fontHeight + 2.0 * legendBoxBorderSize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue