mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(chat-settings): use safe methods to get the font's pixel size
Further rename the pixel size vars to improve readability.
This commit is contained in:
parent
9ec5c11caa
commit
1dd730841a
|
@ -581,22 +581,23 @@ void GeneralForm::retranslateUi()
|
|||
void GeneralForm::on_txtChatFont_currentFontChanged(const QFont& f)
|
||||
{
|
||||
QFont tmpFont = f;
|
||||
const int fontSize = bodyUI->txtChatFontSize->value();
|
||||
const int px = bodyUI->txtChatFontSize->value();
|
||||
|
||||
if (tmpFont.pixelSize() != fontSize)
|
||||
tmpFont.setPixelSize(fontSize);
|
||||
if (QFontInfo(tmpFont).pixelSize() != px)
|
||||
tmpFont.setPixelSize(px);
|
||||
|
||||
Settings::getInstance().setChatMessageFont(tmpFont);
|
||||
}
|
||||
|
||||
void GeneralForm::on_txtChatFontSize_valueChanged(int arg1)
|
||||
void GeneralForm::on_txtChatFontSize_valueChanged(int px)
|
||||
{
|
||||
Settings& s = Settings::getInstance();
|
||||
QFont tmpFont = s.getChatMessageFont();
|
||||
const int fontSize = QFontInfo(tmpFont).pixelSize();
|
||||
|
||||
if (tmpFont.pixelSize() != arg1)
|
||||
if (px != fontSize)
|
||||
{
|
||||
tmpFont.setPixelSize(arg1);
|
||||
tmpFont.setPixelSize(px);
|
||||
s.setChatMessageFont(tmpFont);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ private slots:
|
|||
void onThemeColorChanged(int);
|
||||
|
||||
void on_txtChatFont_currentFontChanged(const QFont& f);
|
||||
void on_txtChatFontSize_valueChanged(int arg1);
|
||||
void on_txtChatFontSize_valueChanged(int px);
|
||||
|
||||
private:
|
||||
void retranslateUi();
|
||||
|
|
Loading…
Reference in New Issue
Block a user