mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-24 16:08:21 -04:00
Clean up overuse of literals for GUI constants.
Add CalamaresStyle for colors and other style constants and helpers. Add static functions for font size.
This commit is contained in:
parent
f10f2026ad
commit
52028d95f9
7 changed files with 125 additions and 15 deletions
|
@ -18,11 +18,17 @@
|
|||
|
||||
#include "CalamaresUtilsGui.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QLayout>
|
||||
|
||||
namespace CalamaresUtils
|
||||
{
|
||||
|
||||
static int s_defaultFontSize = 0;
|
||||
static int s_defaultFontHeight = 0;
|
||||
|
||||
|
||||
void
|
||||
unmarginLayout( QLayout* layout )
|
||||
{
|
||||
|
@ -38,4 +44,41 @@ unmarginLayout( QLayout* layout )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
defaultFontSize()
|
||||
{
|
||||
return s_defaultFontSize;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
defaultFontHeight()
|
||||
{
|
||||
if ( s_defaultFontHeight <= 0 )
|
||||
{
|
||||
QFont f;
|
||||
f.setPointSize( defaultFontSize() );
|
||||
s_defaultFontHeight = QFontMetrics( f ).height();
|
||||
}
|
||||
|
||||
return s_defaultFontHeight;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
setDefaultFontSize( int points )
|
||||
{
|
||||
s_defaultFontSize = points;
|
||||
}
|
||||
|
||||
|
||||
QSize
|
||||
defaultIconSize()
|
||||
{
|
||||
const int w = defaultFontHeight() * 1.6;
|
||||
return QSize( w, w );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue