void KPrefsWidRadios::addRadio( const QString &text, const QString &toolTip, const QString &whatsThis ) { QRadioButton *r = new QRadioButton( text, mBox ); if ( !toolTip.isEmpty() ) { r->setToolTip( toolTip ); } if ( !whatsThis.isEmpty() ) { r->setWhatsThis( whatsThis ); } }
/*! * Makes a new radio button with the give [text] and with the given [parent] * (which can be NULL), adds it to the button group [group] with button ID [id] * if [group] is non-NULL, adds it to [layout] if it is non-NULL, sets it for * no focus, and sets [tooltip] as the tooltip if it is non-NULL. [layout] * can be a QHBoxLayout or a QVBoxLayout. */ QRadioButton *diaRadioButton(const char *label, QWidget *parent, QButtonGroup *group, QBoxLayout *layout, int id, const char *tooltip) { QRadioButton *radio = new QRadioButton(QString(label), parent); if (group) group->addButton(radio, id); if (layout) layout->addWidget(radio); radio->setFocusPolicy(Qt::NoFocus); if (tooltip) radio->setToolTip(QString(tooltip)); return radio; }
/** Add a radio button to the plot options * * @param text :: text on the radio button * @param tooltip :: tooltip * @param bIntegrated :: flag to indicate that the dimension is integrated. */ void LinePlotOptions::addPlotRadioButton(const std::string &text, const std::string &tooltip, const bool bIntegrated) { QRadioButton *rad; rad = new QRadioButton(ui.widgetPlotAxis); rad->setText(QString::fromStdString(text)); rad->setToolTip(QString::fromStdString(tooltip)); rad->setEnabled(!bIntegrated); // Insert it one before the horizontal spacer. QBoxLayout *layout = qobject_cast<QBoxLayout *>(ui.widgetPlotAxis->layout()); layout->insertWidget(layout->count() - 1, rad); m_radPlots.push_back(rad); QObject::connect(rad, SIGNAL(toggled(bool)), this, SLOT(radPlot_changed())); }
bool HandlerChoiceDialog::AddCommon (const IInfo *ii, const QString& addedAs) { QString name; QString tooltip; QIcon icon; try { name = ii->GetName (); tooltip = ii->GetInfo (); icon = ii->GetIcon (); } catch (const std::exception& e) { qWarning () << Q_FUNC_INFO << "could not query" << e.what () << ii; return false; } catch (...) { qWarning () << Q_FUNC_INFO << "could not query" << ii; return false; } QRadioButton *but = new QRadioButton (name, this); but->setToolTip (tooltip); but->setIconSize (QSize (32, 32)); but->setIcon (icon); but->setProperty ("AddedAs", "IDownload"); but->setProperty ("PluginID", ii->GetUniqueID ()); if (Buttons_->buttons ().isEmpty ()) but->setChecked (true); Buttons_->addButton (but); Ui_.DownloadersLayout_->addWidget (but); Infos_ [name] = ii; Ui_.DownloadersLabel_->show (); if (Downloaders_.size () + Handlers_.size () == 1) populateLocationsBox (); return true; }
void KSaneDeviceDialog::updateDevicesList() { while (!m_btnGroup->buttons().isEmpty()) { delete m_btnGroup->buttons().takeFirst(); } const QList<KSaneWidget::DeviceInfo> list = m_findDevThread->devicesList(); if (list.isEmpty()) { m_btnBox->setTitle(i18n("Sorry. No devices found.")); m_btnBox->layout()->itemAt(0)->widget()->show(); // explanation m_btnBox->layout()->itemAt(1)->widget()->hide(); // scroll area enableButton(KDialog::User1, true); return; } delete m_btnLayout; m_btnLayout = new QVBoxLayout; m_btnContainer->setLayout(m_btnLayout); m_btnBox->setTitle(i18n("Found devices:")); m_btnBox->layout()->itemAt(0)->widget()->hide(); // explanation m_btnBox->layout()->itemAt(1)->widget()->show(); // scroll area for (int i=0; i< list.size(); i++) { QRadioButton *b = new QRadioButton(this); b->setObjectName(list[i].name); b->setToolTip(list[i].name); b->setText(QString("%1 : %2\n%3") .arg(list[i].vendor) .arg(list[i].model) .arg(list[i].name)); m_btnLayout->addWidget(b); m_btnGroup->addButton(b); connect(b, SIGNAL(clicked(bool)), this, SLOT(setAvailable(bool))); if((i==0) || (list[i].name == m_selectedDevice)) { b->setChecked(true); setAvailable(true); } } m_btnLayout->addStretch(); if(list.size() == 1) { button(KDialog::Ok)->animateClick(); } enableButton(KDialog::User1, true); }
static inline QRadioButton* buildRadioButton(QString text, QString icon, int mode, QGroupBox *groupBox, QHBoxLayout *hbox, LogWidgetModel *m_viewmodel) { QRadioButton *build = new QRadioButton(text, groupBox); build->setIcon(QIcon(QString(":/in/%0").arg(icon))); build->setProperty("mode", mode); build->setToolTip(build->text()); hbox->addWidget(build); QObject::connect(build, SIGNAL(toggled(bool)), m_viewmodel, SLOT(changeMode(bool))); return build; }
FittingDialog::FittingDialog(MyApp *app, QWidget *parent) :QDialog(parent) { mApp = app; float nDim=mApp->getDim()-1; float x1Idx1=mApp->getX1RangeLow()/nDim; float x1Idx2=mApp->getX1RangeHigh()/nDim; float x2Idx1=mApp->getX2RangeLow()/nDim; float x2Idx2=mApp->getX2RangeHigh()/nDim; char tmpStr[20]; int which = mApp->getZeroFitMethod(); setWindowTitle(tr("Fitting Range & Method")); // Set up the zero-fitting method radio group QGroupBox *zeroGrpBox = new QGroupBox(tr("Zero-finding method"), this); QButtonGroup *zeroButGroup = new QButtonGroup(this); QVBoxLayout *vbox=new QVBoxLayout; vbox->setSpacing(0); vbox->setContentsMargins(5, 2, 5, 5); QRadioButton *radio = new QRadioButton(tr("Fit to CTF-like curve")); zeroButGroup->addButton(radio, 0); vbox->addWidget(radio); radio->setToolTip("Fit to a function based on a CTF curve over the selected range"); radio = new QRadioButton(tr("Fit polynomial to dip")); zeroButGroup->addButton(radio, 1); vbox->addWidget(radio); radio->setToolTip("Fit a polynomial over the selected range and take the minimum as " "the zero"); radio = new QRadioButton(tr("Find intersection of 2 curves")); zeroButGroup->addButton(radio, 2); vbox->addWidget(radio); radio->setToolTip("Fit curves or lines over two frequency ranges and take the zero as " "their intersection"); zeroGrpBox->setLayout(vbox); QAbstractButton *button = zeroButGroup->button(which); button->setChecked(true); // Checkbox for finding power and polynomial order spin button mPowerCheckBox = new QCheckBox(tr("Vary exponent of CTF function"), this); mPowerCheckBox->setChecked(mApp->getVaryCtfPowerInFit()); mPowerCheckBox->setToolTip("Add a fifth parameter to the fit to vary the exponent of " "the function being fit"); QHBoxLayout *orderHbox = new QHBoxLayout; mOrderLabel = new QLabel(tr("Order of polynomial:"), this); orderHbox->addWidget(mOrderLabel); mOrderSpinBox = new QSpinBox(this); mOrderSpinBox->setRange(2, 6); mOrderSpinBox->setSingleStep(1); mOrderSpinBox->setValue(mApp->getPolynomialOrder()); orderHbox->addWidget(mOrderSpinBox); mOrderSpinBox->setToolTip("Set the order for the polynomial fit, e.g., 3 for cubic"); // FREQUENCY SCALE CHANGE: FOUR " / 2." AND %4.2f -> %4.3f // X1 start and end fields mX1_label_1=new QLabel(tr("X1 &Starts:"), this); sprintf(tmpStr, "%4.3f", x1Idx1 / 2.); mX1_edit_1=new QLineEdit(tmpStr, this); mX1_label_1->setBuddy(mX1_edit_1); mX1_edit_1->setToolTip("Starting frequency (in 1/pixel) of range for CTF-like, " "polynomial, or first curve fit"); //printf("??????????%f \n", x1Idx1); mX1_label_2=new QLabel(tr("X1 &Ends:"), this); sprintf(tmpStr, "%4.3f", x1Idx2 / 2.); mX1_edit_2=new QLineEdit(tmpStr, this); mX1_label_2->setBuddy(mX1_edit_1); mX1_edit_2->setToolTip("Ending frequency (in 1/pixel) of range for " "first curve fit"); // Set up the X1 fitting radio group mX1Group=new QGroupBox(tr("X1 fitting method"), this); QButtonGroup *x1ButGroup = new QButtonGroup(this); mX1LinearRadio=new QRadioButton(tr("Line")); mX1SimplexRadio=new QRadioButton(tr("Gaussian")); x1ButGroup->addButton(mX1LinearRadio, 0); x1ButGroup->addButton(mX1SimplexRadio, 1); mX1SimplexRadio->setChecked(true); vbox=new QVBoxLayout; vbox->addWidget(mX1LinearRadio); vbox->addWidget(mX1SimplexRadio); mX1Group->setLayout(vbox); vbox->setSpacing(0); vbox->setContentsMargins(5, 2, 5, 5); mX2_label_1=new QLabel(tr("X2 S&tarts:"), this); sprintf(tmpStr, "%4.3f", x2Idx1 / 2.); mX2_edit_1=new QLineEdit(tmpStr, this); mX2_label_1->setBuddy(mX2_edit_1); mX2_edit_1->setToolTip("Starting frequency (in 1/pixel) of range for " "second curve fit"); mX2_label_2=new QLabel(tr("X2 E&nds:"), this); sprintf(tmpStr, "%4.3f", x2Idx2 / 2.); mX2_edit_2=new QLineEdit(tmpStr, this); mX2_label_2->setBuddy(mX2_edit_2); mX2_edit_2->setToolTip("Ending frequency (in 1/pixel) of range for CTF-like, " "polynomial, or second curve fit"); mX2Group=new QGroupBox(tr("X2 fitting method"), this); mX2LinearRadio=new QRadioButton(tr("Line")); mX2SimplexRadio=new QRadioButton(tr("Gaussian")); QButtonGroup *x2ButGroup = new QButtonGroup(this); x2ButGroup->addButton(mX2LinearRadio, 0); x2ButGroup->addButton(mX2SimplexRadio, 1); mX2SimplexRadio->setChecked(true); QVBoxLayout *vbox2=new QVBoxLayout; vbox2->addWidget(mX2LinearRadio); vbox2->addWidget(mX2SimplexRadio); mX2Group->setLayout(vbox2); vbox2->setSpacing(0); vbox2->setContentsMargins(5, 2, 5, 5); QHBoxLayout *baseOrderHbox = new QHBoxLayout; mBaselineLabel = new QLabel(tr("Baseline fitting order:"), this); baseOrderHbox->addWidget(mBaselineLabel); mBaselineSpinBox = new QSpinBox(this); mBaselineSpinBox->setRange(0, 4); mBaselineSpinBox->setSingleStep(1); mBaselineSpinBox->setValue(mApp->getBaselineOrder()); baseOrderHbox->addWidget(mBaselineSpinBox); mBaselineSpinBox->setToolTip("Set the order for a polynomial fit to make baseline " "flat, or 0 for none (hot keys 0 to 4 in plotter window)"); mApplyButton= new QPushButton( tr("&Apply"), this); mApplyButton->setDefault(true); mApplyButton->setEnabled(false); mCloseButton=new QPushButton( tr("&Close"), this); connect(mX1_edit_1, SIGNAL(textChanged(const QString &)), this, SLOT(enableApplyButton(const QString &)) ); connect(mX1_edit_2, SIGNAL(textChanged(const QString &)), this, SLOT(enableApplyButton(const QString &)) ); connect(mX2_edit_1, SIGNAL(textChanged(const QString &)), this, SLOT(enableApplyButton(const QString &)) ); connect(mX2_edit_2, SIGNAL(textChanged(const QString &)), this, SLOT(enableApplyButton(const QString &)) ); connect(mApplyButton, SIGNAL(clicked()), this, SLOT(rangeSetted()) ); connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close()) ); connect(mX1LinearRadio, SIGNAL(clicked()), this, SLOT(x1LinearChecked()) ); connect(mX1SimplexRadio, SIGNAL(clicked()), this, SLOT(x1SimplexChecked()) ); connect(mX2LinearRadio, SIGNAL(clicked()), this, SLOT(x2LinearChecked()) ); connect(mX2SimplexRadio, SIGNAL(clicked()), this, SLOT(x2SimplexChecked()) ); connect(zeroButGroup, SIGNAL(buttonClicked(int)), this, SLOT(zeroMethodClicked(int))); connect(mPowerCheckBox, SIGNAL(clicked(bool)), this, SLOT(fitPowerClicked(bool))); connect(mOrderSpinBox, SIGNAL(valueChanged(int)), this, SLOT(orderChanged(int))); connect(mBaselineSpinBox, SIGNAL(valueChanged(int)), this, SLOT(baseOrderChanged(int))); QHBoxLayout *x1HLayout_1=new QHBoxLayout; x1HLayout_1->addWidget(mX1_label_1); x1HLayout_1->addWidget(mX1_edit_1); QHBoxLayout *x1HLayout_2=new QHBoxLayout; x1HLayout_2->addWidget(mX1_label_2); x1HLayout_2->addWidget(mX1_edit_2); QVBoxLayout *x1VLayout=new QVBoxLayout; x1VLayout->addLayout(x1HLayout_1); x1VLayout->addLayout(x1HLayout_2); QHBoxLayout *x1HLayout_3= new QHBoxLayout; x1HLayout_3->addLayout(x1VLayout); x1HLayout_3->addWidget(mX1Group); QHBoxLayout *x2HLayout_1=new QHBoxLayout; x2HLayout_1->addWidget(mX2_label_1); x2HLayout_1->addWidget(mX2_edit_1); QHBoxLayout *x2HLayout_2=new QHBoxLayout; x2HLayout_2->addWidget(mX2_label_2); x2HLayout_2->addWidget(mX2_edit_2); QVBoxLayout *x2VLayout=new QVBoxLayout; x2VLayout->addLayout(x2HLayout_1); x2VLayout->addLayout(x2HLayout_2); QHBoxLayout *x2HLayout_3= new QHBoxLayout; x2HLayout_3->addLayout(x2VLayout); x2HLayout_3->addWidget(mX2Group); QHBoxLayout *lowHLayout=new QHBoxLayout; lowHLayout->addWidget(mApplyButton); lowHLayout->addWidget(mCloseButton); QVBoxLayout *mainLayout=new QVBoxLayout(this); mainLayout->setMargin(11); mainLayout->setSpacing(6); mainLayout->addWidget(zeroGrpBox); mainLayout->addWidget(mPowerCheckBox); mainLayout->addLayout(orderHbox); mainLayout->addLayout(x1HLayout_3); mainLayout->addLayout(x2HLayout_3); mainLayout->addLayout(baseOrderHbox); mainLayout->addLayout(lowHLayout); manageWidgets(which); }
/** * Constructor, creates and sets up widgets for this tool. * * @param parent */ StatisticsTool::StatisticsTool(QWidget *parent) : Tool(parent) { p_boxSamps = 3; p_boxLines = 3; p_ulSamp = -1; p_ulLine = -1; p_set = false; p_dialog = new QDialog(parent); p_dialog->setWindowTitle("Statistics"); p_visualBox = new QGroupBox("Visual Display"); p_visualScroll = new QScrollArea; p_visualScroll->setBackgroundRole(QPalette::Dark); p_visualDisplay = new VisualDisplay(p_visualScroll); p_visualDisplay->setObjectName("dnDisplay"); QCheckBox *checkBox = new QCheckBox("Hide Display"); connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(hideDisplay(bool))); QLabel *boxLabel = new QLabel("Box Size:"); p_boxLabel = new QLabel; QString samps, lines; samps.setNum(p_boxSamps); lines.setNum(p_boxLines); p_boxLabel->setText(samps + "x" + lines); QHBoxLayout *boxLabelLayout = new QHBoxLayout; boxLabelLayout->addWidget(checkBox); boxLabelLayout->addStretch(1); boxLabelLayout->addWidget(boxLabel); boxLabelLayout->addWidget(p_boxLabel); QSlider *slider = new QSlider(Qt::Vertical); slider->setRange(2, 18); slider->setSliderPosition(10); slider->setSingleStep(1); slider->setTickInterval(1); slider->setTickPosition(QSlider::TicksBelow); connect(slider, SIGNAL(valueChanged(int)), p_visualDisplay, SLOT(setBoxSize(int))); connect(slider, SIGNAL(valueChanged(int)), this, SLOT(resizeScrollbars())); p_visualScroll->setWidget(p_visualDisplay); QGroupBox *displayMode = new QGroupBox("Display Mode"); QRadioButton *displayText = new QRadioButton("Show Text"); displayText->setToolTip("Display the pixels of a region as text"); QRadioButton *displayPixels = new QRadioButton("Show Pixel Values"); displayPixels->setToolTip("Display the pixels of a region"); QRadioButton *displayDeviation = new QRadioButton("Show Deviation"); displayDeviation->setToolTip("Display standard deviation over a region,\n where red denotes a larger deviation"); QHBoxLayout *displayModeLayout = new QHBoxLayout; displayModeLayout->addWidget(displayText); displayModeLayout->addWidget(displayPixels); displayModeLayout->addWidget(displayDeviation); displayMode->setLayout(displayModeLayout); connect(displayText, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showText(bool))); connect(displayText, SIGNAL(toggled(bool)), slider, SLOT(setDisabled(bool))); connect(displayPixels, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showPixels(bool))); connect(displayDeviation, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showDeviation(bool))); displayText->setChecked(true); QHBoxLayout *visualHBoxLayout = new QHBoxLayout; visualHBoxLayout->addWidget(p_visualScroll); visualHBoxLayout->addWidget(slider); QVBoxLayout *visualVBoxLayout = new QVBoxLayout; visualVBoxLayout->addLayout(visualHBoxLayout); visualVBoxLayout->addWidget(displayMode); p_visualBox->setLayout(visualVBoxLayout); QGroupBox *statsBox = new QGroupBox("Statistics"); p_minLabel = new QLabel("Minimum: n/a"); p_minLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); p_minLabel->setLineWidth(1); p_minLabel->setMargin(10); p_minLabel->setAlignment(Qt::AlignLeft); p_maxLabel = new QLabel("Maximum: n/a"); p_maxLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); p_maxLabel->setLineWidth(1); p_maxLabel->setMargin(10); p_maxLabel->setAlignment(Qt::AlignLeft); p_avgLabel = new QLabel("Average: n/a"); p_avgLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); p_avgLabel->setLineWidth(1); p_avgLabel->setMargin(10); p_avgLabel->setAlignment(Qt::AlignLeft); p_stdevLabel = new QLabel("Standard Dev: n/a"); p_stdevLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); p_stdevLabel->setLineWidth(1); p_stdevLabel->setMargin(10); p_stdevLabel->setAlignment(Qt::AlignLeft); p_dnLabel = new QLabel("DN: n/a"); QFont labelFont = p_dnLabel->font(); labelFont.setPointSize(8); p_dnLabel->setFont(labelFont); p_dnLabel->setAlignment(Qt::AlignRight); connect(p_visualDisplay, SIGNAL(setDn(QString)), p_dnLabel, SLOT(setText(QString))); p_sampLabel = new QLabel("Sample: n/a"); p_sampLabel->setFont(labelFont); p_sampLabel->setAlignment(Qt::AlignLeft); connect(p_visualDisplay, SIGNAL(setSample(QString)), p_sampLabel, SLOT(setText(QString))); p_lineLabel = new QLabel("Line: n/a"); p_lineLabel->setFont(labelFont); p_lineLabel->setAlignment(Qt::AlignCenter); connect(p_visualDisplay, SIGNAL(setLine(QString)), p_lineLabel, SLOT(setText(QString))); QGridLayout *statsLayout = new QGridLayout; statsLayout->addWidget(p_minLabel, 0, 0, 1, 2); statsLayout->addWidget(p_maxLabel, 1, 0, 1, 2); statsLayout->addWidget(p_avgLabel, 0, 2, 1, 2); statsLayout->addWidget(p_stdevLabel, 1, 2, 1, 2); statsLayout->addWidget(p_sampLabel, 2, 0); statsLayout->addWidget(p_lineLabel, 2, 1, 1, 2); statsLayout->addWidget(p_dnLabel, 2, 3); statsBox->setLayout(statsLayout); QVBoxLayout *dialogLayout = new QVBoxLayout; dialogLayout->addLayout(boxLabelLayout); dialogLayout->addWidget(p_visualBox); dialogLayout->addWidget(statsBox); p_dialog->setLayout(dialogLayout); checkBox->setChecked(true); }
QWidget* RenderingWidget::createNavigationControlWidget() { QWidget* panel = new QWidget(); QVBoxLayout* layout = new QVBoxLayout(); { QPushButton* but = new QPushButton("reset"); but->setToolTip("move the camera to initial position (with animation)"); layout->addWidget(but); connect(but, SIGNAL(clicked()), this, SLOT(resetCamera())); } { // navigation mode QGroupBox* box = new QGroupBox("navigation mode"); QVBoxLayout* boxLayout = new QVBoxLayout; QButtonGroup* group = new QButtonGroup(panel); QRadioButton* but; but = new QRadioButton("turn around"); but->setToolTip("look around an object"); group->addButton(but, NavTurnAround); boxLayout->addWidget(but); but = new QRadioButton("fly"); but->setToolTip("free navigation like a spaceship\n(this mode can also be enabled pressing the \"shift\" key)"); group->addButton(but, NavFly); boxLayout->addWidget(but); group->button(mNavMode)->setChecked(true); connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setNavMode(int))); box->setLayout(boxLayout); layout->addWidget(box); } { // track ball, rotation mode QGroupBox* box = new QGroupBox("rotation mode"); QVBoxLayout* boxLayout = new QVBoxLayout; QButtonGroup* group = new QButtonGroup(panel); QRadioButton* but; but = new QRadioButton("stable trackball"); group->addButton(but, RotationStable); boxLayout->addWidget(but); but->setToolTip("use the stable trackball implementation mapping\nthe 2D coordinates to 3D points on a sphere"); but = new QRadioButton("standard rotation"); group->addButton(but, RotationStandard); boxLayout->addWidget(but); but->setToolTip("standard approach mapping the x and y displacements\nas rotations around the camera's X and Y axes"); group->button(mRotationMode)->setChecked(true); connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setRotationMode(int))); box->setLayout(boxLayout); layout->addWidget(box); } { // interpolation mode QGroupBox* box = new QGroupBox("spherical interpolation"); QVBoxLayout* boxLayout = new QVBoxLayout; QButtonGroup* group = new QButtonGroup(panel); QRadioButton* but; but = new QRadioButton("quaternion slerp"); group->addButton(but, LerpQuaternion); boxLayout->addWidget(but); but->setToolTip("use quaternion spherical interpolation\nto interpolate orientations"); but = new QRadioButton("euler angles"); group->addButton(but, LerpEulerAngles); boxLayout->addWidget(but); but->setToolTip("use Euler angles to interpolate orientations"); group->button(mNavMode)->setChecked(true); connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setLerpMode(int))); box->setLayout(boxLayout); layout->addWidget(box); } layout->addItem(new QSpacerItem(0,0,QSizePolicy::Minimum,QSizePolicy::Expanding)); panel->setLayout(layout); return panel; }
void Clamp::customizeGUI(void) { QGridLayout *customlayout = DefaultGUIModel::getLayout(); customlayout->setColumnStretch(1,1); //overall GUI layout with a "horizontal box" copied from DefaultGUIModel QGroupBox *plotBox = new QGroupBox("FI Plot"); QHBoxLayout *plotBoxLayout = new QHBoxLayout; plotBox->setLayout(plotBoxLayout); QPushButton *clearButton = new QPushButton("&Clear"); QPushButton *linearfitButton = new QPushButton("Linear &Fit"); QPushButton *savePlotButton = new QPushButton("Screenshot"); QPushButton *printButton = new QPushButton("Print"); QPushButton *saveDataButton = new QPushButton("Save Data"); plotBoxLayout->addWidget(clearButton); plotBoxLayout->addWidget(linearfitButton); plotBoxLayout->addWidget(printButton); plotBoxLayout->addWidget(savePlotButton); plotBoxLayout->addWidget(saveDataButton); QLineEdit *eqnLine = new QLineEdit("Linear Equation"); eqnLine->setText("Y = c0 + c1 * X"); eqnLine->setFrame(false); splot = new ScatterPlot(this); // Connect buttons to functions QObject::connect(clearButton, SIGNAL(clicked()), splot, SLOT(clear())); QObject::connect(clearButton, SIGNAL(clicked()), this, SLOT(clearData())); QObject::connect(savePlotButton, SIGNAL(clicked()), this, SLOT(exportSVG())); QObject::connect(printButton, SIGNAL(clicked()), this, SLOT(print())); QObject::connect(saveDataButton, SIGNAL(clicked()), this, SLOT(saveFIData())); QObject::connect(linearfitButton, SIGNAL(clicked()), this, SLOT(fitData())); clearButton->setToolTip("Clear"); savePlotButton->setToolTip("Save screenshot"); saveDataButton->setToolTip("Save data"); linearfitButton->setToolTip("Perform linear least-squares regression"); printButton->setToolTip("Print plot"); plotBox->hide(); eqnLine->hide(); // splot->setMinimumSize(450, 270); splot->hide(); customlayout->addWidget(plotBox, 0, 1, 1, 1); customlayout->addWidget(eqnLine, 10, 1, 1, 1); customlayout->addWidget(splot, 1, 1, 3, 1); QGroupBox *modeBox = new QGroupBox("Clamp Mode"); QHBoxLayout *modeBoxLayout = new QHBoxLayout; modeBox->setLayout(modeBoxLayout); QButtonGroup *modeButtons = new QButtonGroup; modeButtons->setExclusive(true); QRadioButton *stepButton = new QRadioButton("Step"); modeBoxLayout->addWidget(stepButton); modeButtons->addButton(stepButton); stepButton->setEnabled(true); QRadioButton *rampButton = new QRadioButton("Ramp"); modeBoxLayout->addWidget(rampButton); modeButtons->addButton(rampButton); stepButton->setChecked(true); QObject::connect(modeButtons,SIGNAL(buttonClicked(int)),this,SLOT(updateClampMode(int))); stepButton->setToolTip("Set mode to current steps"); rampButton->setToolTip("Set mode to triangular current ramps"); customlayout->addWidget(modeBox, 0, 0); QHBoxLayout *optionBoxLayout = new QHBoxLayout; QGroupBox *optionBoxGroup = new QGroupBox; QCheckBox *randomCheckBox = new QCheckBox("Randomize"); optionBoxLayout->addWidget(randomCheckBox); QCheckBox *plotFICheckBox = new QCheckBox("Plot FI Curve"); optionBoxLayout->addWidget(plotFICheckBox); QObject::connect(randomCheckBox,SIGNAL(toggled(bool)),this,SLOT(togglerandom(bool))); QObject::connect(plotFICheckBox,SIGNAL(toggled(bool)),eqnLine,SLOT(setVisible(bool))); QObject::connect(plotFICheckBox,SIGNAL(toggled(bool)),splot,SLOT(setVisible(bool))); QObject::connect(plotFICheckBox,SIGNAL(toggled(bool)),plotBox,SLOT(setVisible(bool))); QObject::connect(plotFICheckBox,SIGNAL(toggled(bool)),this,SLOT(toggleFIplot(bool))); QObject::connect(plotFICheckBox,SIGNAL(toggled(bool)),this,SLOT(resizeMe())); randomCheckBox->setToolTip("Randomize input amplitudes within a cycle"); plotFICheckBox->setToolTip("Show/Hide FI plot area"); optionBoxGroup->setLayout(optionBoxLayout); customlayout->addWidget(optionBoxGroup, 3, 0); QObject::connect(DefaultGUIModel::pauseButton,SIGNAL(toggled(bool)),savePlotButton,SLOT(setEnabled(bool))); QObject::connect(DefaultGUIModel::pauseButton,SIGNAL(toggled(bool)),printButton,SLOT(setEnabled(bool))); QObject::connect(DefaultGUIModel::pauseButton,SIGNAL(toggled(bool)),saveDataButton,SLOT(setEnabled(bool))); QObject::connect(DefaultGUIModel::pauseButton,SIGNAL(toggled(bool)),linearfitButton,SLOT(setEnabled(bool))); QObject::connect(DefaultGUIModel::pauseButton,SIGNAL(toggled(bool)),DefaultGUIModel::modifyButton,SLOT(setEnabled(bool))); DefaultGUIModel::pauseButton->setToolTip("Start/Stop current clamp protocol"); DefaultGUIModel::modifyButton->setToolTip("Commit changes to parameter values"); DefaultGUIModel::unloadButton->setToolTip("Close module"); QObject::connect(this,SIGNAL(newDataPoint(double,double)),splot,SLOT(appendPoint(double,double))); QObject::connect(this,SIGNAL(setFIRange(double, double, double, double)),splot,SLOT(setAxes(double, double, double, double))); QObject::connect(this,SIGNAL(setPlotMode(bool)),plotFICheckBox,SLOT(setChecked(bool))); QObject::connect(this,SIGNAL(setStepMode(bool)),plotFICheckBox,SLOT(setEnabled(bool))); QObject::connect(this,SIGNAL(setStepMode(bool)),plotBox,SLOT(setEnabled(bool))); QObject::connect(this,SIGNAL(drawFit(double*, double*, int)),splot,SLOT(appendLine(double*, double*, int))); QObject::connect(this,SIGNAL(setEqnMsg(const QString &)), eqnLine,SLOT(setText(const QString &))); setLayout(customlayout); }
StrokeDocker::StrokeDocker() : d( new Private() ) { setWindowTitle( i18n( "Stroke Properties" ) ); QWidget *mainWidget = new QWidget( this ); QGridLayout *mainLayout = new QGridLayout( mainWidget ); QLabel * styleLabel = new QLabel( i18n( "Style:" ), mainWidget ); mainLayout->addWidget( styleLabel, 0, 0 ); d->lineStyle = new KoLineStyleSelector( mainWidget ); mainLayout->addWidget( d->lineStyle, 0, 1, 1, 3 ); connect( d->lineStyle, SIGNAL(currentIndexChanged( int ) ), this, SLOT( styleChanged() ) ); QLabel* widthLabel = new QLabel( i18n ( "Width:" ), mainWidget ); mainLayout->addWidget( widthLabel, 1, 0 ); // set min/max/step and value in points, then set actual unit d->setLineWidth = new KoUnitDoubleSpinBox( mainWidget ); d->setLineWidth->setMinMaxStep( 0.0, 1000.0, 0.5 ); d->setLineWidth->setDecimals( 2 ); d->setLineWidth->setUnit( KoUnit(KoUnit::Point) ); d->setLineWidth->setToolTip( i18n( "Set line width of actual selection" ) ); mainLayout->addWidget( d->setLineWidth, 1, 1, 1, 3 ); connect( d->setLineWidth, SIGNAL( valueChangedPt( qreal ) ), this, SLOT( widthChanged() ) ); QLabel* capLabel = new QLabel( i18n ( "Cap:" ), mainWidget ); mainLayout->addWidget( capLabel, 2, 0 ); d->capGroup = new QButtonGroup( mainWidget ); d->capGroup->setExclusive( true ); d->capGroup->setExclusive( true ); QRadioButton *button = 0; button = new QRadioButton( mainWidget ); button->setIcon( SmallIcon( "cap_butt" ) ); button->setCheckable( true ); button->setToolTip( i18n( "Butt cap" ) ); d->capGroup->addButton( button, Qt::FlatCap ); mainLayout->addWidget( button, 2, 1 ); button = new QRadioButton( mainWidget ); button->setIcon( SmallIcon( "cap_round" ) ); button->setCheckable( true ); button->setToolTip( i18n( "Round cap" ) ); d->capGroup->addButton( button, Qt::RoundCap ); mainLayout->addWidget( button, 2, 2 ); button = new QRadioButton( mainWidget ); button->setIcon( SmallIcon( "cap_square" ) ); button->setCheckable( true ); button->setToolTip( i18n( "Square cap" ) ); d->capGroup->addButton( button, Qt::SquareCap ); mainLayout->addWidget( button, 2, 3 ); connect( d->capGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotCapChanged( int ) ) ); QLabel* joinLabel = new QLabel( i18n ( "Join:" ), mainWidget ); mainLayout->addWidget( joinLabel, 3, 0 ); d->joinGroup = new QButtonGroup( mainWidget ); d->joinGroup->setExclusive( true ); button = new QRadioButton( mainWidget ); button->setIcon( SmallIcon( "join_miter" ) ); button->setCheckable( true ); button->setToolTip( i18n( "Miter join" ) ); d->joinGroup->addButton( button, Qt::MiterJoin ); mainLayout->addWidget( button, 3, 1 ); button = new QRadioButton( mainWidget ); button->setIcon( SmallIcon( "join_round" ) ); button->setCheckable( true ); button->setToolTip( i18n( "Round join" ) ); d->joinGroup->addButton( button, Qt::RoundJoin ); mainLayout->addWidget( button, 3, 2 ); button = new QRadioButton( mainWidget ); button->setIcon( SmallIcon( "join_bevel" ) ); button->setCheckable( true ); button->setToolTip( i18n( "Bevel join" ) ); d->joinGroup->addButton( button, Qt::BevelJoin ); mainLayout->addWidget( button, 3, 3 ); connect( d->joinGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotJoinChanged( int ) ) ); QLabel* miterLabel = new QLabel( i18n ( "Miter limit:" ), mainWidget ); mainLayout->addWidget( miterLabel, 4, 0 ); // set min/max/step and value in points, then set actual unit d->miterLimit = new KoUnitDoubleSpinBox( mainWidget ); d->miterLimit->setMinMaxStep( 0.0, 1000.0, 0.5 ); d->miterLimit->setDecimals( 2 ); d->miterLimit->setUnit( KoUnit(KoUnit::Point) ); d->miterLimit->setToolTip( i18n( "Set miter limit" ) ); mainLayout->addWidget( d->miterLimit, 4, 1, 1, 3 ); connect( d->miterLimit, SIGNAL( valueChangedPt( qreal ) ), this, SLOT( miterLimitChanged() ) ); mainLayout->setRowStretch( 5, 1 ); mainLayout->setColumnStretch( 1, 1 ); mainLayout->setColumnStretch( 2, 1 ); mainLayout->setColumnStretch( 3, 1 ); setWidget( mainWidget ); updateControls(); }