|
20 | 20 | #include <QtGui/QTextCharFormat> |
21 | 21 | #include <QtGui/QTextCursor> |
22 | 22 | #include <QtGui/QTextOption> |
| 23 | +#include <QtWidgets/QGridLayout> |
23 | 24 | #include <QtWidgets/QHBoxLayout> |
24 | 25 | #include <QtWidgets/QLabel> |
25 | 26 | #include <QtWidgets/QPlainTextEdit> |
@@ -424,28 +425,47 @@ QWidget *WorkbenchPage::createReceiveSettingsSection() |
424 | 425 | m_displayModeSegment->setCurrentItem(QStringLiteral("text")); |
425 | 426 | root->addWidget(m_displayModeSegment); |
426 | 427 |
|
427 | | - root->addWidget(createCheckRow({QStringLiteral("保存接收"), QStringLiteral("自动滚动")}, |
428 | | - {&m_saveReceiveCheck, &m_autoScrollCheck}, |
429 | | - section)); |
430 | | - root->addWidget(createCheckRow({QStringLiteral("时间戳"), QStringLiteral("暂停显示")}, |
431 | | - {&m_timestampCheck, &m_pauseCheck}, |
432 | | - section)); |
| 428 | + auto *receiveOptions = new QWidget(section); |
| 429 | + auto *receiveOptionsGrid = new QGridLayout(receiveOptions); |
| 430 | + receiveOptionsGrid->setContentsMargins(0, 0, 0, 0); |
| 431 | + receiveOptionsGrid->setHorizontalSpacing(12); |
| 432 | + receiveOptionsGrid->setVerticalSpacing(6); |
| 433 | + receiveOptionsGrid->setColumnStretch(0, 1); |
| 434 | + receiveOptionsGrid->setColumnStretch(1, 1); |
| 435 | + m_saveReceiveCheck = new CheckBox(QStringLiteral("保存接收"), receiveOptions); |
| 436 | + m_autoScrollCheck = new CheckBox(QStringLiteral("自动滚动"), receiveOptions); |
| 437 | + m_timestampCheck = new CheckBox(QStringLiteral("时间戳"), receiveOptions); |
| 438 | + m_pauseCheck = new CheckBox(QStringLiteral("暂停显示"), receiveOptions); |
| 439 | + for(CheckBox *check : {m_saveReceiveCheck, m_autoScrollCheck, m_timestampCheck, m_pauseCheck}) { |
| 440 | + check->setMinimumWidth(0); |
| 441 | + check->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
| 442 | + } |
| 443 | + receiveOptionsGrid->addWidget(m_saveReceiveCheck, 0, 0); |
| 444 | + receiveOptionsGrid->addWidget(m_autoScrollCheck, 0, 1); |
| 445 | + receiveOptionsGrid->addWidget(m_timestampCheck, 1, 0); |
| 446 | + receiveOptionsGrid->addWidget(m_pauseCheck, 1, 1); |
| 447 | + root->addWidget(receiveOptions); |
433 | 448 |
|
434 | 449 | auto *frameRowWidget = new QWidget(section); |
435 | 450 | auto *frameRow = new QHBoxLayout(frameRowWidget); |
436 | 451 | frameRow->setContentsMargins(0, 0, 0, 0); |
437 | | - frameRow->setSpacing(10); |
| 452 | + frameRow->setSpacing(6); |
438 | 453 | m_autoFrameBreakCheck = new CheckBox(QStringLiteral("自动断帧"), frameRowWidget); |
439 | 454 | m_autoFrameBreakCheck->setMinimumWidth(0); |
440 | 455 | m_autoFrameBreakCheck->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
441 | 456 | m_frameBreakIntervalSpin = new SpinBox(frameRowWidget); |
442 | 457 | m_frameBreakIntervalSpin->setRange(1, 60000); |
443 | 458 | m_frameBreakIntervalSpin->setValue(20); |
444 | | - m_frameBreakIntervalSpin->setSuffix(QStringLiteral(" ms")); |
| 459 | + m_frameBreakIntervalSpin->setSymbolVisible(false); |
445 | 460 | m_frameBreakIntervalSpin->setFixedHeight(CompactControlHeight); |
446 | | - setFixedControlWidth(m_frameBreakIntervalSpin, 116); |
| 461 | + setFixedControlWidth(m_frameBreakIntervalSpin, 92); |
| 462 | + auto *frameBreakUnitLabel = new CaptionLabel(QStringLiteral("ms"), frameRowWidget); |
| 463 | + frameBreakUnitLabel->setFixedHeight(CompactControlHeight); |
| 464 | + frameBreakUnitLabel->setFixedWidth(22); |
| 465 | + frameBreakUnitLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); |
447 | 466 | frameRow->addWidget(m_autoFrameBreakCheck); |
448 | 467 | frameRow->addWidget(m_frameBreakIntervalSpin); |
| 468 | + frameRow->addWidget(frameBreakUnitLabel); |
449 | 469 | root->addWidget(frameRowWidget); |
450 | 470 |
|
451 | 471 | auto *actionRow = new QHBoxLayout; |
@@ -542,25 +562,29 @@ QWidget *WorkbenchPage::createSendSettingsSection() |
542 | 562 | m_lineEndingCombo->setCurrentIndex(0); |
543 | 563 | addFormRow(root, QStringLiteral("换行"), m_lineEndingCombo); |
544 | 564 |
|
545 | | - auto *txRowWidget = new QWidget(section); |
546 | | - auto *txRow = new QHBoxLayout(txRowWidget); |
547 | | - txRow->setContentsMargins(0, 0, 0, 0); |
548 | | - txRow->setSpacing(10); |
549 | | - m_hexSendCheck = new CheckBox(QStringLiteral("HEX 发送"), txRowWidget); |
550 | | - m_hexSendCheck->setMinimumWidth(0); |
551 | | - m_hexSendCheck->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
552 | | - m_showTxCheck = new CheckBox(QStringLiteral("显示发送字符串"), txRowWidget); |
553 | | - m_showTxCheck->setMinimumWidth(0); |
554 | | - m_showTxCheck->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
555 | | - m_txColorButton = new ColorPickerButton(defaultTxColor(), QStringLiteral("TX 颜色"), txRowWidget); |
| 565 | + auto *sendOptions = new QWidget(section); |
| 566 | + auto *sendOptionsGrid = new QGridLayout(sendOptions); |
| 567 | + sendOptionsGrid->setContentsMargins(0, 0, 0, 0); |
| 568 | + sendOptionsGrid->setHorizontalSpacing(12); |
| 569 | + sendOptionsGrid->setVerticalSpacing(6); |
| 570 | + sendOptionsGrid->setColumnStretch(0, 1); |
| 571 | + sendOptionsGrid->setColumnStretch(1, 1); |
| 572 | + m_hexSendCheck = new CheckBox(QStringLiteral("HEX 发送"), sendOptions); |
| 573 | + m_showTxCheck = new CheckBox(QStringLiteral("显示发送字符串"), sendOptions); |
| 574 | + m_loopCheck = new CheckBox(QStringLiteral("定时发送"), sendOptions); |
| 575 | + m_autoReconnectCheck = new CheckBox(QStringLiteral("自动重连"), sendOptions); |
| 576 | + for(CheckBox *check : {m_hexSendCheck, m_showTxCheck, m_loopCheck, m_autoReconnectCheck}) { |
| 577 | + check->setMinimumWidth(0); |
| 578 | + check->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
| 579 | + } |
| 580 | + m_txColorButton = new ColorPickerButton(defaultTxColor(), QStringLiteral("TX 颜色"), sendOptions); |
556 | 581 | m_txColorButton->setFixedSize(64, CompactControlHeight); |
557 | | - txRow->addWidget(m_hexSendCheck); |
558 | | - txRow->addWidget(m_showTxCheck); |
559 | | - txRow->addWidget(m_txColorButton); |
560 | | - root->addWidget(txRowWidget); |
561 | | - root->addWidget(createCheckRow({QStringLiteral("定时发送"), QStringLiteral("自动重连")}, |
562 | | - {&m_loopCheck, &m_autoReconnectCheck}, |
563 | | - section)); |
| 582 | + sendOptionsGrid->addWidget(m_hexSendCheck, 0, 0); |
| 583 | + sendOptionsGrid->addWidget(m_showTxCheck, 0, 1); |
| 584 | + sendOptionsGrid->addWidget(m_txColorButton, 0, 2); |
| 585 | + sendOptionsGrid->addWidget(m_loopCheck, 1, 0); |
| 586 | + sendOptionsGrid->addWidget(m_autoReconnectCheck, 1, 1); |
| 587 | + root->addWidget(sendOptions); |
564 | 588 |
|
565 | 589 | m_historyCombo = new ComboBox(section); |
566 | 590 | makeCompactControl(m_historyCombo); |
|
0 commit comments