void AtenPrefs::updateParameterTable() { if (!isVisible()) return; Messenger::enter("AtenPrefs::updateParameterTable"); int row = ui.FunctionalFormList->currentRow(); if (row == -1) { ui.ParameterTable->setRowCount(0); Messenger::exit("AtenPrefs::updateParameterTable"); return; } int n; QStringList combrules; QComboBox* combo; QTableWidgetItem *item; for (n=0; n<CombinationRules::nCombinationRules; ++n) combrules << CombinationRules::combinationRuleName( (CombinationRules::CombinationRule) n); ui.ParameterTable->setColumnCount(2); ui.ParameterTable->setRowCount(VdwFunctions::functionData[row].nParameters); for (n=0; n<VdwFunctions::functionData[row].nParameters; ++n) { item = new QTableWidgetItem(VdwFunctions::functionData[row].parameters[n]); ui.ParameterTable->setItem(n, 0, item); combo = new QComboBox(this); combo->setMinimumSize(78,24); combo->addItems(combrules); combo->setItemData(0, n); combo->setCurrentIndex(VdwFunctions::functionData[row].combinationRules[n]); ui.ParameterTable->setCellWidget(n, 1, combo); QObject::connect(combo, SIGNAL(activated(int)), this, SLOT(ParameterRuleChanged(int))); } Messenger::exit("AtenPrefs::updateParameterTable"); }
CProperties::CProperties( QWidget* parent, const char* name, HODBCINSTPROPERTY hTheFirstProperty ) : QMainWindow( parent, name, 0 ) { HODBCINSTPROPERTY hProperty; int nProperty; pMainWidget = new QWidget( this ); setCentralWidget( pMainWidget ); pTopLayout = new QVBoxLayout( pMainWidget ); // SETUP TOOLBAR toolbarMain = new QToolBar( this ); addToolBar( toolbarMain, tr( "ToolBar" ), Top, FALSE ); new QToolButton( QPixmap( checkOk_xpm ), QString(tr("Save and Exit")), QString(""), this, SLOT(pbOk_Clicked()), toolbarMain ); new QToolButton( QPixmap( checkCancel_xpm ), QString(tr("Cancel any changes and Exit")), QString(""), this, SLOT(pbCancel_Clicked()), toolbarMain ); QWhatsThis::whatsThisButton ( toolbarMain ); /* PROPERTIES */ hFirstProperty = hTheFirstProperty; for ( nProperties = 0, hProperty = hFirstProperty; hProperty != NULL; hProperty = hProperty->pNext ) { nProperties++; } pGridLayout = new QGridLayout( nProperties, 2, 2 ); pTopLayout->addLayout( pGridLayout ); pGridLayout->setColStretch ( 0, 0 ); pGridLayout->setColStretch ( 1, 1 ); for ( nProperty = 0, hProperty = hFirstProperty; hProperty != NULL; nProperty++, hProperty = hProperty->pNext ) { QLabel *pLabel = new QLabel( pMainWidget ); // 1ST COLUMN IS ALWAYS A LABEL CONTAINING THE PROPERTY NAME if ( hProperty->nPromptType != ODBCINST_PROMPTTYPE_HIDDEN ) { if ( hProperty->pszHelp ) QWhatsThis::add( pLabel, hProperty->pszHelp ); pLabel->setLineWidth( 1 ); pLabel->setText( hProperty->szName ); pLabel->setMinimumSize( pLabel->sizeHint() ); pLabel->setFixedHeight( pLabel->sizeHint().height() ); pGridLayout->addWidget( pLabel, nProperty, 0 ); } // 2ND COLUMN IS WHERE THE USER ENTERS DATA SO CREATE A WIDGET THAT IS MEANINGFULL switch ( hProperty->nPromptType ) { case ODBCINST_PROMPTTYPE_LABEL: { QLabel *pLabel2 = new QLabel( pMainWidget ); if ( hProperty->pszHelp ) QWhatsThis::add( pLabel2, hProperty->pszHelp ); pLabel2->setFrameStyle( QFrame::Box | QFrame::Sunken ); pLabel2->setLineWidth( 1 ); pLabel2->setText( hProperty->szValue ); pLabel2->setMinimumSize( pLabel2->sizeHint() ); pLabel2->setFixedHeight( pLabel2->sizeHint().height() ); pGridLayout->addWidget( pLabel2, nProperty, 1 ); hProperty->pWidget = pLabel2; if ( hProperty->pszHelp ) QToolTip::add( pLabel2, hProperty->pszHelp ); } break; case ODBCINST_PROMPTTYPE_LISTBOX: { QComboBox *pComboBox = new QComboBox( pMainWidget ); if ( hProperty->pszHelp ) QWhatsThis::add( pComboBox, hProperty->pszHelp ); pComboBox->insertStrList( (const char **)hProperty->aPromptData ); pComboBox->setMinimumSize( pComboBox->sizeHint() ); pComboBox->setFixedHeight( pComboBox->sizeHint().height() ); pGridLayout->addWidget( pComboBox, nProperty, 1 ); hProperty->pWidget = pComboBox; if ( hProperty->pszHelp ) QToolTip::add( pComboBox, hProperty->pszHelp ); setCurrentItem( pComboBox, hProperty->szValue ); } break; case ODBCINST_PROMPTTYPE_COMBOBOX: { QComboBox *pComboBox = new QComboBox( true, pMainWidget ); if ( hProperty->pszHelp ) QWhatsThis::add( pComboBox, hProperty->pszHelp ); pComboBox->insertStrList( (const char **)hProperty->aPromptData ); pComboBox->setEditText( hProperty->szValue ); pComboBox->setMinimumSize( pComboBox->sizeHint() ); pComboBox->setFixedHeight( pComboBox->sizeHint().height() ); pGridLayout->addWidget( pComboBox, nProperty, 1 ); hProperty->pWidget = pComboBox; if ( hProperty->pszHelp ) QToolTip::add( pComboBox, hProperty->pszHelp ); } break; case ODBCINST_PROMPTTYPE_FILENAME: { CFileSelector *pFileSelector = new CFileSelector( pMainWidget ); if ( hProperty->pszHelp ) QWhatsThis::add( pFileSelector, hProperty->pszHelp ); pFileSelector->pLineEdit->setText( hProperty->szValue ); pGridLayout->addWidget( pFileSelector, nProperty, 1 ); hProperty->pWidget = pFileSelector; if ( hProperty->pszHelp ) QToolTip::add( pFileSelector, hProperty->pszHelp ); } break; case ODBCINST_PROMPTTYPE_HIDDEN: delete pLabel; break; default: // PROMPTTYPE_TEXTEDIT and PROMPTTYPE_TEXTEDIT_PASSWORD { QLineEdit *pLineEdit = new QLineEdit( pMainWidget ); if ( hProperty->pszHelp ) QWhatsThis::add( pLineEdit, hProperty->pszHelp ); pLineEdit->setText( hProperty->szValue ); pLineEdit->setMinimumHeight( pLineEdit->sizeHint().height() ); pLineEdit->setFixedHeight( pLineEdit->sizeHint().height() ); if (hProperty->nPromptType == ODBCINST_PROMPTTYPE_TEXTEDIT_PASSWORD) pLineEdit->setEchoMode( QLineEdit::Password ) ; pGridLayout->addWidget( pLineEdit, nProperty, 1 ); pLabel->setBuddy( pLineEdit ); hProperty->pWidget = pLineEdit; if ( hProperty->pszHelp ) QToolTip::add( pLineEdit, hProperty->pszHelp ); } } } /* SPACER */ QLabel *pSpacer = new QLabel( pMainWidget ); pTopLayout->addWidget( pSpacer, 11 ); pTopLayout->activate(); pMainWidget->show(); }
NoteInfo::NoteInfo(QWidget* parent) : QWidget(parent) { deltaMode = false; m_layout = new QVBoxLayout(this); selTime = new PosEdit; selTime->setObjectName("Start"); addTool(tr("Start"), selTime); selLen = new QSpinBox(); selLen->setRange(0, 100000); selLen->setSingleStep(1); addTool(tr("Len"), selLen); selPitch = new PitchEdit; addTool(tr("Pitch"), selPitch); selVelOn = new QSpinBox(); selVelOn->setRange(0, 127); selVelOn->setSingleStep(1); addTool(tr("Velo On"), selVelOn); selVelOff = new QSpinBox(); selVelOff->setRange(0, 127); selVelOff->setSingleStep(1); addTool(tr("Velo Off"), selVelOff); m_renderAlpha = new QSpinBox(); m_renderAlpha->setRange(0, 255); m_renderAlpha->setSingleStep(1); int alpha = tconfig().get_property("PianorollEdit", "renderalpha", 50).toInt(); m_renderAlpha->setValue(alpha); addTool(tr("BG Brightness"), m_renderAlpha); m_partLines = new QCheckBox(this); bool pl = tconfig().get_property("PianorollEdit", "partLines", true).toBool(); m_partLines->setChecked(pl); addTool(tr("Part End Marker"), m_partLines); //start tb1 merge/*{{{*/ //--------------------------------------------------- // Raster, Quant. //--------------------------------------------------- rasterLabel = new GridCombo(this); quantLabel = new GridCombo(this); rlist = new QTableWidget(10, 3); rlist->setObjectName("listSnap"); qlist = new QTableWidget(8, 3); qlist->setObjectName("listQuant"); rlist->verticalHeader()->setDefaultSectionSize(22); rlist->horizontalHeader()->setDefaultSectionSize(32); rlist->setSelectionMode(QAbstractItemView::SingleSelection); rlist->verticalHeader()->hide(); rlist->horizontalHeader()->hide(); qlist->verticalHeader()->setDefaultSectionSize(22); qlist->horizontalHeader()->setDefaultSectionSize(32); qlist->setSelectionMode(QAbstractItemView::SingleSelection); qlist->verticalHeader()->hide(); qlist->horizontalHeader()->hide(); rlist->setMinimumWidth(96); qlist->setMinimumWidth(96); rasterLabel->setView(rlist); quantLabel->setView(qlist); for (int j = 0; j < 3; j++) for (int i = 0; i < 10; i++) rlist->setItem(i, j, new QTableWidgetItem(tr(rasterStrings[i + j * 10]))); for (int j = 0; j < 3; j++) for (int i = 0; i < 8; i++) qlist->setItem(i, j, new QTableWidgetItem(tr(quantStrings[i + j * 8]))); setRaster(96); setQuant(96); rasterLabel->setMinimumSize(QSize(80, 22)); quantLabel->setMinimumSize(QSize(80, 22)); QHBoxLayout *hbox1 = new QHBoxLayout(); hbox1->addWidget(new QLabel(tr("Snap"))); hbox1->addWidget(rasterLabel); QHBoxLayout *hbox2 = new QHBoxLayout(); hbox2->addWidget(new QLabel(tr("Quant."))); hbox2->addWidget(quantLabel); m_layout->addLayout(hbox1); m_layout->addLayout(hbox2); //--------------------------------------------------- // To Menu //--------------------------------------------------- QComboBox* toList = new QComboBox; toList->insertItem(0, tr("All Events")); toList->insertItem(CMD_RANGE_LOOP, tr("Looped Ev.")); toList->insertItem(CMD_RANGE_SELECTED, tr("Selected Ev.")); toList->insertItem(CMD_RANGE_LOOP | CMD_RANGE_SELECTED, tr("Looped+Sel.")); toList->setMinimumSize(QSize(80, 22)); QHBoxLayout *hbox3 = new QHBoxLayout(); hbox3->addWidget(new QLabel(tr("To"))); hbox3->addWidget(toList); m_layout->addLayout(hbox3); connect(rasterLabel, SIGNAL(activated(int)), SLOT(_rasterChanged(int))); connect(quantLabel, SIGNAL(activated(int)), SLOT(_quantChanged(int))); connect(toList, SIGNAL(activated(int)), SIGNAL(toChanged(int))); //end tb1/*}}}*/ QSpacerItem* vSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); m_layout->addItem(vSpacer); connect(selLen, SIGNAL(valueChanged(int)), SLOT(lenChanged(int))); connect(selPitch, SIGNAL(valueChanged(int)), SLOT(pitchChanged(int))); connect(selVelOn, SIGNAL(valueChanged(int)), SLOT(velOnChanged(int))); connect(selVelOff, SIGNAL(valueChanged(int)), SLOT(velOffChanged(int))); connect(m_renderAlpha, SIGNAL(valueChanged(int)), SLOT(alphaChanged(int))); connect(selTime, SIGNAL(valueChanged(const Pos&)), SLOT(timeChanged(const Pos&))); connect(m_partLines, SIGNAL(toggled(bool)), SLOT(partLinesChanged(bool))); }
VW::VW( QWidget * parent, const char * name ) : QWidget( parent, name ) { QHBoxLayout * hb; hb = new QHBoxLayout( this, 10 ); QGroupBox * box; box = new QGroupBox( this, "input box" ); hb->addWidget( box, 0, AlignTop ); QVBoxLayout * b; // set up the input box b = new QVBoxLayout( box, 12 ); QLabel * l = new QLabel( "Enter Vehicle Details", box, "header" ); l->setMinimumSize( l->sizeHint() ); b->addWidget( l ); QFrame * f = new QFrame( box, "horizontal divider" ); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); f->setMinimumHeight( 12 ); b->addWidget( f ); QGridLayout *grid = new QGridLayout( 3, 2 ); b->addLayout( grid ); // here we start on the input grid, with labels and other widget // neatly arranged. the variable names are reused all over the // place. QComboBox * model = new QComboBox( FALSE, box, "model selection" ); model->insertItem( "Type 1 Beetle" ); model->insertItem( "Camper" ); model->insertItem( "Van" ); model->insertItem( "Fastback" ); model->insertItem( "Squareback" ); model->insertItem( "Notchback" ); model->insertItem( "411" ); model->setCurrentItem( model->count() - 1 ); // I like the 411 currentModel = "411"; model->insertItem( "412" ); model->insertItem( "Karmann Ghia" ); model->insertItem( "Thing" ); model->insertItem( "Safari" ); model->insertItem( "Kubelwagen" ); model->insertItem( "Trekker" ); model->insertItem( "Baja" ); model->setMinimumSize( model->sizeHint() ); model->setMaximumHeight( model->minimumSize().height() ); grid->addWidget( model, 0, 1 ); l = new QLabel( model, "Model:", box, "model label" ); l->setMinimumSize( l->sizeHint() ); grid->addWidget( l, 0, 0 ); QSpinBox * motor = new QSpinBox( 1000, 1600, 100, box, "motor size selection" ); motor->setValue( 1000 ); currentMotorSize = 1000; motor->setMinimumSize( motor->sizeHint() ); motor->setMaximumHeight( motor->minimumSize().height() ); grid->addWidget( motor, 1, 1 ); l = new QLabel( motor, "Motor size (cc):", box, "motor size label" ); l->setMinimumSize( l->sizeHint() ); grid->addWidget( l, 1, 0 ); QSpinBox * year = new QSpinBox( box, "model year" ); year->setRange( 1949, 1981 ); year->setValue( 1949 ); currentYear = 1949; year->setMinimumSize( year->sizeHint() ); year->setMaximumHeight( year->minimumSize().height() ); grid->addWidget( year, 2, 1 ); l = new QLabel( year, "Model:", box, "model year label" ); l->setMinimumSize( l->sizeHint() ); grid->addWidget( l, 2, 0 ); b->addStretch( 1 ); b->activate(); // output box box = new QGroupBox( this, "output box" ); hb->addWidget( box, 0, AlignTop ); b = new QVBoxLayout( box, 12 ); l = new QLabel( "Resulting Limousine:", box, "header" ); l->setMinimumSize( l->sizeHint() ); b->addWidget( l ); f = new QFrame( box, "horizontal divider" ); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); f->setMinimumHeight( 12 ); b->addWidget( f ); l = new QLabel( box, "output label" ); l->setAlignment( AlignTop | AlignLeft | WordBreak ); l->setText( "No VW selected yet." ); b->addWidget( l, 1 ); b->addStretch( 1 ); b->activate(); hb->activate(); // set up connections connect( model, SIGNAL(activated(const char *)), this, SLOT(modelSelected(const char *)) ); connect( motor, SIGNAL(valueChanged(int)), this, SLOT(motorSelected(int)) ); connect( year, SIGNAL(valueChanged(int)), this, SLOT(yearSelected(int)) ); connect( this, SIGNAL(validSelectionMade(const char *)), l, SLOT(setText(const char *)) ); }