MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / PrintWidget

Method PrintWidget

src/gui/print_widget.cpp:128–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126//### PrintWidget ###
127
128PrintWidget::PrintWidget(Map* map, MainWindow* main_window, MapView* main_view, MapEditorController* editor, QWidget* parent)
129: QWidget { parent }
130, task { UNDEFINED_TASK }
131, map { map }
132, map_printer { new MapPrinter(*map, main_view) }
133, main_window { main_window }
134, main_view { main_view }
135, editor { editor }
136, print_tool { nullptr }
137, active { false }
138{
139 Q_ASSERT(main_window);
140
141 layout = new QFormLayout();
142
143 target_combo = new QComboBox();
144 target_combo->setMinimumWidth(1); // Not zero, but not as long as the items
145 layout->addRow(Util::Headline::create(tr("Printer:")), target_combo);
146
147 if (PlatformPrinterProperties::dialogSupported())
148 {
149 printer_properties_button = new QToolButton();
150 printer_properties_button->setText(tr("Properties"));
151 layout->addRow(nullptr, printer_properties_button);
152 }
153 else
154 {
155 printer_properties_button = nullptr;
156 }
157
158 paper_size_combo = new QComboBox();
159 layout->addRow(tr("Page format:"), paper_size_combo);
160
161 auto page_size_widget = new QWidget();
162 auto page_size_layout = new QHBoxLayout();
163 page_size_widget->setLayout(page_size_layout);
164 page_size_layout->setMargin(0);
165 page_width_edit = Util::SpinBox::create(1, 0.1, 1000.0, tr("mm"), 1.0);
166 page_width_edit->setEnabled(false);
167 page_size_layout->addWidget(page_width_edit, 1);
168 page_size_layout->addWidget(new QLabel(QString::fromLatin1("x")), 0);
169 page_height_edit = Util::SpinBox::create(1, 0.1, 1000.0, tr("mm"), 1.0);
170 page_height_edit->setEnabled(false);
171 page_size_layout->addWidget(page_height_edit, 1);
172 layout->addRow({}, page_size_widget);
173
174 page_orientation_widget = new QWidget();
175 auto page_orientation_layout = new QHBoxLayout();
176 page_orientation_layout->setContentsMargins(QMargins());
177 page_orientation_widget->setLayout(page_orientation_layout);
178 auto portrait_button = new QRadioButton(tr("Portrait"));
179 page_orientation_layout->addWidget(portrait_button);
180 auto landscape_button = new QRadioButton(tr("Landscape"));
181 page_orientation_layout->addWidget(landscape_button);
182 page_orientation_group = new QButtonGroup(this);
183 page_orientation_group->addButton(portrait_button, QPrinter::Portrait);
184 page_orientation_group->addButton(landscape_button, QPrinter::Landscape);
185 layout->addRow(tr("Page orientation:"), page_orientation_widget);

Callers

nothing calls this directly

Calls 15

createPrintModeButtonFunction · 0.85
QLatin1StringClass · 0.85
standardIconMethod · 0.80
pixelMetricMethod · 0.80
pixmapMethod · 0.80
hasSpotColorsMethod · 0.80
createFunction · 0.70
dialogSupportedFunction · 0.50
QIconClass · 0.50
QVariantClass · 0.50
addRowMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected