void PLEConfigViewWidget::setupGUI() { QVBoxLayout * layout = new QVBoxLayout(); this->setLayout(layout); PLEConfigSkeleton * skeleton = PLEConfigSkeleton::self(); QFormLayout * generalLayout = new QFormLayout(); layout->addLayout(generalLayout); d->antialiasing = new QCheckBox(this); connect(skeleton, SIGNAL(antialiasingChanged(bool)), d->antialiasing, SLOT(setChecked(bool))); generalLayout->addRow(i18n("Antialiasing"), d->antialiasing); QGroupBox * gridBox = new QGroupBox(i18n("Grid"), this); layout->addWidget(gridBox); QFormLayout * gridLayout = new QFormLayout(); gridBox->setLayout(gridLayout); d->showGrid = new QCheckBox(gridBox); connect(skeleton, SIGNAL(showGridChanged(bool)), d->showGrid, SLOT(setChecked(bool))); gridLayout->addRow(i18n("Show grid lines"), d->showGrid); d->xGrid = new QDoubleSpinBox(gridBox); KConfigSkeletonItem * hgi = skeleton->findItem("horizontalGrid"); if (hgi) { d->xGrid->setMinimum(hgi->minValue().toDouble()); d->xGrid->setMaximum(hgi->maxValue().toDouble()); } d->xGrid->setSingleStep(1.0); connect(skeleton, SIGNAL(horizontalGridChanged(double)), d->xGrid, SLOT(setValue(double))); gridLayout->addRow(i18n("Horizontal distance"), d->xGrid); d->yGrid = new QDoubleSpinBox(gridBox); KConfigSkeletonItem * vgi = skeleton->findItem("verticalGrid"); if (hgi) { d->yGrid->setMinimum(vgi->minValue().toDouble()); d->yGrid->setMaximum(vgi->maxValue().toDouble()); } d->yGrid->setSingleStep(1.0); connect(skeleton, SIGNAL(verticalGridChanged(double)), d->yGrid, SLOT(setValue(double))); gridLayout->addRow(i18n("Vertical distance"), d->yGrid); // KConfigDialog * dialog = KConfigDialog::exists( "settings" ); // qDebug() << dialog; // if (dialog) // { // connect(d->antialiasing, SIGNAL(stateChanged(int)), dialog, SLOT(updateButtons())); // connect(d->showGrid, SIGNAL(stateChanged(int)), dialog, SLOT(updateButtons())); // connect(d->xGrid, SIGNAL(valueChanged(double)), dialog, SLOT(updateButtons())); // connect(d->yGrid, SIGNAL(valueChanged(double)), dialog, SLOT(updateButtons())); // connect(d->antialiasing, SIGNAL(stateChanged(int)), dialog, SLOT(settingsChangedSlot())); // connect(d->showGrid, SIGNAL(stateChanged(int)), dialog, SLOT(settingsChangedSlot())); // connect(d->xGrid, SIGNAL(valueChanged(double)), dialog, SLOT(settingsChangedSlot())); // connect(d->yGrid, SIGNAL(valueChanged(double)), dialog, SLOT(settingsChangedSlot())); // } this->updateWidgets(); }
GridSetupDialog::GridSetupDialog(QWidget * parent) : KDialog(parent) { PLEConfigSkeleton * skeleton = PLEConfigSkeleton::self(); this->setCaption(i18n("Setup grid lines")); this->setModal(true); centralWidget = new QWidget(this); setMainWidget(centralWidget); QFormLayout * layout = new QFormLayout(); layout->setSizeConstraint( QLayout::SetFixedSize ); x = new QDoubleSpinBox(centralWidget); KConfigSkeletonItem * hgi = skeleton->findItem("horizontalGrid"); if (hgi) { x->setMinimum(hgi->minValue().toDouble()); x->setMaximum(hgi->maxValue().toDouble()); } x->setSingleStep(1.0); x->setValue(PLEConfigSkeleton::horizontalGrid()); connect(skeleton, SIGNAL(horizontalGridChanged(double)), x, SLOT(setValue(double))); layout->addRow(i18n("Horizontal distance"), x); y = new QDoubleSpinBox(centralWidget); KConfigSkeletonItem * vgi = skeleton->findItem("verticalGrid"); if (vgi) { y->setMinimum(hgi->minValue().toDouble()); y->setMaximum(hgi->maxValue().toDouble()); } y->setSingleStep(1.0); y->setValue(PLEConfigSkeleton::verticalGrid()); connect(skeleton, SIGNAL(verticalGridChanged(double)), y, SLOT(setValue(double))); layout->addRow(i18n("Vertical distance"), y); centralWidget->setLayout(layout); this->setFixedSize( this->sizeHint() ); }