r25012 by craig - QDialogButtonBox migration: InsertPage

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 10 22:52:44 UTC 2022


Author: craig
Date: Thu Mar 10 22:52:44 2022
New Revision: 25012

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25012
Log:
QDialogButtonBox migration: InsertPage

Modified:
    branches/Version15x/Scribus/scribus/ui/inspage.cpp
    branches/Version15x/Scribus/scribus/ui/inspage.h

Modified: branches/Version15x/Scribus/scribus/ui/inspage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25012&path=/branches/Version15x/Scribus/scribus/ui/inspage.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/inspage.cpp	(original)
+++ branches/Version15x/Scribus/scribus/ui/inspage.cpp	Thu Mar 10 22:52:44 2022
@@ -289,26 +289,15 @@
 	heightSpinBox->setEnabled(b);
 	widthSpinBox->setEnabled(b);
 
-	okCancelLayout = new QHBoxLayout;
-	okCancelLayout->setSpacing(6);
-	okCancelLayout->setContentsMargins(0, 0, 0, 0);
-	QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
-	okCancelLayout->addItem(spacer);
-
-	okButton = new QPushButton(CommonStrings::tr_OK, this);
-	okButton->setDefault(true);
-	okCancelLayout->addWidget(okButton);
-
-	cancelButton = new QPushButton(CommonStrings::tr_Cancel, this);
-	okCancelLayout->addWidget(cancelButton);
-	dialogLayout->addLayout(okCancelLayout);
+	buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+	dialogLayout->addWidget(buttonBox);
 	setMaximumSize(sizeHint());
 	m_unitRatio = m_doc->unitRatio();
 
 	// signals and slots connections
 	connect(insWhereData, SIGNAL( activated(int) ), this, SLOT( insWherePageDataDisable(int) ) );
-	connect(okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
-	connect(cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+	connect(buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
+	connect(buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
 	connect(orientationQComboBox, SIGNAL(activated(int)), this, SLOT(setOrientation(int)));
 	connect(sizeQComboBox, SIGNAL(activated(const QString &)), this, SLOT(setSize(const QString &)));
 	connect(overrideMPSizingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableSizingControls(int)));

Modified: branches/Version15x/Scribus/scribus/ui/inspage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25012&path=/branches/Version15x/Scribus/scribus/ui/inspage.h
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/inspage.h	(original)
+++ branches/Version15x/Scribus/scribus/ui/inspage.h	Thu Mar 10 22:52:44 2022
@@ -9,6 +9,7 @@
 
 #include "scribusapi.h"
 #include <QDialog>
+#include <QDialogButtonBox>
 #include <QList>
 #include <QStringList>
 #include <QGridLayout>
@@ -52,8 +53,7 @@
 	QLabel* insCountLabel { nullptr };
 	QLabel* masterPageLabel { nullptr };
 	QLabel* pagesLabel { nullptr };
-	QPushButton* cancelButton { nullptr };
-	QPushButton* okButton { nullptr };
+	QDialogButtonBox* buttonBox { nullptr };
 	QComboBox* insWhereData { nullptr };
 	QSpinBox* insWherePageData { nullptr };
 	QSpinBox* insCountData { nullptr };




More information about the scribus-commit mailing list