Skip to content

Commit 9e00843

Browse files
committed
Updated UiConnection.py and ui_design.ui to adjust sidebar logo size based on maximum size setting
1 parent 7221063 commit 9e00843

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

Core/UiConnection.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ def init_ui(self):
241241
if logo_path:
242242
pixmap = QPixmap(logo_path)
243243
target_size = 200
244+
try:
245+
max_sz = self.sidebar_logo.maximumSize()
246+
if max_sz and max_sz.width() > 0 and max_sz.height() > 0:
247+
target_size = min(target_size, max_sz.width(), max_sz.height())
248+
except Exception:
249+
pass
244250
self.sidebar_logo.setPixmap(
245251
pixmap.scaled(
246252
target_size,
@@ -625,6 +631,14 @@ def apply_theme(self, pref: str):
625631
if logo_path:
626632
pixmap = QPixmap(logo_path)
627633
target_size = 200
634+
try:
635+
max_sz = self.sidebar_logo.maximumSize()
636+
if max_sz and max_sz.width() > 0 and max_sz.height() > 0:
637+
target_size = min(
638+
target_size, max_sz.width(), max_sz.height()
639+
)
640+
except Exception:
641+
pass
628642
self.sidebar_logo.setPixmap(
629643
pixmap.scaled(
630644
target_size,

ui/ui_design.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
</property>
6161
<property name="maximumSize">
6262
<size>
63-
<width>120</width>
64-
<height>120</height>
63+
<width>200</width>
64+
<height>200</height>
6565
</size>
6666
</property>
6767
<property name="alignment">

ui/ui_design_ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def setupUi(self, PyCompilerARKGui):
4040
self.sidebar_logo = QLabel(self.header)
4141
self.sidebar_logo.setObjectName(u"sidebar_logo")
4242
self.sidebar_logo.setMinimumSize(QSize(48, 48))
43-
self.sidebar_logo.setMaximumSize(QSize(120, 120))
43+
self.sidebar_logo.setMaximumSize(QSize(200, 200))
4444
self.sidebar_logo.setAlignment(Qt.AlignmentFlag.AlignCenter)
4545

4646
self.headerLayout.addWidget(self.sidebar_logo)

0 commit comments

Comments
 (0)