Changeset View
Changeset View
Standalone View
Standalone View
dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 88 | kpTransformResizeScaleDialog::kpTransformResizeScaleDialog ( | |||
---|---|---|---|---|---|
90 | : QDialog (parent), | 90 | : QDialog (parent), | ||
91 | m_environ (_env), | 91 | m_environ (_env), | ||
92 | m_ignoreKeepAspectRatio (0), | 92 | m_ignoreKeepAspectRatio (0), | ||
93 | m_lastType(kpTransformResizeScaleCommand::Resize) | 93 | m_lastType(kpTransformResizeScaleCommand::Resize) | ||
94 | { | 94 | { | ||
95 | setWindowTitle (i18nc ("@title:window", "Resize / Scale")); | 95 | setWindowTitle (i18nc ("@title:window", "Resize / Scale")); | ||
96 | QDialogButtonBox *buttons = new QDialogButtonBox (QDialogButtonBox::Ok | | 96 | QDialogButtonBox *buttons = new QDialogButtonBox (QDialogButtonBox::Ok | | ||
97 | QDialogButtonBox::Cancel, this); | 97 | QDialogButtonBox::Cancel, this); | ||
98 | connect (buttons, SIGNAL (accepted()), this, SLOT (accept())); | 98 | connect (buttons, &QDialogButtonBox::accepted, this, &kpTransformResizeScaleDialog::accept); | ||
99 | connect (buttons, SIGNAL (rejected()), this, SLOT (reject())); | 99 | connect (buttons, &QDialogButtonBox::rejected, this, &kpTransformResizeScaleDialog::reject); | ||
100 | 100 | | |||
101 | QWidget *baseWidget = new QWidget (this); | 101 | QWidget *baseWidget = new QWidget (this); | ||
102 | 102 | | |||
103 | QVBoxLayout *dialogLayout = new QVBoxLayout (this); | 103 | QVBoxLayout *dialogLayout = new QVBoxLayout (this); | ||
104 | dialogLayout->addWidget (baseWidget); | 104 | dialogLayout->addWidget (baseWidget); | ||
105 | dialogLayout->addWidget (buttons); | 105 | dialogLayout->addWidget (buttons); | ||
106 | 106 | | |||
107 | QWidget *actOnBox = createActOnBox(baseWidget); | 107 | QWidget *actOnBox = createActOnBox(baseWidget); | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | 160 | { | |||
186 | 186 | | |||
187 | 187 | | |||
188 | QHBoxLayout *lay = new QHBoxLayout (actOnBox); | 188 | QHBoxLayout *lay = new QHBoxLayout (actOnBox); | ||
189 | lay->setMargin (0); | 189 | lay->setMargin (0); | ||
190 | lay->addWidget (actOnLabel); | 190 | lay->addWidget (actOnLabel); | ||
191 | lay->addWidget (m_actOnCombo, 1); | 191 | lay->addWidget (m_actOnCombo, 1); | ||
192 | 192 | | |||
193 | 193 | | |||
194 | connect (m_actOnCombo, SIGNAL (activated(int)), | 194 | connect (m_actOnCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), | ||
195 | this, SLOT (slotActOnChanged())); | 195 | this, &kpTransformResizeScaleDialog::slotActOnChanged); | ||
196 | 196 | | |||
197 | return actOnBox; | 197 | return actOnBox; | ||
198 | } | 198 | } | ||
199 | 199 | | |||
200 | //--------------------------------------------------------------------- | 200 | //--------------------------------------------------------------------- | ||
201 | 201 | | |||
202 | static void toolButtonSetLook (QToolButton *button, | 202 | static void toolButtonSetLook (QToolButton *button, | ||
203 | const QString &iconName, | 203 | const QString &iconName, | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 220 | { | |||
259 | resizeScaleButtonGroup->addButton (m_smoothScaleButton); | 259 | resizeScaleButtonGroup->addButton (m_smoothScaleButton); | ||
260 | 260 | | |||
261 | 261 | | |||
262 | QGridLayout *operationLayout = new QGridLayout (operationGroupBox ); | 262 | QGridLayout *operationLayout = new QGridLayout (operationGroupBox ); | ||
263 | operationLayout->addWidget (m_resizeButton, 0, 0, Qt::AlignCenter); | 263 | operationLayout->addWidget (m_resizeButton, 0, 0, Qt::AlignCenter); | ||
264 | operationLayout->addWidget (m_scaleButton, 0, 1, Qt::AlignCenter); | 264 | operationLayout->addWidget (m_scaleButton, 0, 1, Qt::AlignCenter); | ||
265 | operationLayout->addWidget (m_smoothScaleButton, 0, 2, Qt::AlignCenter); | 265 | operationLayout->addWidget (m_smoothScaleButton, 0, 2, Qt::AlignCenter); | ||
266 | 266 | | |||
267 | connect (m_resizeButton, SIGNAL (toggled(bool)), | 267 | connect (m_resizeButton, &QToolButton::toggled, | ||
268 | this, SLOT (slotTypeChanged())); | 268 | this, &kpTransformResizeScaleDialog::slotTypeChanged); | ||
269 | connect (m_scaleButton, SIGNAL (toggled(bool)), | 269 | connect (m_scaleButton, &QToolButton::toggled, | ||
270 | this, SLOT (slotTypeChanged())); | 270 | this, &kpTransformResizeScaleDialog::slotTypeChanged); | ||
271 | connect (m_smoothScaleButton, SIGNAL (toggled(bool)), | 271 | connect (m_smoothScaleButton, &QToolButton::toggled, | ||
272 | this, SLOT (slotTypeChanged())); | 272 | this, &kpTransformResizeScaleDialog::slotTypeChanged); | ||
273 | 273 | | |||
274 | return operationGroupBox; | 274 | return operationGroupBox; | ||
275 | } | 275 | } | ||
276 | 276 | | |||
277 | //--------------------------------------------------------------------- | 277 | //--------------------------------------------------------------------- | ||
278 | // private | 278 | // private | ||
279 | 279 | | |||
280 | QGroupBox *kpTransformResizeScaleDialog::createDimensionsGroupBox(QWidget *baseWidget) | 280 | QGroupBox *kpTransformResizeScaleDialog::createDimensionsGroupBox(QWidget *baseWidget) | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 281 | { | |||
355 | dimensionsLayout->addWidget (xLabel2, 3, 2); | 355 | dimensionsLayout->addWidget (xLabel2, 3, 2); | ||
356 | dimensionsLayout->addWidget (m_percentHeightInput, 3, 3); | 356 | dimensionsLayout->addWidget (m_percentHeightInput, 3, 3); | ||
357 | 357 | | |||
358 | dimensionsLayout->addWidget (m_keepAspectRatioCheckBox, 4, 0, 1, 4); | 358 | dimensionsLayout->addWidget (m_keepAspectRatioCheckBox, 4, 0, 1, 4); | ||
359 | dimensionsLayout->setRowStretch (4/*row*/, 1); | 359 | dimensionsLayout->setRowStretch (4/*row*/, 1); | ||
360 | dimensionsLayout->setRowMinimumHeight (4/*row*/, dimensionsLayout->rowMinimumHeight (4) * 2); | 360 | dimensionsLayout->setRowMinimumHeight (4/*row*/, dimensionsLayout->rowMinimumHeight (4) * 2); | ||
361 | 361 | | |||
362 | 362 | | |||
363 | connect (m_newWidthInput, SIGNAL (valueChanged(int)), | 363 | | ||
364 | this, SLOT (slotWidthChanged(int))); | 364 | connect (m_newWidthInput, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), | ||
365 | connect (m_newHeightInput, SIGNAL (valueChanged(int)), | 365 | this, &kpTransformResizeScaleDialog::slotWidthChanged); | ||
366 | this, SLOT (slotHeightChanged(int))); | 366 | | ||
367 | connect (m_newHeightInput, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), | ||||
368 | this, &kpTransformResizeScaleDialog::slotHeightChanged); | ||||
367 | 369 | | |||
368 | // COMPAT: KDoubleNumInput only fires valueChanged(double) once per | 370 | // COMPAT: KDoubleNumInput only fires valueChanged(double) once per | ||
369 | // edit. It should either fire: | 371 | // edit. It should either fire: | ||
370 | // | 372 | // | ||
371 | // 1. At the end of the edit (triggered by clicking or tabbing | 373 | // 1. At the end of the edit (triggered by clicking or tabbing | ||
372 | // away), like with KDE 3. | 374 | // away), like with KDE 3. | ||
373 | // | 375 | // | ||
374 | // OR | 376 | // OR | ||
375 | // | 377 | // | ||
376 | // 2. Once per keystroke. | 378 | // 2. Once per keystroke. | ||
377 | // | 379 | // | ||
378 | // Bug in KDoubleNumInput. | 380 | // Bug in KDoubleNumInput. | ||
379 | connect (m_percentWidthInput, SIGNAL (valueChanged(double)), | 381 | connect (m_percentWidthInput, | ||
380 | this, SLOT (slotPercentWidthChanged(double))); | 382 | static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), | ||
381 | connect (m_percentHeightInput, SIGNAL (valueChanged(double)), | 383 | this, &kpTransformResizeScaleDialog::slotPercentWidthChanged); | ||
382 | this, SLOT (slotPercentHeightChanged(double))); | 384 | | ||
385 | connect (m_percentHeightInput, | ||||
386 | static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), | ||||
387 | this, &kpTransformResizeScaleDialog::slotPercentHeightChanged); | ||||
383 | 388 | | |||
384 | connect (m_keepAspectRatioCheckBox, SIGNAL (toggled(bool)), | 389 | connect (m_keepAspectRatioCheckBox, &QCheckBox::toggled, | ||
385 | this, SLOT (setKeepAspectRatio(bool))); | 390 | this, &kpTransformResizeScaleDialog::setKeepAspectRatio); | ||
386 | 391 | | |||
387 | return dimensionsGroupBox; | 392 | return dimensionsGroupBox; | ||
388 | } | 393 | } | ||
389 | 394 | | |||
390 | //--------------------------------------------------------------------- | 395 | //--------------------------------------------------------------------- | ||
391 | // private | 396 | // private | ||
392 | 397 | | |||
393 | void kpTransformResizeScaleDialog::widthFitHeightToAspectRatio () | 398 | void kpTransformResizeScaleDialog::widthFitHeightToAspectRatio () | ||
▲ Show 20 Lines • Show All 430 Lines • Show Last 20 Lines |