Attempt for forums tree fonts settings

This commit is contained in:
defnax 2025-02-12 19:26:16 +01:00
parent 49242e185b
commit cd338613c1
2 changed files with 30 additions and 0 deletions
retroshare-gui/src/gui/gxsforums

@ -250,6 +250,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
ui->setupUi(this);
//setUpdateWhenInvisible(true);
updateFontSize();
//mUpdating = false;
mUnreadCount = 0;
@ -367,6 +368,8 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
blankPost();
ui->subscribeToolButton->setToolTip(tr( "<p>Subscribing to the forum will gather \
available posts from your subscribed friends, and make the \
forum visible to all other friends.</p><p>Afterwards you can unsubscribe from the context menu of the forum list at left.</p>"));
@ -2099,3 +2102,27 @@ void GxsForumThreadWidget::showAuthorInPeople(const RsGxsForumMsg& msg)
MainWindow::showWindow(MainWindow::People);
idDialog->navigate(RsGxsId(msg.mMeta.mAuthorId));
}
void GxsForumThreadWidget::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void GxsForumThreadWidget::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 12).toInt();
#endif
QFont newFont = ui->threadTreeWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
ui->threadTreeWidget->setFont(newFont);
int iconHeight = fontMetrics.height() * 1.4;
ui->threadTreeWidget->setIconSize(QSize(iconHeight, iconHeight));
}
}

@ -97,6 +97,7 @@ public:
protected:
//bool eventFilter(QObject *obj, QEvent *ev);
//void changeEvent(QEvent *e);
virtual void showEvent(QShowEvent *) override;
/* RsGxsUpdateBroadcastWidget */
virtual void updateDisplay(bool complete);
@ -160,6 +161,8 @@ private slots:
void filterColumnChanged(int column);
void filterItems(const QString &text);
void updateFontSize();
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
void expandSubtree();
#endif