r25008 by craig - Usability: Use QDialogButtonBox to insert ok/cancel buttons for auto
scribus-commit
scribus-commit at lists.scribus.net
Thu Mar 10 21:42:24 UTC 2022
Author: craig
Date: Thu Mar 10 21:42:24 2022
New Revision: 25008
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25008
Log:
Usability: Use QDialogButtonBox to insert ok/cancel buttons for auto
reordering depending on platform
Modified:
trunk/Scribus/scribus/ui/newdocdialog.cpp
trunk/Scribus/scribus/ui/newdocdialog.h
Modified: trunk/Scribus/scribus/ui/newdocdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25008&path=/trunk/Scribus/scribus/ui/newdocdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/newdocdialog.cpp Thu Mar 10 21:42:24 2022
@@ -10,9 +10,9 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
-#include <QDir>
#include <QCheckBox>
#include <QComboBox>
+#include <QDir>
#include <QFileDialog>
#include <QFrame>
#include <QGroupBox>
@@ -31,18 +31,18 @@
#include "scconfig.h"
#include "commonstrings.h"
+#include "filedialogeventcatcher.h"
#include "fileloader.h"
+#include "iconmanager.h"
#include "marginwidget.h"
+#include "pagelayout.h"
#include "pagesize.h"
-#include "scribuscore.h"
-#include "pagelayout.h"
#include "pagestructs.h"
#include "prefsfile.h"
#include "prefsmanager.h"
-#include "filedialogeventcatcher.h"
+#include "scribuscore.h"
#include "scrspinbox.h"
#include "units.h"
-#include "iconmanager.h"
PageLayoutsWidget::PageLayoutsWidget(QWidget* parent) :
QListWidget(parent)
@@ -143,12 +143,14 @@
}
QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
Layout1->addItem( spacer );
+ buttonBox = new QDialogButtonBox();
+ Layout1->addWidget(buttonBox);
OKButton = new QPushButton( CommonStrings::tr_OK, this );
OKButton->setDefault( true );
- Layout1->addWidget( OKButton );
+ buttonBox->addButton(OKButton, QDialogButtonBox::AcceptRole);
CancelB = new QPushButton( CommonStrings::tr_Cancel, this );
CancelB->setAutoDefault( false );
- Layout1->addWidget( CancelB );
+ buttonBox->addButton(CancelB, QDialogButtonBox::RejectRole);
TabbedNewDocLayout->addLayout( Layout1 );
//tooltips
pageSizeComboBox->setToolTip( tr( "Document page size, either a standard size or a custom size" ) );
@@ -162,8 +164,9 @@
Distance->setToolTip( tr( "Distance between automatically created columns" ) );
// signals and slots connections
- connect( OKButton, SIGNAL( clicked() ), this, SLOT( ExitOK() ) );
- connect( CancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &NewDocDialog::ExitOK);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &NewDocDialog::reject);
+
connect(pageSizeComboBox, SIGNAL(textActivated(QString)), this, SLOT(setPageSize(QString)));
connect(pageOrientationComboBox, SIGNAL(activated(int)), this, SLOT(setOrientation(int)));
connect(unitOfMeasureComboBox, SIGNAL(activated(int)), this, SLOT(setUnit(int)));
Modified: trunk/Scribus/scribus/ui/newdocdialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25008&path=/trunk/Scribus/scribus/ui/newdocdialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.h (original)
+++ trunk/Scribus/scribus/ui/newdocdialog.h Thu Mar 10 21:42:24 2022
@@ -8,17 +8,18 @@
#define NEWDOCDIALOG_H
#include <QDialog>
+#include <QDialogButtonBox>
#include <QDropEvent>
#include <QDragEnterEvent>
#include <QDragLeaveEvent>
#include <QDragMoveEvent>
#include <QListWidget>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QVBoxLayout>
-class QCheckBox;
-class QComboBox;
class QGridLayout;
class QHBoxLayout;
-class QVBoxLayout;
class QFrame;
class QGroupBox;
class QLabel;
@@ -108,6 +109,7 @@
nftwidget *nftGui {nullptr};
QFrame* recentDocFrame {nullptr};
QListWidget* recentDocListBox {nullptr};
+ QDialogButtonBox* buttonBox {nullptr};
QPushButton* OKButton {nullptr};
QPushButton* CancelB {nullptr};
@@ -115,7 +117,7 @@
int tabSelected() const { return m_tabSelected;}
QString selectedFile() const { return m_selectedFile; }
- int unitIndex() const { return m_unitIndex;}
+ int unitIndex() const { return m_unitIndex;}
QString unitSuffix() const { return m_unitSuffix;}
double unitRatio() const { return m_unitRatio; }
More information about the scribus-commit
mailing list