| 934 | */ |
| 935 | |
| 936 | void ControlPanelDialog::createBackgroundTab() { |
| 937 | backgroundTab = new QWidget(this); |
| 938 | QVBoxLayout *layout = new QVBoxLayout(backgroundTab); |
| 939 | |
| 940 | // Add some spacing at the top |
| 941 | layout->addSpacing(10); |
| 942 | |
| 943 | // Title |
| 944 | QLabel *titleLabel = new QLabel(tr("Default Page & Background Settings"), backgroundTab); |
| 945 | titleLabel->setStyleSheet("font-size: 16px; font-weight: bold;"); |
| 946 | layout->addWidget(titleLabel); |
| 947 | |
| 948 | QLabel *descLabel = new QLabel(tr("These settings apply to newly created documents only. " |
| 949 | "Background changes will also be applied to the current document."), backgroundTab); |
| 950 | descLabel->setWordWrap(true); |
| 951 | descLabel->setStyleSheet("color: gray; font-size: 11px; margin-bottom: 15px;"); |
| 952 | layout->addWidget(descLabel); |
| 953 | |
| 954 | // ========== PAGE SIZE SECTION ========== |
| 955 | QLabel *pageSectionLabel = new QLabel(tr("Default Page Size"), backgroundTab); |
| 956 | pageSectionLabel->setStyleSheet("font-weight: bold; margin-top: 5px;"); |
| 957 | layout->addWidget(pageSectionLabel); |
| 958 | |
| 959 | // Page Size Preset |
| 960 | QHBoxLayout *pageSizeLayout = new QHBoxLayout(); |
| 961 | QLabel *pageSizeLabel = new QLabel(tr("Paper Size:"), backgroundTab); |
| 962 | pageSizeLabel->setMinimumWidth(120); |
| 963 | pageSizeLayout->addWidget(pageSizeLabel); |
| 964 | |
| 965 | pageSizeCombo = new QComboBox(backgroundTab); |
| 966 | // ISO/JIS sizes (commonly used internationally) |
| 967 | // Format: "Name", QVariant with QSizeF(width, height) at 96 DPI |
| 968 | // mm to px at 96 DPI: mm * 96 / 25.4 |
| 969 | pageSizeCombo->addItem(tr("A3 (297 × 420 mm)"), QSizeF(1123, 1587)); |
| 970 | pageSizeCombo->addItem(tr("B4 (250 × 353 mm)"), QSizeF(945, 1334)); |
| 971 | pageSizeCombo->addItem(tr("A4 (210 × 297 mm)"), QSizeF(794, 1123)); |
| 972 | pageSizeCombo->addItem(tr("B5 (176 × 250 mm)"), QSizeF(665, 945)); |
| 973 | pageSizeCombo->addItem(tr("A5 (148 × 210 mm)"), QSizeF(559, 794)); |
| 974 | // US Imperial sizes (commonly used in US) |
| 975 | pageSizeCombo->addItem(tr("US Letter (8.5 × 11 in)"), QSizeF(816, 1056)); |
| 976 | pageSizeCombo->addItem(tr("US Legal (8.5 × 14 in)"), QSizeF(816, 1344)); |
| 977 | pageSizeCombo->addItem(tr("US Tabloid (11 × 17 in)"), QSizeF(1056, 1632)); |
| 978 | |
| 979 | connect(pageSizeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), |
| 980 | this, &ControlPanelDialog::onPageSizePresetChanged); |
| 981 | pageSizeLayout->addWidget(pageSizeCombo, 1); |
| 982 | layout->addLayout(pageSizeLayout); |
| 983 | |
| 984 | // Page Size Dimensions (read-only display) |
| 985 | QHBoxLayout *pageDimLayout = new QHBoxLayout(); |
| 986 | QLabel *pageDimLabel = new QLabel(tr("Dimensions:"), backgroundTab); |
| 987 | pageDimLabel->setMinimumWidth(120); |
| 988 | pageDimLayout->addWidget(pageDimLabel); |
| 989 | |
| 990 | pageSizeDimLabel = new QLabel(backgroundTab); |
| 991 | pageSizeDimLabel->setStyleSheet("color: #666; font-style: italic;"); |
| 992 | pageDimLayout->addWidget(pageSizeDimLabel); |
| 993 | pageDimLayout->addStretch(); |
nothing calls this directly
no test coverage detected