forked from qt-creator/qt-creator
Use StyleHelper::UiFont()
Change-Id: I0c09578b76c48ddb255f44bb6117089dd092a72c Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -94,11 +94,6 @@ StyleHelper::ToolbarStyle StyleHelper::toolbarStyle()
|
||||
return s_toolbarStyle;
|
||||
}
|
||||
|
||||
qreal StyleHelper::sidebarFontSize()
|
||||
{
|
||||
return HostOsInfo::isMacHost() ? 10 : 7.5;
|
||||
}
|
||||
|
||||
QColor StyleHelper::notTooBrightHighlightColor()
|
||||
{
|
||||
QColor highlightColor = QApplication::palette().highlight().color();
|
||||
|
@@ -60,7 +60,6 @@ enum UiElement {
|
||||
QTCREATOR_UTILS_EXPORT int navigationWidgetHeight();
|
||||
QTCREATOR_UTILS_EXPORT void setToolbarStyle(ToolbarStyle style);
|
||||
QTCREATOR_UTILS_EXPORT ToolbarStyle toolbarStyle();
|
||||
QTCREATOR_UTILS_EXPORT qreal sidebarFontSize();
|
||||
QTCREATOR_UTILS_EXPORT QPalette sidebarFontPalette(const QPalette &original);
|
||||
|
||||
// This is our color table, all colors derive from baseColor
|
||||
|
@@ -9,10 +9,11 @@
|
||||
#include "../iwizardfactory.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/icon.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
@@ -569,14 +570,7 @@ void SettingsDialog::showPage(const Id pageId)
|
||||
|
||||
void SettingsDialog::createGui()
|
||||
{
|
||||
// Header label with large font and a bit of spacing (align with group boxes)
|
||||
QFont headerLabelFont = m_headerLabel->font();
|
||||
headerLabelFont.setBold(true);
|
||||
// Paranoia: Should a font be set in pixels...
|
||||
const int pointSize = headerLabelFont.pointSize();
|
||||
if (pointSize > 0)
|
||||
headerLabelFont.setPointSize(pointSize + 2);
|
||||
m_headerLabel->setFont(headerLabelFont);
|
||||
m_headerLabel->setFont(StyleHelper::UiFont(StyleHelper::UiElementH2));
|
||||
|
||||
auto headerHLayout = new QHBoxLayout;
|
||||
const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
|
@@ -181,11 +181,9 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
|
||||
const bool isTitledAction = defaultAction() && defaultAction()->property("titledAction").toBool();
|
||||
// draw popup texts
|
||||
if (isTitledAction && !m_iconsOnly) {
|
||||
QFont normalFont(painter.font());
|
||||
const QFont normalFont = StyleHelper::UiFont(StyleHelper::UiElementPanelSubtitle);
|
||||
QRect centerRect = rect();
|
||||
normalFont.setPointSizeF(StyleHelper::sidebarFontSize());
|
||||
QFont boldFont(normalFont);
|
||||
boldFont.setBold(true);
|
||||
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle);
|
||||
const QFontMetrics fm(normalFont);
|
||||
const QFontMetrics boldFm(boldFont);
|
||||
const int lineHeight = boldFm.height();
|
||||
@@ -286,9 +284,7 @@ QSize FancyToolButton::sizeHint() const
|
||||
|
||||
QSizeF buttonSize = iconSize().expandedTo(QSize(64, 38));
|
||||
if (defaultAction() && defaultAction()->property("titledAction").toBool()) {
|
||||
QFont boldFont(font());
|
||||
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
|
||||
boldFont.setBold(true);
|
||||
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle);
|
||||
const QFontMetrics fm(boldFont);
|
||||
const qreal lineHeight = fm.height();
|
||||
const int extraHeight = 10 // Spacing between top and projectName
|
||||
|
@@ -68,9 +68,7 @@ QSize FancyTabBar::tabSizeHint(bool minimum) const
|
||||
Core::Constants::MODEBAR_ICONSONLY_BUTTON_SIZE / (minimum ? 3 : 1)};
|
||||
}
|
||||
|
||||
QFont boldFont(font());
|
||||
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
|
||||
boldFont.setBold(true);
|
||||
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle);
|
||||
const QFontMetrics fm(boldFont);
|
||||
const int spacing = 8;
|
||||
const int width = 60 + spacing + 2;
|
||||
@@ -285,9 +283,7 @@ static void paintIconAndText(QPainter *painter, const QRect &rect,
|
||||
const QIcon &icon, const QString &text,
|
||||
bool enabled, bool selected)
|
||||
{
|
||||
QFont boldFont(painter->font());
|
||||
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
|
||||
boldFont.setBold(true);
|
||||
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle);
|
||||
painter->setFont(boldFont);
|
||||
|
||||
const bool drawIcon = rect.height() > 36;
|
||||
|
@@ -166,7 +166,8 @@ QSize ProgressBar::sizeHint() const
|
||||
int width = 50;
|
||||
int height = PROGRESSBAR_HEIGHT + 5;
|
||||
if (m_titleVisible) {
|
||||
const QFontMetrics fm(titleFont());
|
||||
const QFont font = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle);
|
||||
const QFontMetrics fm(font);
|
||||
width = qMax(width, fm.horizontalAdvance(m_title) + 16);
|
||||
height += fm.height() + 5;
|
||||
if (!m_subtitle.isEmpty()) {
|
||||
@@ -192,14 +193,6 @@ void ProgressBar::mouseReleaseEvent(QMouseEvent *event)
|
||||
QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
QFont ProgressBar::titleFont() const
|
||||
{
|
||||
QFont boldFont(font());
|
||||
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
|
||||
boldFont.setBold(true);
|
||||
return boldFont;
|
||||
}
|
||||
|
||||
void ProgressBar::mouseMoveEvent(QMouseEvent *ev)
|
||||
{
|
||||
update();
|
||||
@@ -220,7 +213,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
|
||||
percent = 1;
|
||||
|
||||
QPainter p(this);
|
||||
const QFont fnt(titleFont());
|
||||
const QFont fnt = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle);
|
||||
const QFontMetrics fm(fnt);
|
||||
|
||||
const int titleHeight = m_titleVisible ? fm.height() + 5 : 4;
|
||||
|
@@ -52,7 +52,6 @@ protected:
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QFont titleFont() const;
|
||||
QFont subtitleFont() const;
|
||||
|
||||
QString m_text;
|
||||
|
@@ -661,9 +661,7 @@ void ProgressManagerPrivate::updateStatusDetailsWidget()
|
||||
} else if (progress->isSubtitleVisibleInStatusBar() && !progress->subtitle().isEmpty()) {
|
||||
if (!m_statusDetailsLabel) {
|
||||
m_statusDetailsLabel = new QLabel(m_summaryProgressWidget);
|
||||
QFont font(m_statusDetailsLabel->font());
|
||||
font.setPointSizeF(StyleHelper::sidebarFontSize());
|
||||
font.setBold(true);
|
||||
const QFont font = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle);
|
||||
m_statusDetailsLabel->setFont(font);
|
||||
}
|
||||
m_statusDetailsLabel->setText(progress->subtitle());
|
||||
|
@@ -49,10 +49,7 @@ BuildProgress::BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation
|
||||
warningLayout->addWidget(m_warningIcon);
|
||||
warningLayout->addWidget(m_warningLabel);
|
||||
|
||||
// ### TODO this setup should be done by style
|
||||
QFont f = this->font();
|
||||
f.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
|
||||
f.setBold(true);
|
||||
const QFont f = Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementPanelTitle);
|
||||
m_errorLabel->setFont(f);
|
||||
m_warningLabel->setFont(f);
|
||||
m_errorLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_errorLabel->palette()));
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
#include <QMargins>
|
||||
#include <QCoreApplication>
|
||||
@@ -54,9 +54,7 @@ BuildSettingsWidget::BuildSettingsWidget(Target *target) :
|
||||
if (!BuildConfigurationFactory::find(m_target)) {
|
||||
auto noSettingsLabel = new QLabel(this);
|
||||
noSettingsLabel->setText(Tr::tr("No build settings available"));
|
||||
QFont f = noSettingsLabel->font();
|
||||
f.setPointSizeF(f.pointSizeF() * 1.2);
|
||||
noSettingsLabel->setFont(f);
|
||||
noSettingsLabel->setFont(StyleHelper::UiFont(StyleHelper::UiElementH2));
|
||||
vbox->addWidget(noSettingsLabel);
|
||||
return;
|
||||
}
|
||||
@@ -128,10 +126,7 @@ void BuildSettingsWidget::addSubWidget(NamedWidget *widget)
|
||||
|
||||
auto label = new QLabel(this);
|
||||
label->setText(widget->displayName());
|
||||
QFont f = label->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.2);
|
||||
label->setFont(f);
|
||||
label->setFont(StyleHelper::UiFont(StyleHelper::UiElementH2));
|
||||
|
||||
label->setContentsMargins(0, 18, 0, 0);
|
||||
|
||||
|
@@ -100,10 +100,7 @@ void PanelsWidget::addPropertiesPanel(const QString &displayName)
|
||||
auto nameLabel = new QLabel(m_root);
|
||||
nameLabel->setText(displayName);
|
||||
nameLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
|
||||
QFont f = nameLabel->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.6);
|
||||
nameLabel->setFont(f);
|
||||
nameLabel->setFont(StyleHelper::UiFont(StyleHelper::UiElementH1));
|
||||
m_layout->addWidget(nameLabel);
|
||||
m_layout->addWidget(Layouting::createHr());
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcsettings.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/treemodel.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -569,10 +570,7 @@ public:
|
||||
selectorView->setAutoFillBackground(true);
|
||||
|
||||
auto activeLabel = new QLabel(Tr::tr("Active Project"));
|
||||
QFont font = activeLabel->font();
|
||||
font.setBold(true);
|
||||
font.setPointSizeF(font.pointSizeF() * 1.2);
|
||||
activeLabel->setFont(font);
|
||||
activeLabel->setFont(StyleHelper::UiFont(StyleHelper::UiElementH2));
|
||||
|
||||
auto innerLayout = new QVBoxLayout;
|
||||
innerLayout->setSpacing(10);
|
||||
@@ -905,8 +903,7 @@ void SelectorDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
case 2: {
|
||||
QColor col = creatorTheme()->color(Theme::TextColorNormal);
|
||||
opt.palette.setColor(QPalette::Text, col);
|
||||
opt.font.setBold(true);
|
||||
opt.font.setPointSizeF(opt.font.pointSizeF() * 1.2);
|
||||
opt.font = StyleHelper::UiFont(StyleHelper::UiElementH2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/infolabel.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QComboBox>
|
||||
@@ -69,10 +69,7 @@ RunSettingsWidget::RunSettingsWidget(Target *target) :
|
||||
|
||||
runLabel->setBuddy(m_runConfigurationCombo);
|
||||
|
||||
QFont f = runLabel->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.2);
|
||||
|
||||
const QFont f = Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementH2);
|
||||
runTitle->setFont(f);
|
||||
deployTitle->setFont(f);
|
||||
|
||||
@@ -501,10 +498,7 @@ void RunSettingsWidget::addSubWidget(QWidget *widget, QLabel *label)
|
||||
{
|
||||
widget->setContentsMargins({});
|
||||
|
||||
QFont f = label->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.2);
|
||||
label->setFont(f);
|
||||
label->setFont(Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementH2));
|
||||
|
||||
label->setContentsMargins(0, 18, 0, 0);
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/treemodel.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -184,10 +185,7 @@ void TargetGroupItemPrivate::ensureWidget()
|
||||
|
||||
auto label = new QLabel;
|
||||
label->setText(Tr::tr("No kit defined in this project."));
|
||||
QFont f = label->font();
|
||||
f.setPointSizeF(f.pointSizeF() * 1.4);
|
||||
f.setBold(true);
|
||||
label->setFont(f);
|
||||
label->setFont(StyleHelper::UiFont(StyleHelper::UiElementH2));
|
||||
label->setContentsMargins(10, 10, 10, 10);
|
||||
label->setAlignment(Qt::AlignTop);
|
||||
|
||||
|
@@ -3,6 +3,9 @@
|
||||
|
||||
#include "dragshapebutton.h"
|
||||
#include "baseitem.h"
|
||||
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
#include <QDrag>
|
||||
#include <QGuiApplication>
|
||||
#include <QMimeData>
|
||||
@@ -17,9 +20,7 @@ DragShapeButton::DragShapeButton(QWidget *parent)
|
||||
setMinimumSize(75, 75);
|
||||
setMaximumSize(75, 75);
|
||||
setIconSize(QSize(45, 45));
|
||||
QFont f = font();
|
||||
f.setPointSize(8);
|
||||
setFont(f);
|
||||
setFont(Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementPanelSubtitle));
|
||||
}
|
||||
|
||||
void DragShapeButton::setShapeInfo(int groupIndex, int shapeIndex)
|
||||
|
@@ -78,9 +78,7 @@ IntroductionWidget::IntroductionWidget(QWidget *parent)
|
||||
m_continueLabel->setAlignment(Qt::AlignCenter);
|
||||
m_continueLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
m_continueLabel->setWordWrap(true);
|
||||
auto fnt = font();
|
||||
fnt.setPointSizeF(fnt.pointSizeF() * 1.5);
|
||||
m_continueLabel->setFont(fnt);
|
||||
m_continueLabel->setFont(StyleHelper::UiFont(StyleHelper::UiElementH1));
|
||||
m_continueLabel->setPalette(palette());
|
||||
layout->addWidget(m_continueLabel);
|
||||
m_bodyCss = "font-size: 16px;";
|
||||
|
Reference in New Issue
Block a user