//------------------------------------------------------------------------------------------------ // To create the group of radiobuttons for cell constituent selection. // This uses information about active constituents fetched from the DLL. // Need to distinguish field constituent from cell constituent, because for the cell we are // interested in CFSE, volume, O2byvol in addition to the dissolved constituents: // oxygen, glucose, drugA, drugB, metabolites... //------------------------------------------------------------------------------------------------ void Field::setCellConstituentButtons(QGroupBox *gbox, QButtonGroup *bg, QVBoxLayout **vbox, QList<QRadioButton *> *rb_list, QString tag) { int ivar; QString name, str, ivar_str; QRadioButton *rb; LOG_QMSG("setCellConstituentButtons: " + tag); if (rb_list->length() != 0) { LOG_MSG("rb_list not NULL, delete it"); for (ivar=0; ivar<rb_list->length(); ivar++) { rb = (*rb_list)[ivar]; bg->removeButton(rb); delete rb; } rb_list->clear(); } if (!*vbox) { LOG_MSG("vbox = NULL, create it"); *vbox = new QVBoxLayout; gbox->setLayout(*vbox); } name = "rb_cell_constituent_"+tag; LOG_QMSG(name); sprintf(msg,"rb_list: %p vbox: %p bg: %p nvars_used: %d",rb_list,*vbox,bg,Global::nvars_used); LOG_MSG(msg); for (ivar=0; ivar<Global::nvars_used; ivar++) { ivar_str = QString::number(ivar); str = Global::var_string[ivar]; rb = new QRadioButton; rb->setText(str); rb->setObjectName(name+ivar_str); (*vbox)->addWidget(rb); rb->setEnabled(true); bg->addButton(rb,ivar); rb_list->append(rb); // LOG_QMSG(rb->objectName()); } LOG_MSG("added buttons"); if (tag.contains("FACS")) { (*rb_list)[0]->setChecked(true); // CFSE } else { (*rb_list)[1]->setChecked(true); // Oxygen } QRect rect = gbox->geometry(); rect.setHeight(25*Global::nvars_used); gbox->setGeometry(rect); gbox->show(); }
// Create new radio button QtWidgetObject* AtenTreeGuiDialog::addRadioButton(TreeGuiWidget* widget, TreeGuiWidget* groupWidget, QString name, QString label, int id) { // Cast QObject in groupWidget into QButtonGroup QtWidgetObject* wo = groupWidget->qtWidgetObject(); if (wo == NULL) { printf("Internal Error: Can't add button to radiogroup widget since supplied widget doesn't have an associated QtWidgetObject.\n"); return NULL; } QButtonGroup *group = static_cast<QButtonGroup*>(wo->qObject()); if (!group) { printf("Internal Error: Couldn't cast QObject into QButtonGroup.\n"); return NULL; } // Create new QtWidgetObject for page QRadioButton *radio = new QRadioButton(label, this); group->addButton(radio, id); QtWidgetObject* qtwo = widgetObjects_.add(); qtwo->set(widget, radio); radio->setEnabled(widget->enabled()); radio->setVisible(widget->visible()); radio->setChecked(widget->valueI() == 1); radio->setMinimumHeight(WIDGETHEIGHT); radio->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); // Connect signal to master slot QObject::connect(radio, SIGNAL(clicked(bool)), this, SLOT(radioButtonWidget_clicked(bool))); return qtwo; }
void ImportExport::MD5CheckPage::createRow( QGridLayout* layout, int& row, const QString& name, const QString& title, bool anyClashes, bool allowMerge ) { if ( row % 3 == 0 ) { QFrame* line = new QFrame; line->setFrameShape( QFrame::HLine ); layout->addWidget( line, ++row, 0, 1, 4 ); } QLabel* label = new QLabel( title ); label->setEnabled( anyClashes ); layout->addWidget( label, ++row, 0 ); QButtonGroup* group = new QButtonGroup(this); m_groups[name]=group; for ( int i = 1; i<4;++i ) { if ( i == 3 && !allowMerge ) continue; QRadioButton* rb = new QRadioButton; layout->addWidget( rb, row, i ); group->addButton( rb, i ); rb->setEnabled( anyClashes ); if (i == 1 ) rb->setChecked(true); } }
void KRandRModule::addRotationButton(int thisRotation, bool checkbox) { Q_ASSERT(m_rotationGroup); if (!checkbox) { QRadioButton* thisButton = new QRadioButton(RandRScreen::rotationName(thisRotation), m_rotationGroup); thisButton->setEnabled(thisRotation & currentScreen()->rotations()); connect(thisButton, SIGNAL(clicked()), SLOT(slotRotationChanged())); } else { QCheckBox* thisButton = new QCheckBox(RandRScreen::rotationName(thisRotation), m_rotationGroup); thisButton->setEnabled(thisRotation & currentScreen()->rotations()); connect(thisButton, SIGNAL(clicked()), SLOT(slotRotationChanged())); } }
//------------------------------------------------------------------------------------------------ // To create the group of radiobuttons for field constituent selection. // This uses information about active constituents fetched from the DLL. // Need to distinguish field constituent from cell constituent, because for the // field we have only the dissolved constituents: // oxygen, glucose, drugA, drugB, metabolites... //------------------------------------------------------------------------------------------------ void Field::setFieldConstituentButtons(QGroupBox *gbox, QButtonGroup *bg, QVBoxLayout **vbox, QList<QRadioButton *> *rb_list, QString tag) { int ivar; QString name, str, ivar_str; QRadioButton *rb; Global::nfieldvars_used = Global::nvars_used - Global::N_EXTRA; // LOG_QMSG("setFieldConstituentButtons: " + tag + " nfieldvars_used: " // + QString::number(Global::nfieldvars_used)); if (rb_list->length() != 0) { LOG_MSG("rb_list not NULL, delete it"); for (ivar=0; ivar<rb_list->length(); ivar++) { rb = (*rb_list)[ivar]; bg->removeButton(rb); delete rb; } rb_list->clear(); } if (!*vbox) { LOG_MSG("vbox = NULL, create it"); *vbox = new QVBoxLayout; gbox->setLayout(*vbox); } name = "rb_field_constituent_"+tag; // LOG_QMSG(name); for (ivar=0; ivar<Global::nfieldvars_used; ivar++) { ivar_str = QString::number(ivar); str = Global::var_string[ivar+1]; rb = new QRadioButton; rb->setText(str); QString objname = name+ivar_str; rb->setObjectName(objname); (*vbox)->addWidget(rb); rb->setEnabled(true); bg->addButton(rb,ivar); rb_list->append(rb); // QRadioButton *chkrb = gbox->findChild<QRadioButton *>(objname); // if (chkrb) { // QString chkstr = chkrb->objectName(); // LOG_QMSG(chkstr); // } else { // chkrb = (*rb_list)[ivar]; // LOG_QMSG("findChild failed, but: " + chkrb->objectName()); // } } (*rb_list)[0]->setChecked(true); // Oxygen QRect rect = gbox->geometry(); rect.setHeight(25*(Global::nfieldvars_used + 1)); gbox->setGeometry(rect); gbox->show(); }
/** 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())); }
SettingsPageTask::SettingsPageTask( QWidget *parent) : QWidget( parent ), m_selectedSwitchScheme(0), m_distUnit(Distance::getUnit()), m_startLineValue(0), m_startRingValue(0), m_startSectorInnerRadiusValue(0), m_startSectorOuterRadiusValue(0), m_startSectorAngleValue(0), m_finishLineValue(0), m_finishRingValue(0), m_finishSectorInnerRadiusValue(0), m_finishSectorOuterRadiusValue(0), m_finishSectorAngleValue(0), m_obsCircleRadiusValue(0), m_obsSectorInnerRadiusValue(0), m_obsSectorOuterRadiusValue(0), m_obsSectorAngleValue(0) { setObjectName("SettingsPageTask"); setWindowFlags( Qt::Tool ); setWindowModality( Qt::WindowModal ); setAttribute(Qt::WA_DeleteOnClose); setWindowTitle( tr("Settings - Task") ); if( parent ) { resize( parent->size() ); } // Layout used by scroll area QHBoxLayout *sal = new QHBoxLayout; // new widget used as container for the dialog layout. QWidget* sw = new QWidget; // Scroll area QScrollArea* sa = new QScrollArea; sa->setWidgetResizable( true ); sa->setFrameStyle( QFrame::NoFrame ); sa->setWidget( sw ); #ifdef ANDROID QScrollBar* lvsb = sa->verticalScrollBar(); lvsb->setStyleSheet( Layout::getCbSbStyle() ); #endif #ifdef QSCROLLER QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture ); #endif #ifdef QTSCROLLER QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture ); #endif // Add scroll area to its own layout sal->addWidget( sa ); QHBoxLayout *contentLayout = new QHBoxLayout(this); // Pass scroll area layout to the content layout. contentLayout->addLayout( sal ); GeneralConfig *conf = GeneralConfig::instance(); int row = 0; QGridLayout *topLayout = new QGridLayout(sw); //contentLayout->addLayout(topLayout); topLayout->setMargin(10); topLayout->setSpacing(20); topLayout->setColumnStretch( 3, 5 ); //--------------------------------------------------------------- QGroupBox *ssBox = new QGroupBox( tr("Switch Scheme"), this ); topLayout->addWidget( ssBox, row, 0 ); ntScheme = new QButtonGroup(this); QRadioButton* nearest = new QRadioButton( tr("Minimum"), this ); QRadioButton* touched = new QRadioButton( tr("Touched"), this ); ntScheme->addButton( nearest, 0 ); ntScheme->addButton( touched, 1 ); m_reportSwitch = new QCheckBox( tr("Report"), this ); QVBoxLayout* vbox = new QVBoxLayout; vbox->addWidget( nearest ); vbox->addWidget( touched ); vbox->addWidget( m_reportSwitch ); vbox->addStretch(1); ssBox->setLayout(vbox); nearest->setEnabled(true); touched->setEnabled(true); touched->setChecked(true); // set active button as selected m_selectedSwitchScheme = (int) conf->getActiveTaskSwitchScheme(); if( ntScheme->button(m_selectedSwitchScheme) ) { ntScheme->button(m_selectedSwitchScheme)->setChecked(true); } connect( ntScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedNT(int)) ); //-------------------------------------------------------------- // as next shape group is added QGroupBox* shapeGroup = new QGroupBox( tr("Shape"), this ); topLayout->addWidget( shapeGroup, row, 1 ); QGridLayout *gBox = new QGridLayout; shapeGroup->setLayout(gBox); m_drawShape = new QCheckBox( tr("Draw"), this ); gBox->addWidget(m_drawShape, 0, 0 ); m_fillShape = new QCheckBox( tr("Fill"), this ); gBox->addWidget(m_fillShape, 1, 0 ); gBox->setColumnStretch( 2, 5 ); connect( m_fillShape, SIGNAL(stateChanged(int)), SLOT(slot_fillShapeStateChanged(int)) ); m_transShape = new NumberEditor( this ); m_transShape->setDecimalVisible( false ); m_transShape->setPmVisible( false ); m_transShape->setMaxLength(3); m_transShape->setSuffix( " %" ); m_transShape->setRange( 0, 100 ); m_transShape->setTip(tr("Opacity ") + "0...100"); m_transShape->setValue( 0 ); QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "(0|[1-9][0-9]{0,2})" ), this ); m_transShape->setValidator( eValidator ); // Sets a minimum width for the widget int mw1 = QFontMetrics(font()).width("100 %") + 10; m_transShape->setMinimumWidth( mw1 ); gBox->addWidget(m_transShape, 1, 1 ); m_drawShape->setChecked( conf->getTaskDrawShape() ); m_fillShape->setChecked( conf->getTaskFillShape() ); //-------------------------------------------------------------- // as next auto zoom group is added QGroupBox* zoomGroup = new QGroupBox( tr("Zoom"), this ); topLayout->addWidget( zoomGroup, row, 2 ); QVBoxLayout *zBox = new QVBoxLayout; zoomGroup->setLayout(zBox); m_autoZoom = new QCheckBox( tr("Auto"), this ); zBox->addWidget(m_autoZoom); zBox->addStretch(10); m_autoZoom->setChecked( conf->getTaskPointAutoZoom() ); #ifdef ANDROID topLayout->setRowMinimumHeight( ++row, 30 ); #endif row++; //-------------------------------------------------------------- // as next start group is added QGroupBox* startGroup1 = new QGroupBox( tr("Start"), this ); topLayout->addWidget( startGroup1, row, 0 ); QFormLayout *formLayout = new QFormLayout; startGroup1->setLayout(formLayout); m_startLine = createDNE( this ); m_startLine->setTip(tr("Line Length")); formLayout->addRow(tr("Line:"), m_startLine); m_startRing = createDNE( this ); m_startRing->setTip(tr("Circle Radius")); formLayout->addRow(tr("Circle:"), m_startRing); //-------------------------------------------------------------- // as next inner sector group is added QGroupBox* startGroup2 = new QGroupBox( tr("Sectors"), this ); topLayout->addWidget( startGroup2, row, 1 ); formLayout = new QFormLayout; startGroup2->setLayout(formLayout); m_startSectorInnerRadius = createDNE( this ); m_startSectorInnerRadius->setTip(tr("Inner Radius")); formLayout->addRow(tr("Radius 1:"), m_startSectorInnerRadius); m_startSectorOuterRadius = createDNE( this ); m_startSectorOuterRadius->setTip(tr("Outer Radius")); formLayout->addRow(tr("Radius 2:"), m_startSectorOuterRadius); m_startSectorAngle = createNE( this ); m_startSectorAngle->setTip(tr("Angle 1...360")); formLayout->addRow(tr("Angle:"), m_startSectorAngle); //-------------------------------------------------------------- // as next inner scheme group is added QGroupBox* startGroup3 = new QGroupBox( tr("Scheme"), this ); topLayout->addWidget( startGroup3, row, 2 ); formLayout = new QFormLayout; startGroup3->setLayout(formLayout); QRadioButton* circle = new QRadioButton( tr("Circle"), this ); QRadioButton* sector = new QRadioButton( tr("Sector"), this ); QRadioButton* keyhole = new QRadioButton( tr("Keyhole"), this ); QRadioButton* line = new QRadioButton( tr("Line"), this ); startScheme = new QButtonGroup(this); startScheme->addButton( circle, GeneralConfig::Circle ); startScheme->addButton( sector, GeneralConfig::Sector ); startScheme->addButton( keyhole, GeneralConfig::Keyhole ); startScheme->addButton( line, GeneralConfig::Line ); formLayout->addWidget( circle ); formLayout->addWidget( sector ); formLayout->addWidget( keyhole ); formLayout->addWidget( line ); circle->setEnabled(true); circle->setChecked(false); sector->setEnabled(true); sector->setChecked(false); keyhole->setEnabled(true); keyhole->setChecked(false); line->setEnabled(true); line->setChecked(false); // set active button as selected m_selectedStartScheme = (int) conf->getActiveTaskStartScheme(); if( startScheme->button(m_selectedStartScheme) ) { startScheme->button(m_selectedStartScheme)->setChecked(true); } #ifdef ANDROID topLayout->setRowMinimumHeight( ++row, 30 ); #endif row++; //-------------------------------------------------------------- // as next finish group is added QGroupBox* finishGroup1 = new QGroupBox( tr("Finish"), this ); topLayout->addWidget( finishGroup1, row, 0 ); formLayout = new QFormLayout; finishGroup1->setLayout(formLayout); m_finishLine = createDNE( this ); m_finishLine->setTip(tr("Line Length")); formLayout->addRow(tr("Line:"), m_finishLine); m_finishRing = createDNE( this ); m_finishRing->setTip(tr("Circle Radius")); formLayout->addRow(tr("Circle"), m_finishRing); //-------------------------------------------------------------- // as next inner sector group is added QGroupBox* finishGroup2 = new QGroupBox( tr("Sectors"), this ); topLayout->addWidget( finishGroup2, row, 1 ); formLayout = new QFormLayout; finishGroup2->setLayout(formLayout); m_finishSectorInnerRadius = createDNE( this ); m_finishSectorInnerRadius->setTip(tr("Inner Radius")); formLayout->addRow(tr("Radius 1:"), m_finishSectorInnerRadius); m_finishSectorOuterRadius = createDNE( this ); m_finishSectorOuterRadius->setTip(tr("Outer Radius")); formLayout->addRow(tr("Radius 2:"), m_finishSectorOuterRadius); m_finishSectorAngle = createNE( this ); m_finishSectorAngle->setTip(tr("Angle 1...360")); formLayout->addRow(tr("Angle:"), m_finishSectorAngle); //-------------------------------------------------------------- // as next inner scheme group is added QGroupBox* finishGroup3 = new QGroupBox( tr("Scheme"), this ); topLayout->addWidget( finishGroup3, row, 2 ); formLayout = new QFormLayout; finishGroup3->setLayout(formLayout); circle = new QRadioButton( tr("Circle"), this ); sector = new QRadioButton( tr("Sector"), this ); keyhole = new QRadioButton( tr("Keyhole"), this ); line = new QRadioButton( tr("Line"), this ); finishScheme = new QButtonGroup(this); finishScheme->addButton( circle, GeneralConfig::Circle ); finishScheme->addButton( sector, GeneralConfig::Sector ); finishScheme->addButton( keyhole, GeneralConfig::Keyhole ); finishScheme->addButton( line, GeneralConfig::Line ); formLayout->addWidget( circle ); formLayout->addWidget( sector ); formLayout->addWidget( keyhole ); formLayout->addWidget( line ); circle->setEnabled(true); circle->setChecked(false); sector->setEnabled(true); sector->setChecked(false); keyhole->setEnabled(true); keyhole->setChecked(false); line->setEnabled(true); line->setChecked(false); // set active button as selected m_selectedFinishScheme = (int) conf->getActiveTaskFinishScheme(); if( finishScheme->button(m_selectedFinishScheme) ) { finishScheme->button(m_selectedFinishScheme)->setChecked(true); } #ifdef ANDROID topLayout->setRowMinimumHeight( ++row, 30 ); #endif row++; //-------------------------------------------------------------- // as next observation zone is added QGroupBox* obZoneGroup1 = new QGroupBox( tr("Observation"), this ); topLayout->addWidget( obZoneGroup1, row, 0 ); formLayout = new QFormLayout; obZoneGroup1->setLayout(formLayout); m_obsCircleRadius = createDNE( this ); m_obsCircleRadius->setTip(tr("Circle Radius")); formLayout->addRow(tr("Circle:"), m_obsCircleRadius); //-------------------------------------------------------------- // as next inner sector group is added QGroupBox* obZoneGroup2 = new QGroupBox( tr("Sectors"), this ); topLayout->addWidget( obZoneGroup2, row, 1 ); formLayout = new QFormLayout; obZoneGroup2->setLayout(formLayout); m_obsSectorInnerRadius = createDNE( this ); m_obsSectorInnerRadius->setTip(tr("Inner Radius")); formLayout->addRow(tr("Radius 1:"), m_obsSectorInnerRadius); m_obsSectorOuterRadius = createDNE( this ); m_obsSectorOuterRadius->setTip(tr("Outer Radius")); formLayout->addRow(tr("Radius 2:"), m_obsSectorOuterRadius); m_obsSectorAngle = createNE( this ); m_obsSectorAngle->setTip(tr("Angle 1...360")); formLayout->addRow(tr("Angle:"), m_obsSectorAngle); //-------------------------------------------------------------- // as next inner observer scheme group is added QGroupBox* obZoneGroup3 = new QGroupBox( tr("Scheme"), this ); topLayout->addWidget( obZoneGroup3, row, 2 ); formLayout = new QFormLayout; obZoneGroup3->setLayout(formLayout); circle = new QRadioButton( tr("Circle"), this ); sector = new QRadioButton( tr("Sector"), this ); keyhole = new QRadioButton( tr("Keyhole"), this ); // no line for observer area obsScheme = new QButtonGroup(this); obsScheme->addButton( circle, GeneralConfig::Circle ); obsScheme->addButton( sector, GeneralConfig::Sector ); obsScheme->addButton( keyhole, GeneralConfig::Keyhole ); formLayout->addWidget( circle ); formLayout->addWidget( sector ); formLayout->addWidget( keyhole ); circle->setEnabled(true); circle->setChecked(false); sector->setEnabled(true); sector->setChecked(false); keyhole->setEnabled(true); keyhole->setChecked(false); // set active button as selected m_selectedObsScheme = (int) conf->getActiveTaskObsScheme(); if( obsScheme->button(m_selectedObsScheme) ) { obsScheme->button(m_selectedObsScheme)->setChecked(true); } //-------------------------------------------------------------- // Connect sector check controls. connect( m_startSectorOuterRadius, SIGNAL(numberEdited(const QString&)), this, SLOT(slot_outerSectorStartChanged(const QString&)) ); connect( m_finishSectorOuterRadius, SIGNAL(numberEdited(const QString&)), this, SLOT(slot_outerSectorFinishChanged(const QString&)) ); connect( m_obsSectorOuterRadius, SIGNAL(numberEdited(const QString&)), this, SLOT(slot_outerSectorObsChanged(const QString&)) ); connect( startScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedSS(int)) ); connect( finishScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedFS(int)) ); connect( obsScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedOS(int)) ); QPushButton *cancel = new QPushButton(this); cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png"))); cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12))); cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred); QPushButton *ok = new QPushButton(this); ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png"))); ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12))); ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred); QLabel *titlePix = new QLabel(this); titlePix->setAlignment( Qt::AlignCenter ); titlePix->setPixmap(GeneralConfig::instance()->loadPixmap("setup.png")); connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept())); connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject())); QVBoxLayout *buttonBox = new QVBoxLayout; buttonBox->setSpacing(0); buttonBox->addStretch(2); buttonBox->addWidget(cancel, 1); buttonBox->addSpacing(30); buttonBox->addWidget(ok, 1); buttonBox->addStretch(2); buttonBox->addWidget(titlePix); contentLayout->addLayout(buttonBox); load(); }
PrintDialog::PrintDialog( QWidget *parent, const char *name, int maxPages, bool marked ) : QDialog( parent, name, TRUE ) { setFocusPolicy(QWidget::StrongFocus); pgMode = All; /* printerName.sprintf( "" ); // default printer will be chosen. spoolerCommand.sprintf( "lpr" ); printerVariable.sprintf( "PRINTER" ); */ KConfig *config = KApplication::getKApplication()->getConfig(); /* Read in the default options. */ config->setGroup( "Print" ); printerName=config->readEntry ("Name",""); spoolerCommand=config->readEntry ("Spool","lpr"); printerVariable=config->readEntry ("Variable","PRINTER"); pgMax = maxPages; pgStart=0; pgEnd=0; int border = 10; QBoxLayout *topLayout = new QVBoxLayout( this, border ); cbFile = new QCheckBox( i18n("Print to file"), this ); cbFile->setFixedHeight( cbFile->sizeHint().height() ); topLayout->addWidget( cbFile ); QGroupBox *group = new QGroupBox( i18n( "Pages" ), this ); topLayout->addWidget( group, 10 ); QGridLayout *grid = new QGridLayout( group, 5, 7, 5 ); grid->setRowStretch( 0, 10 ); grid->setRowStretch( 1, 100 ); grid->setRowStretch( 2, 0 ); grid->setRowStretch( 3, 100 ); grid->setRowStretch( 4, 10 ); grid->setColStretch( 0, 0 ); grid->setColStretch( 1, 100 ); grid->setColStretch( 2, 100 ); grid->setColStretch( 3, 100 ); grid->setColStretch( 4, 0 ); grid->setColStretch( 5, 100 ); grid->setColStretch( 6, 0 ); pgGroup = new QButtonGroup( group ); pgGroup->hide(); pgGroup->setExclusive( true ); connect( pgGroup, SIGNAL( clicked( int ) ), SLOT( slotPageMode( int ) ) ); int widest = 0; QRadioButton *arb = new QRadioButton( i18n("&All"), group ); arb->setFixedHeight( arb->sizeHint().height()+6 ); arb->setChecked( true ); pgGroup->insert( arb, All ); grid->addWidget( arb, 1, 1 ); if ( arb->sizeHint().width() > widest ) widest = arb->sizeHint().width(); QRadioButton *rb = new QRadioButton( i18n("&Current"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); pgGroup->insert( rb, Current ); grid->addWidget( rb, 1, 2 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); rb = new QRadioButton( i18n("&Marked"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); if ( !marked ) rb->setEnabled( false ); else { arb->setChecked ( false ); rb->setChecked ( true ); } pgGroup->insert( rb, Marked ); grid->addWidget( rb, 3, 1 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); rb = new QRadioButton( i18n("&Range"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); pgGroup->insert( rb, Range ); grid->addWidget( rb, 3, 2 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); leStart = new QLineEdit( group ); leStart->setFixedHeight( rb->sizeHint().height()+6 ); grid->addWidget( leStart, 3, 3 ); lTo = new QLabel( group ); lTo->setText( i18n("to") ); lTo->setAlignment( AlignCenter ); lTo->setMinimumSize( lTo->sizeHint() ); grid->addWidget( lTo, 3, 4 ); leEnd = new QLineEdit( group ); leEnd->setFixedHeight( rb->sizeHint().height()+6 ); grid->addWidget( leEnd, 3, 5 ); group->setMinimumSize( QSize( 4*widest+25, 4*(rb->sizeHint().height()+6) ) ); cbOrder = new QCheckBox( i18n("Print document in re&verse order"), this ); cbOrder->setFixedHeight( cbOrder->sizeHint().height() ); topLayout->addWidget( cbOrder ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this ); tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken ); tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() ); topLayout->addWidget( tmpQFrame ); // CREATE BUTTONS KButtonBox *bbox = new KButtonBox( this ); QPushButton* setup = bbox->addButton( i18n("&Setup ...") ); connect( setup, SIGNAL(clicked()), SLOT( setup()) ); bbox->addStretch( 10 ); QPushButton* ok = bbox->addButton( i18n("&OK") ); connect( ok, SIGNAL(clicked()), SLOT( checkRange() ) ); QPushButton* cancel = bbox->addButton( i18n("&Cancel") ); connect( cancel, SIGNAL(clicked()), SLOT(reject()) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); if ( marked ) slotPageMode( Marked ); else slotPageMode( All ); resize( 250, 0 ); }
PsdSettingsPopup::PsdSettingsPopup() : Dialog(TApp::instance()->getMainWindow(), true, true, "PsdSettings") , m_mode(FLAT) { bool ret = true; setWindowTitle(tr("Load PSD File")); m_filename = new QLabel(tr("")); m_filename->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); m_filename->setFixedHeight(WidgetHeight); m_parentDir = new QLabel(tr("")); m_parentDir->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); m_parentDir->setFixedHeight(WidgetHeight); QLabel *nmLbl = new QLabel(tr("Name:")); nmLbl->setObjectName("TitleTxtLabel"); QLabel *ptLbl = new QLabel(tr("Path:")); ptLbl->setObjectName("TitleTxtLabel"); QGridLayout *grid = new QGridLayout(); grid->setColumnMinimumWidth(0, 65); grid->addWidget(nmLbl, 0, 0, Qt::AlignRight); grid->addWidget(m_filename, 0, 1, Qt::AlignLeft); grid->addWidget(ptLbl, 1, 0, Qt::AlignRight); grid->addWidget(m_parentDir, 1, 1, Qt::AlignLeft); QHBoxLayout *layinfo = new QHBoxLayout; layinfo->addLayout(grid); layinfo->addStretch(); addLayout(layinfo, false); /* m_psdTree = new QTreeWidget(); m_psdTree->setIconSize(QSize(21,17)); m_psdTree->setColumnCount(1); m_psdTree->setMaximumHeight(7*WidgetHeight); m_psdTree->setHeaderLabel("PSD Info"); addWidget(m_psdTree); */ addSeparator(); m_loadMode = new QComboBox(); QStringList modes; modes.push_back("Single Image"); modes.push_back("Frames"); modes.push_back("Columns"); m_loadMode->addItems(modes); m_loadMode->setFixedHeight(WidgetHeight); m_loadMode->setFixedWidth(120); m_modeDescription = new QTextEdit(modesDescription[0]); m_modeDescription->setFixedHeight(40); m_modeDescription->setMinimumWidth(250); m_modeDescription->setReadOnly(true); m_createSubXSheet = new CheckBox(tr("Expose in a Sub-xsheet")); m_createSubXSheet->setMaximumHeight(WidgetHeight); m_createSubXSheet->setEnabled(false); m_levelNameType = new QComboBox(); QStringList types; types << tr("FileName#LayerName") << tr("LayerName"); m_levelNameType->addItems(types); m_levelNameType->setFixedHeight(WidgetHeight); m_levelNameType->setEnabled(false); QLabel *modeLbl = new QLabel(tr("Load As:")); modeLbl->setObjectName("TitleTxtLabel"); QLabel *levelNameLbl = new QLabel(tr("Level Name:")); levelNameLbl->setObjectName("TitleTxtLabel"); QGridLayout *gridMode = new QGridLayout(); gridMode->setColumnMinimumWidth(0, 65); gridMode->setMargin(0); gridMode->addWidget(modeLbl, 0, 0, Qt::AlignRight); gridMode->addWidget(m_loadMode, 0, 1, Qt::AlignLeft); gridMode->addWidget(m_modeDescription, 1, 1, Qt::AlignLeft); gridMode->addWidget(m_createSubXSheet, 2, 1, Qt::AlignLeft); gridMode->addWidget(levelNameLbl, 3, 0, Qt::AlignRight); gridMode->addWidget(m_levelNameType, 3, 1, Qt::AlignLeft); QHBoxLayout *modeLayout = new QHBoxLayout; modeLayout->addLayout(gridMode); modeLayout->addStretch(); addLayout(modeLayout, false); addSeparator(tr("Group Option")); m_psdFolderOptions = new QButtonGroup(this); QList<QString> folderOptionsList; folderOptionsList << tr("Ignore groups"); folderOptionsList << tr( "Expose layers in a group as columns in a sub-xsheet"); folderOptionsList << tr("Expose layers in a group as frames in a column"); QGridLayout *gridButton = new QGridLayout(); gridButton->setColumnMinimumWidth(0, 70); int i; for (i = 0; i < folderOptionsList.count(); i++) { QRadioButton *radioButton = new QRadioButton(folderOptionsList.at(i)); if (i == 0) radioButton->setChecked(true); radioButton->setMaximumHeight(WidgetHeight); if (m_mode != COLUMNS) { radioButton->setEnabled(false); } m_psdFolderOptions->addButton(radioButton); m_psdFolderOptions->setId(radioButton, i); gridButton->addWidget(radioButton, i, 1); } QHBoxLayout *folderOptLayout = new QHBoxLayout; folderOptLayout->addLayout(gridButton); folderOptLayout->addStretch(); addLayout(folderOptLayout, false); ret = ret && connect(m_loadMode, SIGNAL(currentIndexChanged(const QString &)), SLOT(onModeChanged(const QString &))); assert(ret); ret = ret && connect(m_psdFolderOptions, SIGNAL(buttonClicked(int)), this, SLOT(onFolderOptionChange(int))); assert(ret); m_okBtn = new QPushButton("OK", this); m_cancelBtn = new QPushButton("Cancel", this); connect(m_okBtn, SIGNAL(clicked()), this, SLOT(onOk())); connect(m_cancelBtn, SIGNAL(clicked()), this, SLOT(close())); addButtonBarWidget(m_okBtn, m_cancelBtn); }
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); }