void ComponentDialog::init_l_tab(VVBox *& page, QComboBox *& stereotypefilter, void (ComponentDialog::* filteractivated)(const QString & st), const char * slt, const char * add_slt, const char * remove_slt, QListWidget *& lb_available, QListWidget *& lb, const QList<BrowserClass *> & cls, QString lbl) { bool visit = !hasOkButton(); HHBox * hbox; VVBox * vbox; QPushButton * button; QLabel* label; page = new VVBox(this); if (!visit) { page->addWidget(hbox = new HHBox(page)); hbox->setMargin(5); hbox->addWidget(new QLabel(tr("Stereotype filtering "), hbox)); hbox->addWidget(stereotypefilter = new QComboBox(hbox)); stereotypefilter->setEditable(true); stereotypefilter->setAutoCompletion(completion()); stereotypefilter->addItem(""); stereotypefilter->addItems(BrowserClass::default_stereotypes()); stereotypefilter->addItems(ProfiledStereotypes::defaults(UmlComponent)); stereotypefilter->setCurrentIndex(0); QSizePolicy sp = stereotypefilter->sizePolicy(); sp.setHorizontalPolicy(QSizePolicy::Expanding); stereotypefilter->setSizePolicy(sp); connect(stereotypefilter, SIGNAL(activated(const QString &)), this, slt); page->addWidget(hbox = new HHBox(page)); hbox->addWidget(vbox = new VVBox(hbox)); vbox->setMargin(5); (label = new QLabel(tr("Available classes"), vbox))->setAlignment(Qt::AlignCenter); vbox->addWidget(label); vbox->addWidget(lb_available = new QListWidget(vbox)); lb_available->setSelectionMode(QListWidget::MultiSelection); hbox->addWidget(vbox = new VVBox(hbox)); vbox->setMargin(5); (label = new QLabel("", vbox))->setScaledContents(TRUE); vbox->addWidget(label); vbox->addWidget(button = new QPushButton(vbox)); button->setIcon(*rightPixmap); connect(button, SIGNAL(clicked()), this, add_slt); (label = new QLabel("", vbox))->setScaledContents(TRUE); vbox->addWidget(label); vbox->addWidget(button = new QPushButton(vbox)); button->setIcon(*leftPixmap); connect(button, SIGNAL(clicked()), this, remove_slt); (label = new QLabel("", vbox))->setScaledContents(TRUE); vbox->addWidget(label); hbox->addWidget(vbox = new VVBox(hbox)); }
Dialog::Dialog() : QDialog(0) { setModal(true); QVBoxLayout * vbox = new QVBoxLayout(this); VGridBox * gbox; BButtonGroup * bg; HHBox * htab; vbox->setMargin(5); gbox = new VGridBox(10,this,"Filters"); vbox->addWidget(gbox); gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(new QLabel("filter 1 : ", htab)); htab->addWidget(filter1_le = new LineEdit(htab)); htab->addWidget(new QLabel(" ", htab)); htab->addWidget(bg = new BButtonGroup(htab)); //bg->setRadioButtonExclusive(TRUE); bg->addWidget(with1_rb = new QRadioButton("with", bg)); bg->addWidget(new QRadioButton("without", bg)); with1_rb->setChecked(TRUE); // gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(new QLabel("", htab)); htab->addWidget(bg = new BButtonGroup(htab)); //bg->setRadioButtonExclusive(TRUE); bg->addWidget(and12_rb = new QRadioButton("and", bg)); bg->addWidget(new QRadioButton("or", bg)); and12_rb->setChecked(TRUE); htab->addWidget(new QLabel("", htab)); // gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(new QLabel("filter 2 : ", htab)); htab->addWidget(filter2_le = new LineEdit(htab)); htab->addWidget(new QLabel(" ", htab)); htab->addWidget(bg = new BButtonGroup(htab)); //bg->setRadioButtonExclusive(TRUE); bg->addWidget(with2_rb = new QRadioButton("with", bg)); bg->addWidget(new QRadioButton("without", bg)); with2_rb->setChecked(TRUE); // gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(new QLabel("", htab)); htab->addWidget(bg = new BButtonGroup(htab)); //bg->setRadioButtonExclusive(TRUE); bg->addWidget(and23_rb = new QRadioButton("and", bg)); bg->addWidget(new QRadioButton("or", bg)); and23_rb->setChecked(TRUE); htab->addWidget(new QLabel("", htab)); // gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(new QLabel("filter 3 : ", htab)); htab->addWidget(filter3_le = new LineEdit(htab)); htab->addWidget(new QLabel(" ", htab)); htab->addWidget(bg = new BButtonGroup(htab)); //bg->setRadioButtonExclusive(TRUE); bg->addWidget(with3_rb = new QRadioButton("with", bg)); bg->addWidget(new QRadioButton("without", bg)); with3_rb->setChecked(TRUE); // // gbox = new VGridBox(2,this,"Stereotype" ); vbox->addWidget(gbox); gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(bg = new BButtonGroup(htab)); //bg->setRadioButtonExclusive(TRUE); bg->addWidget(any_rb = new QRadioButton("any", bg)); bg->addWidget(is_rb = new QRadioButton("is", bg)); bg->addWidget(isnot_rb = new QRadioButton("is not", bg)); any_rb->setChecked(TRUE); htab->addWidget(stereotype_le = new QLineEdit(htab)); // // gbox = new VGridBox(2,this,"Targets" ); vbox->addWidget(gbox); gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(artifact_cb = new QCheckBox("artifact", htab)); htab->addWidget(class_cb = new QCheckBox("class", htab)); htab->addWidget(operation_cb = new QCheckBox("operation", htab)); htab->addWidget(attribute_cb = new QCheckBox("attribute", htab)); htab->addWidget(relation_cb = new QCheckBox("relation", htab)); // // gbox = new VGridBox(2,this,"Languages"); vbox->addWidget(gbox); gbox->addWidget(htab = new HHBox(gbox)); //htab->setMargin(5); htab->addWidget(cpp_cb = new QCheckBox("C++", htab)); htab->addWidget(java_cb = new QCheckBox("Java", htab)); htab->addWidget(php_cb = new QCheckBox("Php", htab)); htab->addWidget(python_cb = new QCheckBox("Python", htab)); htab->addWidget(idl_cb = new QCheckBox("Idl", htab)); // // GridBox * grid = new GridBox(2, this); vbox->addWidget(grid); grid->setMargin(5); grid->setSpacing(5); grid->addWidget(new QLabel("current : ", grid)); grid->addWidget(current_le = new LineEdit(grid)); grid->addWidget(new QLabel("new : ", grid)); grid->addWidget(new_le = new LineEdit(grid)); // // htab = new HHBox(this); htab->setMargin(5); vbox->addWidget(htab); htab->addWidget(new QLabel(htab)); QPushButton * replace; htab->addWidget(replace = new QPushButton("Replace", htab)); htab->addWidget(new QLabel(htab)); QPushButton * quit; htab->addWidget(quit = new QPushButton("Quit", htab)); htab->addWidget(new QLabel(htab)); QSize bs(replace->sizeHint()); quit->setFixedSize(bs); connect(replace, SIGNAL(clicked()), this, SLOT(do_replace())); connect(quit, SIGNAL(clicked()), this, SLOT(reject())); }