Skip to content

Commit 7301c49

Browse files
authored
fix: Fixed the Compact Mode issue (#42)
Fixed the Compact Mode issue Bug: https://pms.uniontech.com/bug-view-202377.html Log: Fixed the Compact Mode issue
1 parent 111df39 commit 7301c49

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/mainwidget.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,29 @@ void MainWidget::setupUi(QWidget *Widget)
256256
connect(m_plainTextEdit, &QPlainTextEdit::redoAvailable, redoBtn, &QPushButton::setEnabled);
257257
redoBtn->setEnabled(false);
258258

259+
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::CompactMode) {
260+
languageSelectBox->setFixedSize(160, 24);
261+
m_copyBtn->setMaximumSize(QSize(24, 24));
262+
m_exportBtn->setMaximumSize(QSize(24, 24));
263+
undoBtn->setMaximumSize(24, 24);
264+
redoBtn->setMaximumSize(24, 24);
265+
}
266+
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [=](DGuiApplicationHelper::SizeMode sizeMode) {
267+
if (sizeMode == DGuiApplicationHelper::NormalMode) {
268+
languageSelectBox->setFixedSize(160, 36);
269+
m_copyBtn->setMaximumSize(QSize(36, 36));
270+
m_exportBtn->setMaximumSize(QSize(36, 36));
271+
undoBtn->setMaximumSize(36, 36);
272+
redoBtn->setMaximumSize(36, 36);
273+
} else {
274+
languageSelectBox->setFixedSize(160, 24);
275+
m_copyBtn->setMaximumSize(QSize(24, 24));
276+
m_exportBtn->setMaximumSize(QSize(24, 24));
277+
undoBtn->setMaximumSize(24, 24);
278+
redoBtn->setMaximumSize(24, 24);
279+
}
280+
});
281+
259282
//占位用空白控件
260283
m_emptyWidget = new QWidget;
261284
m_emptyWidget->setMinimumSize(36 * 2, 36 * 2);

0 commit comments

Comments
 (0)