refs #304, changed font settings

* QFontDialog is not working, as it is affected by the style sheets itself
* Added font settings to the GUI settings tab
* Added font color dialog for fonts
* Several utility methods
This commit is contained in:
Klaus Basan
2014-08-14 01:28:22 +02:00
parent bbb342b905
commit 98942a6395
10 changed files with 489 additions and 46 deletions

View File

@@ -15,6 +15,7 @@
#include <QMap>
#include <QObject>
#include <QFont>
#include <QStringList>
namespace BlackGui
{
@@ -40,6 +41,18 @@ namespace BlackGui
//! Update the fonts
bool updateFonts(const QFont &font);
//! Update the fonts
bool updateFonts(const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor);
//! Current font color from style sheet
QString fontColor();
//! Get the font style
static QString fontStyle(const QString &combinedStyleAndWeight);
//! Get the font weight
static QString fontWeight(const QString &combinedStyleAndWeight);
//! Central reader
static CStyleSheetUtility &instance()
{
@@ -82,9 +95,32 @@ namespace BlackGui
return f;
}
//! Font weights
static const QStringList &fontWeights()
{
static const QStringList w( {"bold", "semibold", "light", "black", "normal"});
return w;
}
//! Font styles
static const QStringList &fontStyles()
{
static const QStringList s( {"italic", "oblique", "normal"});
return s;
}
//! qss directory
static QString qssDirectory();
//! Font style as string
static const QString &fontStyleAsString(const QFont &font);
//! Font weight as string
static const QString &fontWeightAsString(const QFont &font);
//! Font as combined weight and style
static QString fontAsCombinedWeightStyle(const QFont &font);
signals:
//! Sheets have been changed
void styleSheetsChanged();
@@ -94,12 +130,6 @@ namespace BlackGui
//! Constructor
explicit CStyleSheetUtility(QObject *parent = nullptr);
//! Font style as string
static const QString &fontStyleAsString(const QFont &font);
//! Font weight as string
static const QString &fontWeightAsString(const QFont &font);
};
}