// GRID PAGE // GridPage::GridPage(QWidget* parent, QSettings* appSettings) : QWidget(parent), m_pAppSettings(appSettings) { QLabel* gridColor = new QLabel("Grid Color", this); ColorWidget* gridColorSelect = new ColorWidget(this); QLabel* gridSize = new QLabel("Grid Size", this); QSpinBox* sizeSpinBox = new QSpinBox; sizeSpinBox->setRange(0, 200); sizeSpinBox->setSingleStep(1); sizeSpinBox->setValue(16); QLabel* gridCellSize = new QLabel("Grid Cell Size", this); QSpinBox* cellSizeSpinBox = new QSpinBox; cellSizeSpinBox->setRange(1, 200); cellSizeSpinBox->setSingleStep(1); cellSizeSpinBox->setValue(1); QGroupBox* gridGroup = new QGroupBox(); QGridLayout* gridLayout = new QGridLayout; gridLayout->addWidget(gridColor, 0, 0); gridLayout->addWidget(gridColorSelect, 0, 1); gridLayout->addWidget(gridSize, 1, 0); gridLayout->addWidget(sizeSpinBox, 1, 1); gridLayout->addWidget(gridCellSize, 2, 0); gridLayout->addWidget(cellSizeSpinBox, 2, 1); gridGroup->setLayout(gridLayout); QVBoxLayout* mainLayout = new QVBoxLayout; mainLayout->addWidget(gridGroup); mainLayout->addStretch(1); setLayout(mainLayout); // Populate the settings gridColorSelect->setColor(m_pAppSettings->value("GLModelWidget/gridColor", QColor(0,0,0)).value<QColor>()); sizeSpinBox->setValue(m_pAppSettings->value("GLModelWidget/gridSize", 16).toInt()); cellSizeSpinBox->setValue(m_pAppSettings->value("GLModelWidget/gridCellSize", 1).toInt()); // Backup original values m_gridColorOrig = gridColorSelect->color(); m_gridSizeOrig = sizeSpinBox->value(); m_gridCellSizeOrig = cellSizeSpinBox->value(); // Hook up the signals QObject::connect(gridColorSelect, SIGNAL(colorChanged(QColor)), this, SLOT(setGridColor(QColor))); QObject::connect(sizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setGridSize(int))); QObject::connect(cellSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setgridCellSize(int))); }
// MODELVIEW PAGE // ModelViewPage::ModelViewPage(QWidget* parent, QSettings* appSettings) : QWidget(parent), m_pAppSettings(appSettings) { QLabel* backgroundColor = new QLabel("Window Background Color", this); ColorWidget* bgColorSelect = new ColorWidget(this); QCheckBox* dragEnabled = new QCheckBox("Tool Dragging Enabled", this); QCheckBox* previewEnabled = new QCheckBox("Tool Preview Enabled", this); QGroupBox* modelViewGroup = new QGroupBox(); QGridLayout* gridLayout = new QGridLayout; gridLayout->addWidget(backgroundColor, 0, 0); gridLayout->addWidget(bgColorSelect, 0, 1); gridLayout->addWidget(dragEnabled, 2, 0); gridLayout->addWidget(previewEnabled, 3, 0); modelViewGroup->setLayout(gridLayout); QVBoxLayout* mainLayout = new QVBoxLayout; mainLayout->addWidget(modelViewGroup); mainLayout->addStretch(1); setLayout(mainLayout); // Populate the settings bgColorSelect->setColor(m_pAppSettings->value("GLModelWidget/backgroundColor", QColor(161,161,161)).value<QColor>()); if (m_pAppSettings->value("GLModelWidget/dragEnabled", true).toBool()) dragEnabled->setCheckState(Qt::Checked); else dragEnabled->setCheckState(Qt::Unchecked); if (m_pAppSettings->value("GLModelWidget/previewEnabled", true).toBool()) previewEnabled->setCheckState(Qt::Checked); else previewEnabled->setCheckState(Qt::Unchecked); // Backup original values m_backgroundColorOrig = bgColorSelect->color(); m_dragEnabledOrig = dragEnabled->isChecked(); m_previewEnabledOrig = previewEnabled->isChecked(); // Hook up the signals QObject::connect(bgColorSelect, SIGNAL(colorChanged(QColor)), this, SLOT(setBackgroundColor(QColor))); QObject::connect(dragEnabled, SIGNAL(stateChanged(int)), this, SLOT(setDragEnabled(int))); QObject::connect(previewEnabled, SIGNAL(stateChanged(int)), this, SLOT(setPreviewEnabled(int))); }