mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #4137
Yuri (1): fix(font): Made font changes in settings apply on screen instantly.
This commit is contained in:
commit
d320b1f259
|
@ -118,6 +118,12 @@ void ChatLine::selectionFocusChanged(bool focusIn)
|
||||||
c->selectionFocusChanged(focusIn);
|
c->selectionFocusChanged(focusIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatLine::fontChanged(const QFont& font)
|
||||||
|
{
|
||||||
|
for (ChatLineContent* c : content)
|
||||||
|
c->fontChanged(font);
|
||||||
|
}
|
||||||
|
|
||||||
int ChatLine::getColumnCount()
|
int ChatLine::getColumnCount()
|
||||||
{
|
{
|
||||||
return content.size();
|
return content.size();
|
||||||
|
|
|
@ -29,6 +29,7 @@ class ChatLog;
|
||||||
class ChatLineContent;
|
class ChatLineContent;
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
class QStyleOptionGraphicsItem;
|
class QStyleOptionGraphicsItem;
|
||||||
|
class QFont;
|
||||||
|
|
||||||
struct ColumnFormat
|
struct ColumnFormat
|
||||||
{
|
{
|
||||||
|
@ -75,6 +76,7 @@ public:
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
void selectionCleared();
|
void selectionCleared();
|
||||||
void selectionFocusChanged(bool focusIn);
|
void selectionFocusChanged(bool focusIn);
|
||||||
|
void fontChanged(const QFont& font);
|
||||||
|
|
||||||
int getColumnCount();
|
int getColumnCount();
|
||||||
int getRow() const;
|
int getRow() const;
|
||||||
|
|
|
@ -75,6 +75,10 @@ QString ChatLineContent::getSelectedText() const
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatLineContent::fontChanged(const QFont& font)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
qreal ChatLineContent::getAscent() const
|
qreal ChatLineContent::getAscent() const
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
virtual void selectionFocusChanged(bool focusIn);
|
virtual void selectionFocusChanged(bool focusIn);
|
||||||
virtual bool isOverSelection(QPointF scenePos) const;
|
virtual bool isOverSelection(QPointF scenePos) const;
|
||||||
virtual QString getSelectedText() const;
|
virtual QString getSelectedText() const;
|
||||||
|
virtual void fontChanged(const QFont& font);
|
||||||
|
|
||||||
virtual QString getText() const;
|
virtual QString getText() const;
|
||||||
|
|
||||||
|
|
|
@ -647,6 +647,14 @@ void ChatLog::selectAll()
|
||||||
updateMultiSelectionRect();
|
updateMultiSelectionRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatLog::fontChanged(const QFont& font)
|
||||||
|
{
|
||||||
|
for (ChatLine::Ptr l : lines)
|
||||||
|
{
|
||||||
|
l->fontChanged(font);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ChatLog::forceRelayout()
|
void ChatLog::forceRelayout()
|
||||||
{
|
{
|
||||||
startResizeWorker();
|
startResizeWorker();
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
void setTypingNotificationVisible(bool visible);
|
void setTypingNotificationVisible(bool visible);
|
||||||
void scrollToLine(ChatLine::Ptr line);
|
void scrollToLine(ChatLine::Ptr line);
|
||||||
void selectAll();
|
void selectAll();
|
||||||
|
void fontChanged(const QFont& font);
|
||||||
|
|
||||||
QString getSelectedText() const;
|
QString getSelectedText() const;
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,11 @@ QString Text::getSelectedText() const
|
||||||
return selectedText;
|
return selectedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Text::fontChanged(const QFont& font)
|
||||||
|
{
|
||||||
|
defFont = font;
|
||||||
|
}
|
||||||
|
|
||||||
QRectF Text::boundingRect() const
|
QRectF Text::boundingRect() const
|
||||||
{
|
{
|
||||||
return QRectF(QPointF(0, 0), size);
|
return QRectF(QPointF(0, 0), size);
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
virtual void selectionFocusChanged(bool focusIn) final;
|
virtual void selectionFocusChanged(bool focusIn) final;
|
||||||
virtual bool isOverSelection(QPointF scenePos) const final;
|
virtual bool isOverSelection(QPointF scenePos) const final;
|
||||||
virtual QString getSelectedText() const final;
|
virtual QString getSelectedText() const final;
|
||||||
|
virtual void fontChanged(const QFont& font) final;
|
||||||
|
|
||||||
virtual QRectF boundingRect() const final;
|
virtual QRectF boundingRect() const final;
|
||||||
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) final;
|
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) final;
|
||||||
|
|
|
@ -93,6 +93,8 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
const Settings& s = Settings::getInstance();
|
const Settings& s = Settings::getInstance();
|
||||||
connect(&s, &Settings::emojiFontPointSizeChanged,
|
connect(&s, &Settings::emojiFontPointSizeChanged,
|
||||||
chatWidget, &ChatLog::forceRelayout);
|
chatWidget, &ChatLog::forceRelayout);
|
||||||
|
connect(&s, &Settings::chatMessageFontChanged,
|
||||||
|
this, &GenericChatForm::onChatMessageFontChanged);
|
||||||
|
|
||||||
msgEdit = new ChatTextEdit();
|
msgEdit = new ChatTextEdit();
|
||||||
|
|
||||||
|
@ -479,6 +481,15 @@ void GenericChatForm::focusInput()
|
||||||
msgEdit->setFocus();
|
msgEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::onChatMessageFontChanged(const QFont& font) {
|
||||||
|
// chat log
|
||||||
|
chatWidget->fontChanged(font);
|
||||||
|
chatWidget->forceRelayout();
|
||||||
|
// message editor
|
||||||
|
msgEdit->setStyleSheet(Style::getStylesheet(":/ui/msgEdit/msgEdit.css")
|
||||||
|
+ fontToCss(font, "QTextEdit"));
|
||||||
|
}
|
||||||
|
|
||||||
void GenericChatForm::addSystemInfoMessage(const QString &message, ChatMessage::SystemMessageType type, const QDateTime &datetime)
|
void GenericChatForm::addSystemInfoMessage(const QString &message, ChatMessage::SystemMessageType type, const QDateTime &datetime)
|
||||||
{
|
{
|
||||||
previousId = ToxPk();
|
previousId = ToxPk();
|
||||||
|
|
|
@ -83,6 +83,7 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void focusInput();
|
void focusInput();
|
||||||
|
void onChatMessageFontChanged(const QFont& font);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onChatContextMenuRequested(QPoint pos);
|
void onChatContextMenuRequested(QPoint pos);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user