/** * @brief Creates a new instance of a AboutDialog object. * * @param parent the parent widget * @param name the name of the widget */ AboutDialog::AboutDialog(QWidget* parent, const char* name = 0) : QDialog(parent, name) { m_mainLayout = new QVBoxLayout(this, 10, 6); setCaption(tr("About QPaMaT")); // the top of the dialog Q3HBox* titleBox = new Q3HBox(this); QLabel* titleIcon = new QLabel(titleBox); titleIcon->setPixmap(QPixmap(":/images/qpamat_48.png")); QLabel* titleText = new QLabel(tr("<p><b><big>QPaMaT %1</big></b></p>").arg(VERSION_STRING), titleBox); QWidget* filler = new QWidget(titleBox); titleText->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); filler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); titleBox->setSpacing(15); // the tab m_tabWidget = new QTabWidget(this); setupAboutTab(); setupLicenseTab(); // the ok Button QDialogButtonBox *dialogButtons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this); // main layout m_mainLayout->addWidget(titleBox); m_mainLayout->addWidget(m_tabWidget); m_mainLayout->setStretchFactor(m_tabWidget, 5); m_mainLayout->addWidget(dialogButtons); connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), SLOT(accept())); }
// ------------------------------------------------------------------------------------------------- TriggerWidget::TriggerWidget(QWidget* parent, const char* name) throw () : QWidget(parent, name) { Q3VBoxLayout* boxLayout = new Q3VBoxLayout(this, 0, 0); Q3HBox* hbox = new Q3HBox(this); hbox->setSpacing(2); // create the checkboxes with their labels for (int i = 0; i < NUMBER_OF_BITS_PER_BYTE; i++) { Q3VBox* box = new Q3VBox(hbox); box->setSpacing(2); m_labels[i] = new QLabel(QString::number(i+1), box); m_labels[i]->setAlignment(Qt::AlignHCenter); m_checkboxes[i] = new QCheckBox(box); m_checkboxes[i]->setTristate(true); m_checkboxes[i]->setNoChange(); connect(m_checkboxes[i], SIGNAL(stateChanged(int)), SLOT(valueChangedHandler())); } boxLayout->addWidget(hbox); boxLayout->addStretch(5); }
/** No descriptions */ void SliderSpin::initWidget() { Q3HBox* hb = new Q3HBox(this); mpTitleLabel = new QLabel(hb); mpSlider = new QSlider(0,10,1,1,Qt::Horizontal,hb); mpSpinBox = new QSpinBox(0,10,1,hb); hb->setSpacing(5); hb->setStretchFactor(mpSlider,1); mpSlider->setTracking(false); connect(mpSlider,SIGNAL(valueChanged(int)), this,SLOT(slotValueChanged(int))); connect(mpSlider,SIGNAL(sliderMoved(int)), this,SLOT(slotSliderMoved(int))); connect(mpSpinBox,SIGNAL(valueChanged(int)), this,SLOT(slotSpinValueChanged(int))); }
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent) { // set application icon ///setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm")); setCaption("Qucs Filter " PACKAGE_VERSION); all = new Q3VBoxLayout(this); // -------- create menubar ------------------- Q3PopupMenu *fileMenu = new Q3PopupMenu(); fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q); Q3PopupMenu *helpMenu = new Q3PopupMenu(); helpMenu->insertItem( tr("&About Qucs Filter..."), this, SLOT(slotHelpAbout()), 0); helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0); QMenuBar *bar = new QMenuBar(this); bar->insertItem(tr("&File"), fileMenu); bar->insertSeparator (); bar->insertItem(tr("&Help"), helpMenu); all->addWidget(bar); // reserve space for menubar all->addSpacing (bar->height() + 2); QTabWidget *t = new QTabWidget(this); all->addWidget(t); // ........................................................... QWidget *Tab1 = new QWidget(t); Q3GridLayout *gp1 = new Q3GridLayout(Tab1,12,6,5,5); FilterName = new QComboBox(FALSE, Tab1); gp1->addWidget(FilterName,0,0); TformName = new QComboBox(FALSE, Tab1); gp1->addWidget(TformName,0,1); OrderBox = new QCheckBox(tr("Specify order"), Tab1); gp1->addWidget(OrderBox,1,0); Q3HBox *h1 = new Q3HBox(Tab1); h1->setSpacing (5); OrderCombo = new QComboBox(FALSE, h1); OrderCombo->setEnabled(TRUE); SubOrderCombo = new QComboBox(FALSE, h1); SubOrderCombo->setEnabled(FALSE); SubOrderCombo->insertItem( tr( "b" ) ); SubOrderCombo->insertItem( tr( "c" ) ); gp1->addWidget(h1,1,1); CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1); gp1->addWidget(CutoffLabel,2,0); EnterCutoff = new QLineEdit(Tab1); gp1->addWidget(EnterCutoff,2,1); CutoffCombo = new QComboBox(Tab1); CutoffCombo->insertItem( tr( "Hz" ) ); CutoffCombo->insertItem( tr( "kHz" ) ); CutoffCombo->insertItem( tr( "MHz" ) ); CutoffCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(CutoffCombo,2,2); RippleLabel = new QLabel(tr("Ripple"),Tab1); gp1->addWidget(RippleLabel,3,0); EnterRipple = new QLineEdit(Tab1); gp1->addWidget(EnterRipple,3,1); RippleUnitLabel = new QLabel(tr("dB"),Tab1); gp1->addWidget(RippleUnitLabel,3,2); AngleLabel = new QLabel(tr("Angle"),Tab1); gp1->addWidget(AngleLabel,3,3); EnterAngle = new QLineEdit(Tab1); gp1->addWidget(EnterAngle,3,4); AngleUnitLabel = new QLabel(tr("°"),Tab1); gp1->addWidget(AngleUnitLabel,3,5); ZinLabel = new QLabel(tr("Zin"),Tab1); gp1->addWidget(ZinLabel,7,0); EnterZin = new QLineEdit(Tab1); gp1->addWidget(EnterZin,7,1); OhmLabel = new QLabel(tr("Ohm"),Tab1); gp1->addWidget(OhmLabel,7,2); ZoutLabel = new QLabel(tr("Zout"),Tab1); ZoutLabel->setEnabled(false); gp1->addWidget(ZoutLabel,7,3); EnterZout = new QLineEdit(Tab1); gp1->addWidget(EnterZout,7,4); OhmLabel_2 = new QLabel(tr("Ohm"),Tab1); gp1->addWidget(OhmLabel_2,7,5); StopbandLabel = new QLabel(tr("Stopband corner"),Tab1); gp1->addWidget(StopbandLabel,5,0); EnterStopband = new QLineEdit(Tab1); gp1->addWidget(EnterStopband,5,1); StopbandCombo = new QComboBox(FALSE, Tab1); StopbandCombo->insertItem( tr( "Hz" ) ); StopbandCombo->insertItem( tr( "kHz" ) ); StopbandCombo->insertItem( tr( "MHz" ) ); StopbandCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(StopbandCombo,5,2); BandwidthLabel = new QLabel(tr("Bandwidth"),Tab1); BandwidthLabel->setEnabled(FALSE); gp1->addWidget(BandwidthLabel,4,0); EnterBandwidth = new QLineEdit(Tab1); gp1->addWidget(EnterBandwidth,4,1); BandwidthCombo = new QComboBox(FALSE, Tab1); BandwidthCombo->setEnabled(FALSE); BandwidthCombo->insertItem( tr( "Hz" ) ); BandwidthCombo->insertItem( tr( "kHz" ) ); BandwidthCombo->insertItem( tr( "MHz" ) ); BandwidthCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(BandwidthCombo,4,2); AttenuationLabel = new QLabel(tr("Attenuation"),Tab1); gp1->addWidget(AttenuationLabel,6,0); EnterAttenuation = new QLineEdit(Tab1); gp1->addWidget(EnterAttenuation,6,1); dBLabel = new QLabel(tr("dB"),Tab1); gp1->addWidget(dBLabel,6,2); DualBox = new QCheckBox(tr("dual"),Tab1); gp1->addMultiCellWidget(DualBox,8,8,0,2); CauerPoleBox = new QCheckBox(tr("Stopband is first pole"),Tab1); CauerPoleBox->setEnabled(FALSE); gp1->addMultiCellWidget(CauerPoleBox,9,9,0,2); OptimizeCauerBox = new QCheckBox(tr("Optimize cauer"),Tab1); OptimizeCauerBox->setEnabled(FALSE); gp1->addMultiCellWidget(OptimizeCauerBox,10,10,0,2); EqualInductorBox = new QCheckBox(tr("Equal inductors"),Tab1); EqualInductorBox->setEnabled(FALSE); gp1->addMultiCellWidget(EqualInductorBox,8,8,3,5); UseCrossBox = new QCheckBox(tr("+ rather than T"),Tab1); UseCrossBox->setEnabled(FALSE); gp1->addMultiCellWidget(UseCrossBox,9,9,3,5); Cboxes = new Q3VButtonGroup(tr("Optimize C"),Tab1); Cmin = new QRadioButton(tr("Cmin"),Cboxes); Cmax = new QRadioButton(tr("Cmax"),Cboxes); NoC = new QRadioButton(tr("noC"),Cboxes); gp1->addMultiCellWidget(Cboxes,11,11,0,2); Lboxes = new Q3VButtonGroup(tr("Optimize L"),Tab1); Lmin = new QRadioButton(tr("Lmin"),Lboxes); Lmax = new QRadioButton(tr("Lmax"),Lboxes); NoL = new QRadioButton(tr("noL"),Lboxes); gp1->addMultiCellWidget(Lboxes,11,11,3,5); t->addTab(Tab1, tr("LC Filters")); // ........................................................... QWidget *Tab2 = new QWidget(t); t->addTab(Tab2, tr("Microstrip Filters")); // ........................................................... QWidget *Tab3 = new QWidget(t); t->addTab(Tab3, tr("Active Filters")); // reserve space for vertical resizing all->addStretch(); // ........................................................... // buttons on the bottom of the dialog (independent of the TabWidget) Q3HBox *Butts = new Q3HBox(this); Butts->setSpacing(3); Butts->setMargin(3); all->addWidget(Butts); cancelButton = new QPushButton(tr("Exit"),Butts); okButton = new QPushButton(tr("Calculate"),Butts); okButton->setEnabled(FALSE); // signals and slots connections connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); }
// The address book is not practical enough yet to be of much use // Leave all this code commented until it gets improved address_book::address_book (QWidget *parent) : QWidget(parent) { m_is_modified = false; Q3BoxLayout* top_layout = new Q3VBoxLayout (this); top_layout->setMargin (4); top_layout->setSpacing (4); Q3HBox* hb = new Q3HBox (this); hb->setSpacing (6); top_layout->addWidget (hb); Q3VBox* box_left = new Q3VBox (hb); Q3VBox* box_right = new Q3VBox (hb); // left pane: search criteria and results Q3GroupBox* search_box = new Q3GroupBox (3, Qt::Horizontal, tr("Search"), box_left); Q3VBox* labels_box = new Q3VBox(search_box); Q3VBox* fields_box = new Q3VBox(search_box); m_email_search_w = new QLineEdit (fields_box); (void)new QLabel (tr("Address"), labels_box); m_name_search_w = new QLineEdit (fields_box); (void)new QLabel (tr("Name"), labels_box); m_nick_search_w = new QLineEdit (fields_box); (void)new QLabel (tr("Alias"), labels_box); QPushButton* button_search = new QPushButton (tr("Search"), search_box); connect (button_search, SIGNAL(clicked()), this, SLOT(search())); Q3GroupBox* result_box = new Q3GroupBox (1, Qt::Vertical, tr("Results"), box_left); m_result_list_w = new Q3ListView (result_box); m_result_list_w->addColumn (tr("Email address")); m_result_list_w->addColumn (tr("# msgs"), 50); connect(m_result_list_w, SIGNAL(selectionChanged()), this, SLOT(address_selected())); // right pane: properties of the selected address Q3GroupBox* prop_box = new Q3GroupBox (tr("Properties"), box_right); Q3GridLayout *grid_layout = new Q3GridLayout (prop_box, 6, 2); grid_layout->setSpacing (4); // set a marging big enough for the QGroupBox title not being overwritten grid_layout->setMargin (15); int g_row = 0; // grid row m_email_w = new QLineEdit (prop_box); grid_layout->addWidget (new QLabel (tr("Address:"), prop_box),g_row,0); grid_layout->addWidget (m_email_w, g_row, 1); g_row++; m_name_w = new QLineEdit (prop_box); grid_layout->addWidget (new QLabel (tr("Name:"), prop_box), g_row, 0); grid_layout->addWidget (m_name_w, g_row, 1); g_row++; m_nick_w = new QLineEdit (prop_box); grid_layout->addWidget (new QLabel (tr("Alias:"), prop_box), g_row, 0); grid_layout->addWidget (m_nick_w, g_row, 1); g_row++; m_notes_w = new Q3MultiLineEdit (prop_box); grid_layout->addWidget (new QLabel (tr("Notes:"), prop_box), g_row, 0); grid_layout->addWidget (m_notes_w, g_row, 1); g_row++; m_invalid_w = new QCheckBox (prop_box); grid_layout->addWidget (new QLabel (tr("Invalid:"), prop_box), g_row, 0); grid_layout->addWidget (m_invalid_w, g_row, 1); g_row++; QPushButton* button_aliases = new QPushButton(tr("Other addresses..."), prop_box); grid_layout->addWidget (button_aliases, 5, 1); connect (button_aliases, SIGNAL(clicked()), this, SLOT(aliases())); // buttons at the bottom of the window Q3HBox* buttons_box = new Q3HBox (this); buttons_box->setSpacing (4); top_layout->addWidget (buttons_box); new Q3HBox (buttons_box); // takes the left space QPushButton* b1 = new QPushButton (tr("New"), buttons_box); connect (b1, SIGNAL(clicked()), this, SLOT(new_address())); QPushButton* b2 = new QPushButton (tr("Apply"), buttons_box); connect (b2, SIGNAL(clicked()), this, SLOT(apply())); QPushButton* b3 = new QPushButton (tr("OK"), buttons_box); connect (b3, SIGNAL(clicked()), this, SLOT(OK())); QPushButton* b4 = new QPushButton (tr("Cancel"), buttons_box); connect (b4, SIGNAL(clicked()), this, SLOT(cancel())); }
QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent, const char *name) : QDialog(parent, name, TRUE, Qt::WDestructiveClose) { App = parent; setCaption(tr("Edit Qucs Properties")); all = new Q3VBoxLayout(this); // to provide the neccessary size QTabWidget *t = new QTabWidget(this); all->addWidget(t); // ........................................................... QWidget *Tab1 = new QWidget(t); Q3GridLayout *gp = new Q3GridLayout(Tab1,5,2,5,5); QLabel *l1 = new QLabel(tr("Font (set after reload):"), Tab1); gp->addWidget(l1,0,0); FontButton = new QPushButton(Tab1); connect(FontButton, SIGNAL(clicked()), SLOT(slotFontDialog())); gp->addWidget(FontButton,0,1); QLabel *l2 = new QLabel(tr("Document Background Color:"), Tab1); gp->addWidget(l2,1,0); BGColorButton = new QPushButton(" ", Tab1); connect(BGColorButton, SIGNAL(clicked()), SLOT(slotBGColorDialog())); gp->addWidget(BGColorButton,1,1); val200 = new QIntValidator(0, 200, this); QLabel *l3 = new QLabel(tr("maximum undo operations:"), Tab1); gp->addWidget(l3,2,0); undoNumEdit = new QLineEdit(Tab1); undoNumEdit->setValidator(val200); gp->addWidget(undoNumEdit,2,1); QLabel *l4 = new QLabel(tr("text editor:"), Tab1); gp->addWidget(l4,3,0); editorEdit = new QLineEdit(Tab1); gp->addWidget(editorEdit,3,1); t->addTab(Tab1, tr("Settings")); // ........................................................... /* QWidget *Tab2 = new QWidget(t); QGridLayout *gp2 = new QGridLayout(Tab2,3,2,5,5); Check_GridOn = new QCheckBox(tr("show Grid"),Tab2); QLabel *l3 = new QLabel(tr("horizontal Grid:"), Tab2); gp2->addWidget(l3,1,0); Input_GridX = new QLineEdit(Tab2); gp2->addWidget(Input_GridX,1,1); QLabel *l4 = new QLabel(tr("vertical Grid:"), Tab2); gp2->addWidget(l4,2,0); Input_GridY = new QLineEdit(Tab2); gp2->addWidget(Input_GridY,2,1); t->addTab(Tab2, tr("Grid")); */ // ........................................................... // buttons on the bottom of the dialog (independent of the TabWidget) Q3HBox *Butts = new Q3HBox(this); Butts->setSpacing(5); Butts->setMargin(5); all->addWidget(Butts); QPushButton *OkButt = new QPushButton(tr("OK"), Butts); connect(OkButt, SIGNAL(clicked()), SLOT(slotOK())); QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts); connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply())); QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts); connect(CancelButt, SIGNAL(clicked()), SLOT(reject())); QPushButton *DefaultButt = new QPushButton(tr("Default Values"), Butts); connect(DefaultButt, SIGNAL(clicked()), SLOT(slotDefaultValues())); OkButt->setDefault(true); // ........................................................... // fill the fields with the Qucs-Properties Font = QucsSettings.font; FontButton->setText(Font.toString()); BGColorButton->setPaletteBackgroundColor( App->view->viewport()->paletteBackgroundColor()); undoNumEdit->setText(QString::number(QucsSettings.maxUndo)); editorEdit->setText(QucsSettings.Editor); }
OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_) : QDialog(d_, 0, TRUE, Qt::WDestructiveClose) { Comp = c_; Doc = d_; changed = false; setCaption(tr("Edit Optimization Properties")); Expr.setPattern("[\\w_]+"); Validator = new QRegExpValidator(Expr, this); numVal = new QDoubleValidator(this); intVal = new QIntValidator(this); all = new Q3VBoxLayout(this); // to provide the neccessary size QTabWidget *t = new QTabWidget(this); all->addWidget(t); // ........................................................... QWidget *Tab1 = new QWidget(t); Q3GridLayout *gp1 = new Q3GridLayout(Tab1,3,2,3,3); gp1->addWidget(new QLabel(tr("Name:"), Tab1), 0,0); NameEdit = new QLineEdit(Tab1); NameEdit->setValidator(Validator); gp1->addWidget(NameEdit,0,1); gp1->addWidget(new QLabel(tr("Simulation:"), Tab1), 1,0); SimEdit = new QComboBox(Tab1); SimEdit->setEditable(true); gp1->addWidget(SimEdit,1,1); t->addTab(Tab1, tr("General")); // ........................................................... QWidget *Tab4 = new QWidget(t); Q3GridLayout *gp4 = new Q3GridLayout(Tab4,11,2,3,3); gp4->addWidget(new QLabel(tr("Method:"), Tab4), 0,0); MethodCombo = new QComboBox(Tab4); MethodCombo->insertItem("DE/best/1/exp"); MethodCombo->insertItem("DE/rand/1/exp"); MethodCombo->insertItem("DE/rand-to-best/1/exp"); MethodCombo->insertItem("DE/best/2/exp"); MethodCombo->insertItem("DE/rand/1/exp"); MethodCombo->insertItem("DE/best/1/bin"); MethodCombo->insertItem("DE/rand/1/bin"); MethodCombo->insertItem("DE/rand-to-best/1/bin"); MethodCombo->insertItem("DE/best/2/bin"); MethodCombo->insertItem("DE/rand/2/bin"); gp4->addWidget(MethodCombo,0,1); gp4->addWidget(new QLabel(tr("Maximum number of iterations:"), Tab4), 1,0); IterEdit = new QLineEdit(Tab4); IterEdit->setValidator(intVal); gp4->addWidget(IterEdit,1,1); gp4->addWidget(new QLabel(tr("Output refresh cycle:"), Tab4), 2,0); RefreshEdit = new QLineEdit(Tab4); RefreshEdit->setValidator(intVal); gp4->addWidget(RefreshEdit,2,1); gp4->addWidget(new QLabel(tr("Number of parents:"), Tab4), 3,0); ParentsEdit = new QLineEdit(Tab4); ParentsEdit->setValidator(intVal); gp4->addWidget(ParentsEdit,3,1); gp4->addWidget(new QLabel(tr("Constant F:"), Tab4), 4,0); ConstEdit = new QLineEdit(Tab4); ConstEdit->setValidator(new QDoubleValidator(0.0,2.0,20,ConstEdit)); gp4->addWidget(ConstEdit,4,1); gp4->addWidget(new QLabel(tr("Crossing over factor:"), Tab4), 5,0); CrossEdit = new QLineEdit(Tab4); CrossEdit->setValidator(new QDoubleValidator(0.0,1.0,20,CrossEdit)); gp4->addWidget(CrossEdit,5,1); gp4->addWidget(new QLabel(tr("Pseudo random number seed:"), Tab4), 6,0); SeedEdit = new QLineEdit(Tab4); SeedEdit->setValidator(numVal); gp4->addWidget(SeedEdit,6,1); gp4->addWidget(new QLabel(tr("Minimum cost variance:"), Tab4), 7,0); CostVarEdit = new QLineEdit(Tab4); CostVarEdit->setValidator(numVal); gp4->addWidget(CostVarEdit,7,1); gp4->addWidget(new QLabel(tr("Cost objectives:"), Tab4), 8,0); CostObjEdit = new QLineEdit(Tab4); CostObjEdit->setValidator(numVal); gp4->addWidget(CostObjEdit,8,1); gp4->addWidget(new QLabel(tr("Cost constraints:"), Tab4), 9,0); CostConEdit = new QLineEdit(Tab4); CostConEdit->setValidator(numVal); gp4->addWidget(CostConEdit,9,1); t->addTab(Tab4, tr("Algorithm")); // ........................................................... QWidget *Tab2 = new QWidget(t); Q3GridLayout *gp2 = new Q3GridLayout(Tab2,5,3,3,3); VarList = new Q3ListView(Tab2); VarList->addColumn(tr("Name")); VarList->addColumn(tr("active")); VarList->addColumn(tr("initial")); VarList->addColumn(tr("min")); VarList->addColumn(tr("max")); VarList->addColumn(tr("Type")); VarList->setSorting(-1); // no sorting gp2->addMultiCellWidget(VarList,0,0,0,2); connect(VarList, SIGNAL(selectionChanged(Q3ListViewItem*)), SLOT(slotEditVariable(Q3ListViewItem*))); Q3HBox *VarLine = new Q3HBox(Tab2); VarLine->setSpacing(3); gp2->addMultiCellWidget(VarLine, 1,1,0,2); new QLabel(tr("Name:"), VarLine); VarNameEdit = new QLineEdit(VarLine); VarNameEdit->setValidator(Validator); connect(VarNameEdit, SIGNAL(textChanged(const QString&)), SLOT(slotChangeVarName(const QString&))); VarActiveCheck = new QCheckBox(tr("active"), VarLine); VarActiveCheck->setChecked(true); connect(VarActiveCheck, SIGNAL(toggled(bool)), SLOT(slotChangeVarActive(bool))); gp2->addWidget(new QLabel(tr("initial:"), Tab2), 2,0); gp2->addWidget(new QLabel(tr("min:"), Tab2), 2,1); gp2->addWidget(new QLabel(tr("max:"), Tab2), 2,2); VarInitEdit = new QLineEdit(Tab2); VarInitEdit->setValidator(numVal); gp2->addWidget(VarInitEdit,3,0); connect(VarInitEdit, SIGNAL(textChanged(const QString&)), SLOT(slotChangeVarInit(const QString&))); VarMinEdit = new QLineEdit(Tab2); VarMinEdit->setValidator(numVal); gp2->addWidget(VarMinEdit,3,1); connect(VarMinEdit, SIGNAL(textChanged(const QString&)), SLOT(slotChangeVarMin(const QString&))); VarMaxEdit = new QLineEdit(Tab2); VarMaxEdit->setValidator(numVal); gp2->addWidget(VarMaxEdit,3,2); connect(VarMaxEdit, SIGNAL(textChanged(const QString&)), SLOT(slotChangeVarMax(const QString&))); Q3HBox *VarButtons = new Q3HBox(Tab2); VarButtons->setSpacing(3); gp2->addMultiCellWidget(VarButtons, 4,4,0,2); new QLabel(tr("Type:"), VarButtons); VarTypeCombo = new QComboBox(VarButtons); VarTypeCombo->insertItem(tr("linear double")); VarTypeCombo->insertItem(tr("logarithmic double")); VarTypeCombo->insertItem(tr("linear integer")); VarTypeCombo->insertItem(tr("logarithmic integer")); connect(VarTypeCombo, SIGNAL(activated(const QString&)), SLOT(slotChangeVarType(const QString&))); VarButtons->setStretchFactor(new QWidget(VarButtons), 10); QPushButton *AddVar_Butt = new QPushButton(tr("Add"), VarButtons); connect(AddVar_Butt, SIGNAL(clicked()), SLOT(slotAddVariable())); QPushButton *DelVar_Butt = new QPushButton(tr("Delete"), VarButtons); connect(DelVar_Butt, SIGNAL(clicked()), SLOT(slotDeleteVariable())); t->addTab(Tab2, tr("Variables")); // ........................................................... QWidget *Tab3 = new QWidget(t); Q3GridLayout *gp3 = new Q3GridLayout(Tab3,4,3,3,3); GoalList = new Q3ListView(Tab3); GoalList->addColumn(tr("Name")); GoalList->addColumn(tr("Type")); GoalList->addColumn(tr("Value")); GoalList->setSorting(-1); // no sorting gp3->addMultiCellWidget(GoalList,0,0,0,2); connect(GoalList, SIGNAL(selectionChanged(Q3ListViewItem*)), SLOT(slotEditGoal(Q3ListViewItem*))); gp3->addWidget(new QLabel(tr("Name:"), Tab3), 1,0); GoalNameEdit = new QLineEdit(Tab3); GoalNameEdit->setValidator(Validator); gp3->addWidget(GoalNameEdit,1,1); connect(GoalNameEdit, SIGNAL(textChanged(const QString&)), SLOT(slotChangeGoalName(const QString&))); gp3->addWidget(new QLabel(tr("Value:"), Tab3), 2,0); GoalNumEdit = new QLineEdit(Tab3); GoalNumEdit->setValidator(numVal); gp3->addWidget(GoalNumEdit,2,1); connect(GoalNumEdit, SIGNAL(textChanged(const QString&)), SLOT(slotChangeGoalNum(const QString&))); GoalTypeCombo = new QComboBox(Tab3); GoalTypeCombo->insertItem(tr("minimize")); GoalTypeCombo->insertItem(tr("maximize")); GoalTypeCombo->insertItem(tr("less")); GoalTypeCombo->insertItem(tr("greater")); GoalTypeCombo->insertItem(tr("equal")); GoalTypeCombo->insertItem(tr("monitor")); gp3->addWidget(GoalTypeCombo,2,2); connect(GoalTypeCombo, SIGNAL(activated(const QString&)), SLOT(slotChangeGoalType(const QString&))); Q3HBox *GoalButtons = new Q3HBox(Tab3); GoalButtons->setSpacing(3); gp3->addMultiCellWidget(GoalButtons, 3,3,0,2); GoalButtons->setStretchFactor(new QWidget(GoalButtons),5); QPushButton *AddGoal_Butt = new QPushButton(tr("Add"), GoalButtons); connect(AddGoal_Butt, SIGNAL(clicked()), SLOT(slotAddGoal())); QPushButton *DelGoal_Butt = new QPushButton(tr("Delete"), GoalButtons); connect(DelGoal_Butt, SIGNAL(clicked()), SLOT(slotDeleteGoal())); t->addTab(Tab3, tr("Goals")); // ........................................................... // buttons on the bottom of the dialog (independent of the TabWidget) Q3HBox *Butts = new Q3HBox(this); Butts->setSpacing(3); Butts->setMargin(3); all->addWidget(Butts); QPushButton *OkButt = new QPushButton(tr("OK"), Butts); connect(OkButt, SIGNAL(clicked()), SLOT(slotOK())); QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts); connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply())); QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts); connect(CancelButt, SIGNAL(clicked()), SLOT(slotCancel())); OkButt->setFocus(); // ........................................................... Component *pc; for(pc=Doc->Components->first(); pc!=0; pc=Doc->Components->next()) if(pc != Comp) if(pc->Model[0] == '.' && pc->Model != ".Opt") SimEdit->insertItem(pc->Name); Property *pp; pp = Comp->Props.at(0); if(!pp->Value.isEmpty()) SimEdit->setCurrentText(pp->Value); pp = Comp->Props.at(1); if(!pp->Value.isEmpty()) { MethodCombo->setCurrentItem(pp->Value.section('|',0,0).toInt()-1); IterEdit->setText(pp->Value.section('|',1,1)); RefreshEdit->setText(pp->Value.section('|',2,2)); ParentsEdit->setText(pp->Value.section('|',3,3)); ConstEdit->setText(pp->Value.section('|',4,4)); CrossEdit->setText(pp->Value.section('|',5,5)); SeedEdit->setText(pp->Value.section('|',6,6)); CostVarEdit->setText(pp->Value.section('|',7,7)); CostObjEdit->setText(pp->Value.section('|',8,8)); CostConEdit->setText(pp->Value.section('|',9,9)); } NameEdit->setText(Comp->Name); for(pp = Comp->Props.at(2); pp != 0; pp = Comp->Props.next()) { if(pp->Name == "Var") { new Q3ListViewItem(VarList, pp->Value.section('|',0,0), pp->Value.section('|',1,1) == "yes" ? tr("yes") : tr("no"), pp->Value.section('|',2,2), pp->Value.section('|',3,3), pp->Value.section('|',4,4), ((pp->Value.section('|',5,5)=="LIN_DOUBLE")?tr("linear double") : ((pp->Value.section('|',5,5)=="LOG_DOUBLE")?tr("logarithmic double") : ((pp->Value.section('|',5,5)=="LIN_INT")?tr("linear integer") : tr("logarithmic integer"))))); } if(pp->Name == "Goal") { new Q3ListViewItem(GoalList, pp->Value.section('|',0,0), ((pp->Value.section('|',1,1) == "MIN") ? tr("minimize") : ((pp->Value.section('|',1,1) == "MAX") ? tr("maximize") : ((pp->Value.section('|',1,1) == "LE") ? tr("less") : ((pp->Value.section('|',1,1) == "GE") ? tr("greater") : ((pp->Value.section('|',1,1) == "EQ") ? tr("equal") : tr("monitor")))))), pp->Value.section('|',2,2)); } } resize(300, 250); }