mirror of
https://github.com/leozide/leocad.git
synced 2026-07-28 04:07:11 +00:00
Added Page Setup Dialog.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "project.h"
|
||||
#include "lc_model.h"
|
||||
#include "lc_qutils.h"
|
||||
#include "lc_pagesetupdialog.h"
|
||||
|
||||
lcInstructionsPageWidget::lcInstructionsPageWidget(QWidget* Parent)
|
||||
: QGraphicsView(Parent)
|
||||
@@ -38,8 +39,8 @@ void lcInstructionsPageWidget::SetCurrentPage(const lcInstructionsPage* Page)
|
||||
}
|
||||
}
|
||||
|
||||
lcInstructionsPageListWidget::lcInstructionsPageListWidget(QWidget* Parent)
|
||||
: QDockWidget(Parent)
|
||||
lcInstructionsPageListWidget::lcInstructionsPageListWidget(QWidget* Parent, lcInstructions* Instructions)
|
||||
: QDockWidget(Parent), mInstructions(Instructions)
|
||||
{
|
||||
QWidget* CentralWidget = new QWidget(this);
|
||||
setWidget(CentralWidget);
|
||||
@@ -48,20 +49,36 @@ lcInstructionsPageListWidget::lcInstructionsPageListWidget(QWidget* Parent)
|
||||
QVBoxLayout* Layout = new QVBoxLayout(CentralWidget);
|
||||
Layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QHBoxLayout* ButtonsLayout = new QHBoxLayout();
|
||||
ButtonsLayout->setContentsMargins(0, 0, 0, 0);
|
||||
Layout->addLayout(ButtonsLayout);
|
||||
|
||||
QToolButton* PageSetupButton = new QToolButton();
|
||||
PageSetupButton->setText("Page Setup");
|
||||
ButtonsLayout->addWidget(PageSetupButton);
|
||||
|
||||
connect(PageSetupButton, SIGNAL(clicked()), this, SLOT(ShowPageSetupDialog()));
|
||||
|
||||
ButtonsLayout->addStretch(1);
|
||||
|
||||
/*
|
||||
lcCollapsibleWidget* SetupWidget = new lcCollapsibleWidget(tr("Page Setup"), CentralWidget);
|
||||
Layout->addWidget(SetupWidget);
|
||||
|
||||
QVBoxLayout* SetupLayout = new QVBoxLayout();
|
||||
// QVBoxLayout* SetupLayout = new QVBoxLayout();
|
||||
// SetupWidget->SetChildLayout(SetupLayout);
|
||||
|
||||
QGridLayout* SetupLayout = new QGridLayout();
|
||||
SetupWidget->SetChildLayout(SetupLayout);
|
||||
|
||||
lcCollapsibleWidget* SizeWidget = new lcCollapsibleWidget(tr("Size"));
|
||||
// lcCollapsibleWidget* SizeWidget = new lcCollapsibleWidget(tr("Size"));
|
||||
QGroupBox* SizeWidget = new QGroupBox(tr("Size"));
|
||||
|
||||
SetupLayout->addWidget(SizeWidget);
|
||||
|
||||
QGridLayout* SizeLayout = new QGridLayout();
|
||||
SizeWidget->SetChildLayout(SizeLayout);
|
||||
|
||||
mSizeComboBox = new QComboBox();
|
||||
SizeLayout->addWidget(mSizeComboBox, 0, 0, 1, -1);
|
||||
// SizeWidget->SetChildLayout(SizeLayout);
|
||||
SizeWidget->setLayout(SizeLayout);
|
||||
|
||||
mWidthEdit = new lcSmallLineEdit();
|
||||
SizeLayout->addWidget(new QLabel(tr("Width:")), 1, 0);
|
||||
@@ -71,69 +88,85 @@ lcInstructionsPageListWidget::lcInstructionsPageListWidget(QWidget* Parent)
|
||||
SizeLayout->addWidget(new QLabel(tr("Height:")), 1, 2);
|
||||
SizeLayout->addWidget(mHeightEdit, 1, 3);
|
||||
|
||||
lcCollapsibleWidget* OrientationWidget = new lcCollapsibleWidget(tr("Orientation"));
|
||||
SetupLayout->addWidget(OrientationWidget);
|
||||
mUnitsComboBox = new QComboBox();
|
||||
mUnitsComboBox->addItems(QStringList() << tr("Pixels") << tr("Centimeters") << tr("Inches"));
|
||||
SizeLayout->addWidget(new QLabel(tr("Units:")), 4, 0);
|
||||
SizeLayout->addWidget(mUnitsComboBox, 4, 1, 1, -1);
|
||||
|
||||
QVBoxLayout* OrientationLayout = new QVBoxLayout();
|
||||
OrientationWidget->SetChildLayout(OrientationLayout);
|
||||
mSizeComboBox = new QComboBox();
|
||||
SizeLayout->addWidget(new QLabel(tr("Preset:")), 5, 0);
|
||||
SizeLayout->addWidget(mSizeComboBox, 5, 1, 1, -1);
|
||||
|
||||
mPortraitButton = new QRadioButton(tr("Portrait"));
|
||||
OrientationLayout->addWidget(mPortraitButton);
|
||||
mLandscapeButton = new QRadioButton(tr("Landscape"));
|
||||
OrientationLayout->addWidget(mLandscapeButton);
|
||||
|
||||
lcCollapsibleWidget* MarginsWidget = new lcCollapsibleWidget(tr("Margins"));
|
||||
// lcCollapsibleWidget* OrientationWidget = new lcCollapsibleWidget(tr("Orientation"));
|
||||
// SetupLayout->addWidget(OrientationWidget);
|
||||
//
|
||||
// QVBoxLayout* OrientationLayout = new QVBoxLayout();
|
||||
// OrientationWidget->SetChildLayout(OrientationLayout);
|
||||
//
|
||||
// mPortraitButton = new QRadioButton(tr("Portrait"));
|
||||
// OrientationLayout->addWidget(mPortraitButton);
|
||||
// mLandscapeButton = new QRadioButton(tr("Landscape"));
|
||||
// OrientationLayout->addWidget(mLandscapeButton);
|
||||
|
||||
QGroupBox* MarginsWidget = new QGroupBox(tr("Margins"));
|
||||
// lcCollapsibleWidget* MarginsWidget = new lcCollapsibleWidget(tr("Margins"));
|
||||
SetupLayout->addWidget(MarginsWidget);
|
||||
|
||||
QGridLayout* MarginsLayout = new QGridLayout();
|
||||
MarginsWidget->SetChildLayout(MarginsLayout);
|
||||
// MarginsWidget->SetChildLayout(MarginsLayout);
|
||||
MarginsWidget->setLayout(MarginsLayout);
|
||||
|
||||
mLeftMarginEdit = new lcSmallLineEdit();
|
||||
MarginsLayout->addWidget(new QLabel(tr("Left:")), 0, 0);
|
||||
MarginsLayout->addWidget(mLeftMarginEdit, 0, 1);
|
||||
MarginsLayout->addWidget(new QLabel(tr("Left:")), 2, 0);
|
||||
MarginsLayout->addWidget(mLeftMarginEdit, 2, 1);
|
||||
|
||||
mRightMarginEdit = new lcSmallLineEdit();
|
||||
MarginsLayout->addWidget(new QLabel(tr("Right:")), 0, 2);
|
||||
MarginsLayout->addWidget(mRightMarginEdit, 0, 3);
|
||||
MarginsLayout->addWidget(new QLabel(tr("Right:")), 2, 2);
|
||||
MarginsLayout->addWidget(mRightMarginEdit, 2, 3);
|
||||
|
||||
mTopMarginEdit = new lcSmallLineEdit();
|
||||
MarginsLayout->addWidget(new QLabel(tr("Top:")), 1, 0);
|
||||
MarginsLayout->addWidget(mTopMarginEdit, 1, 1);
|
||||
MarginsLayout->addWidget(new QLabel(tr("Top:")), 3, 0);
|
||||
MarginsLayout->addWidget(mTopMarginEdit, 3, 1);
|
||||
|
||||
mBottomMarginEdit = new lcSmallLineEdit();
|
||||
MarginsLayout->addWidget(new QLabel(tr("Bottom:")), 1, 2);
|
||||
MarginsLayout->addWidget(mBottomMarginEdit, 1, 3);
|
||||
MarginsLayout->addWidget(new QLabel(tr("Bottom:")), 3, 2);
|
||||
MarginsLayout->addWidget(mBottomMarginEdit, 3, 3);
|
||||
|
||||
lcCollapsibleWidget* UnitsWidget = new lcCollapsibleWidget(tr("Units"));
|
||||
SetupLayout->addWidget(UnitsWidget);
|
||||
|
||||
QVBoxLayout* UnitsLayout = new QVBoxLayout();
|
||||
UnitsWidget->SetChildLayout(UnitsLayout);
|
||||
|
||||
mUnitsComboBox = new QComboBox();
|
||||
mUnitsComboBox->addItems(QStringList() << tr("Pixels") << tr("Centimeters") << tr("Inches"));
|
||||
UnitsLayout->addWidget(mUnitsComboBox);
|
||||
|
||||
SetupWidget->Collapse();
|
||||
// lcCollapsibleWidget* UnitsWidget = new lcCollapsibleWidget(tr("Units"));
|
||||
// SetupLayout->addWidget(UnitsWidget);
|
||||
//
|
||||
// QVBoxLayout* UnitsLayout = new QVBoxLayout();
|
||||
// UnitsWidget->SetChildLayout(UnitsLayout);
|
||||
|
||||
// SetupWidget->Collapse();
|
||||
*/
|
||||
mThumbnailsWidget = new QListWidget(CentralWidget);
|
||||
Layout->addWidget(mThumbnailsWidget);
|
||||
}
|
||||
|
||||
void lcInstructionsPageListWidget::ShowPageSetupDialog()
|
||||
{
|
||||
lcPageSetupDialog Dialog(this, &mInstructions->mPageSetup);
|
||||
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
}
|
||||
|
||||
lcInstructionsDialog::lcInstructionsDialog(QWidget* Parent, Project* Project)
|
||||
: QMainWindow(Parent), mProject(Project)
|
||||
{
|
||||
setWindowTitle(tr("Instructions"));
|
||||
|
||||
mInstructions = mProject->GetInstructions();
|
||||
|
||||
mPageWidget = new lcInstructionsPageWidget(this);
|
||||
setCentralWidget(mPageWidget);
|
||||
|
||||
mPageListWidget = new lcInstructionsPageListWidget(this);
|
||||
mPageListWidget = new lcInstructionsPageListWidget(this, &mInstructions);
|
||||
mPageListWidget->setObjectName("PageList");
|
||||
addDockWidget(Qt::LeftDockWidgetArea, mPageListWidget);
|
||||
|
||||
mInstructions = mProject->GetInstructions();
|
||||
|
||||
mPageSettingsToolBar = addToolBar(tr("Page Settings"));
|
||||
mPageSettingsToolBar->setObjectName("PageSettings");
|
||||
mPageSettingsToolBar->setFloatable(false);
|
||||
|
||||
Reference in New Issue
Block a user