refactor: simplify updateSize

This commit is contained in:
sithlord48
2025-01-08 11:27:11 -05:00
committed by Nick Bolton
parent dd0812c201
commit 8533348c88
2 changed files with 10 additions and 10 deletions

View File

@ -316,8 +316,8 @@ void MainWindow::toggleLogVisible(bool visible)
ui->textLog->setVisible(false);
m_AppConfig.setLogExpanded(false);
}
// 10 ms is long enough to process events and quick enough to not see the visual change.
QTimer::singleShot(10, this, &MainWindow::updateSize);
// 1 ms delay is to make sure we have left the function before calling updateSize
QTimer::singleShot(1, this, &MainWindow::updateSize);
}
void MainWindow::onShown()
@ -469,16 +469,10 @@ void MainWindow::resetCore()
void MainWindow::updateSize()
{
#ifdef Q_OS_MAC
// On mac os the titlebar is part of the height so we need to adjust our Y coord to avoid moving the window up
const auto kTitleBarOffset = 28;
#else
const auto kTitleBarOffset = 0;
#endif
if (ui->textLog->isVisible()) {
setMaximumHeight(16777215);
setMaximumWidth(16777215);
setGeometry(x(), y() + kTitleBarOffset, m_expandedSize.width(), m_expandedSize.height());
resize(m_expandedSize);
} else {
adjustSize();
// Prevent Resize with log collapsed

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -91,6 +91,12 @@
</item>
<item>
<widget class="QLabel" name="lblMyFingerprint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;TLS enabled (&lt;a href=&quot;#&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#4285f4;&quot;&gt;fingerprint&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>