r25017 by craig - QDialogButtonBox migration: Delete and Move pages
scribus-commit
scribus-commit at lists.scribus.net
Fri Mar 11 21:37:59 UTC 2022
Author: craig
Date: Fri Mar 11 21:37:59 2022
New Revision: 25017
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25017
Log:
QDialogButtonBox migration: Delete and Move pages
Modified:
trunk/Scribus/scribus/ui/delpages.cpp
trunk/Scribus/scribus/ui/delpages.h
trunk/Scribus/scribus/ui/movepage.cpp
trunk/Scribus/scribus/ui/movepage.h
Modified: trunk/Scribus/scribus/ui/delpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25017&path=/trunk/Scribus/scribus/ui/delpages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/delpages.cpp (original)
+++ trunk/Scribus/scribus/ui/delpages.cpp Fri Mar 11 21:37:59 2022
@@ -46,23 +46,13 @@
fromToLayout->addWidget( toPageData );
dialogLayout->addLayout( fromToLayout );
- 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 );
- cancelButton->setDefault( false );
- okCancelLayout->addWidget(cancelButton);
- dialogLayout->addLayout( okCancelLayout );
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ dialogLayout->addWidget( buttonBox );
setMaximumSize(sizeHint());
// signals and slots connections
- connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &DelPages::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &DelPages::reject);
connect( fromPageData, SIGNAL( valueChanged(double) ), this, SLOT( fromChanged() ) );
connect( toPageData, SIGNAL( valueChanged(double) ), this, SLOT( toChanged() ) );
}
Modified: trunk/Scribus/scribus/ui/delpages.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25017&path=/trunk/Scribus/scribus/ui/delpages.h
==============================================================================
--- trunk/Scribus/scribus/ui/delpages.h (original)
+++ trunk/Scribus/scribus/ui/delpages.h Fri Mar 11 21:37:59 2022
@@ -8,9 +8,10 @@
#define DELPAGES_H
#include "scribusapi.h"
+#include <QDialog>
+#include <QDialogButtonBox>
+#include <QHBoxLayout>
#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QDialog>
class QLabel;
class QPushButton;
@@ -30,10 +31,7 @@
private:
QVBoxLayout* dialogLayout;
QHBoxLayout* fromToLayout;
- QHBoxLayout* okCancelLayout;
-
- QPushButton* cancelButton;
- QPushButton* okButton;
+ QDialogButtonBox* buttonBox;
QLabel* fromLabel;
QLabel* toLabel;
ScrSpinBox* toPageData;
Modified: trunk/Scribus/scribus/ui/movepage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25017&path=/trunk/Scribus/scribus/ui/movepage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/movepage.cpp (original)
+++ trunk/Scribus/scribus/ui/movepage.cpp Fri Mar 11 21:37:59 2022
@@ -96,17 +96,8 @@
// fromToLayout->addColumnSpacing(0, moveLabel->fontMetrics().width( tr( "Move Page(s):")));
dialogLayout->addLayout( fromToLayout );
- 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());
// signals and slots connections
@@ -116,8 +107,8 @@
connect( toPageData, SIGNAL( valueChanged(double) ), this, SLOT( toChanged() ) );
}
connect( mvWhereData, SIGNAL( activated(int) ), this, SLOT( mvWherePageDataDisable(int) ) );
- connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &MovePages::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &MovePages::reject);
}
void MovePages::fromChanged()
Modified: trunk/Scribus/scribus/ui/movepage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25017&path=/trunk/Scribus/scribus/ui/movepage.h
==============================================================================
--- trunk/Scribus/scribus/ui/movepage.h (original)
+++ trunk/Scribus/scribus/ui/movepage.h Fri Mar 11 21:37:59 2022
@@ -7,10 +7,11 @@
#ifndef MOVEPAGES_H
#define MOVEPAGES_H
-#include <QVBoxLayout>
+#include <QDialog>
+#include <QDialogButtonBox>
#include <QGridLayout>
#include <QHBoxLayout>
-#include <QDialog>
+#include <QVBoxLayout>
class QComboBox;
class QLabel;
@@ -43,11 +44,9 @@
ScrSpinBox* numberOfCopiesData;
ScrSpinBox* mvWherePageData;
QComboBox* mvWhereData;
- QPushButton* okButton;
- QPushButton* cancelButton;
+ QDialogButtonBox* buttonBox;
QVBoxLayout* dialogLayout;
QGridLayout* fromToLayout;
- QHBoxLayout* okCancelLayout;
bool move;
More information about the scribus-commit
mailing list