fixes tab and split header title text size
This commit is contained in:
@@ -83,12 +83,20 @@ QSize Label::minimumSizeHint() const
|
|||||||
void Label::paintEvent(QPaintEvent *)
|
void Label::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
|
qreal deviceDpi =
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
this->devicePixelRatioF();
|
||||||
|
#else
|
||||||
|
1.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
QFontMetrics metrics = getFonts()->getFontMetrics(
|
QFontMetrics metrics = getFonts()->getFontMetrics(
|
||||||
this->getFontStyle(),
|
this->getFontStyle(),
|
||||||
this->scale() * 96.f / this->logicalDpiX() * this->devicePixelRatioF());
|
this->scale() * 96.f / this->logicalDpiX() * deviceDpi);
|
||||||
painter.setFont(getFonts()->getFont(
|
painter.setFont(getFonts()->getFont(
|
||||||
this->getFontStyle(), this->scale() * 96.f / this->logicalDpiX() *
|
this->getFontStyle(),
|
||||||
this->devicePixelRatioF()));
|
this->scale() * 96.f / this->logicalDpiX() * deviceDpi));
|
||||||
|
|
||||||
int offset = this->getOffset();
|
int offset = this->getOffset();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ AlwaysBreakAfterDefinitionReturnType: false
|
|||||||
AlwaysBreakBeforeMultilineStrings: false
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
BasedOnStyle: Google
|
BasedOnStyle: Google
|
||||||
BraceWrapping: {
|
BraceWrapping: {
|
||||||
AfterCaseLabel: 'false'
|
|
||||||
AfterClass: 'true'
|
AfterClass: 'true'
|
||||||
AfterControlStatement: 'true'
|
AfterControlStatement: 'true'
|
||||||
AfterFunction: 'true'
|
AfterFunction: 'true'
|
||||||
|
|||||||
@@ -22,6 +22,16 @@
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
namespace {
|
||||||
|
qreal deviceDpi(QWidget *widget)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
return widget->devicePixelRatioF();
|
||||||
|
#else
|
||||||
|
return 1.0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
NotebookTab::NotebookTab(Notebook *notebook)
|
NotebookTab::NotebookTab(Notebook *notebook)
|
||||||
: Button(notebook)
|
: Button(notebook)
|
||||||
@@ -83,11 +93,10 @@ void NotebookTab::themeChangedEvent()
|
|||||||
void NotebookTab::updateSize()
|
void NotebookTab::updateSize()
|
||||||
{
|
{
|
||||||
float scale = this->scale();
|
float scale = this->scale();
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
QFontMetrics metrics = getApp()->fonts->getFontMetrics(
|
QFontMetrics metrics = getApp()->fonts->getFontMetrics(
|
||||||
FontStyle::UiTabs,
|
FontStyle::UiTabs, float(qreal(this->scale()) * deviceDpi(this)));
|
||||||
float(qreal(this->scale()) * this->devicePixelRatioF()));
|
|
||||||
|
|
||||||
if (this->hasXButton())
|
if (this->hasXButton())
|
||||||
{
|
{
|
||||||
@@ -276,10 +285,10 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
painter.setFont(getApp()->fonts->getFont(
|
painter.setFont(getApp()->fonts->getFont(
|
||||||
FontStyle::UiTabs,
|
FontStyle::UiTabs,
|
||||||
scale * 96.f / this->logicalDpiX() * this->devicePixelRatioF()));
|
scale * 96.f / this->logicalDpiX() * deviceDpi(this)));
|
||||||
QFontMetrics metrics = app->fonts->getFontMetrics(
|
QFontMetrics metrics = app->fonts->getFontMetrics(
|
||||||
FontStyle::UiTabs,
|
FontStyle::UiTabs,
|
||||||
scale * 96.f / this->logicalDpiX() * this->devicePixelRatioF());
|
scale * 96.f / this->logicalDpiX() * deviceDpi(this));
|
||||||
|
|
||||||
int height = int(scale * NOTEBOOK_TAB_HEIGHT);
|
int height = int(scale * NOTEBOOK_TAB_HEIGHT);
|
||||||
|
|
||||||
@@ -299,12 +308,12 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||||||
bool windowFocused = this->window() == QApplication::activeWindow();
|
bool windowFocused = this->window() == QApplication::activeWindow();
|
||||||
|
|
||||||
QBrush tabBackground = /*this->mouseOver_ ? colors.backgrounds.hover
|
QBrush tabBackground = /*this->mouseOver_ ? colors.backgrounds.hover
|
||||||
:*/
|
:*/
|
||||||
(windowFocused ? colors.backgrounds.regular
|
(windowFocused ? colors.backgrounds.regular
|
||||||
: colors.backgrounds.unfocused);
|
: colors.backgrounds.unfocused);
|
||||||
|
|
||||||
// fill the tab background
|
// fill the tab background
|
||||||
auto bgRect = rect();
|
auto bgRect = this->rect();
|
||||||
bgRect.setTop(ceil((this->selected_ ? 0.f : 1.f) * scale));
|
bgRect.setTop(ceil((this->selected_ ? 0.f : 1.f) * scale));
|
||||||
|
|
||||||
painter.fillRect(bgRect, tabBackground);
|
painter.fillRect(bgRect, tabBackground);
|
||||||
|
|||||||
Reference in New Issue
Block a user