unsigned C_INT32 CProgressBar::addItem(const std::string & name, const CCopasiParameter::Type & type, const void * pValue, const void * pEndValue) { unsigned C_INT32 hItem = CProcessReport::addItem(name, type, pValue, pEndValue); if (mpMainThread != NULL && QThread::currentThread() != mpMainThread) { QMutexLocker Locker(&mMutex); mSlotFinished = false; emit signalAddItem(hItem); if (!mSlotFinished) { mWaitSlot.wait(&mMutex); } } else { slotAddItem(hItem); } return hItem; }
ScanWidget::ScanWidget(QWidget* parent, const char* name, Qt::WindowFlags f) : TaskWidget(parent, name, f) { if (!name) setObjectName("ScanWidget"); setWindowTitle(trUtf8("ScanWidget")); ScanWidgetLayout = new QGridLayout(this); ScanWidgetLayout->setMargin(11); ScanWidgetLayout->setSpacing(6); ScanWidgetLayout->setObjectName("ScanWidgetLayout"); mpHeaderWidget->setTaskName("Parameter Scan"); ScanWidgetLayout->addWidget(mpHeaderWidget, 0, 0); mpBtnWidget->verticalLayout->removeItem(mpBtnWidget->verticalSpacer); ScanWidgetLayout->addWidget(mpBtnWidget, 3, 0); //***************** QHBoxLayout* tmpLayout = new QHBoxLayout(); QSpacerItem* tmpSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); tmpLayout->addItem(tmpSpacer); QLabel* tmpLabel = new QLabel(this); tmpLabel->setText("New scan item: "); tmpLayout->addWidget(tmpLabel); comboType = new QComboBox(this); //+++ comboType->addItem("Scan"); comboType->addItem("Repeat"); comboType->addItem("Random distribution"); tmpLayout->addWidget(comboType); QSpacerItem *mpSpacer = new QSpacerItem(20, 20, QSizePolicy::Maximum, QSizePolicy::Minimum); tmpLayout->addItem(mpSpacer); buttonNewItem = new QPushButton(this); buttonNewItem->setObjectName("buttonNewItem"); buttonNewItem->setText("Create"); //ScanWidgetLayout->addWidget(buttonNewItem, 1, 2); tmpLayout->addWidget(buttonNewItem); ScanWidgetLayout->addLayout(tmpLayout, 1, 0); //***************************** scrollview = new CScanContainerWidget(this); ScanWidgetLayout->addWidget(scrollview, 2, 0); // tab order /*setTabOrder(taskName, sExecutable); setTabOrder(sExecutable, steadyState);*/ connect(buttonNewItem, SIGNAL(clicked()), this, SLOT(slotAddItem())); }
IntegrationPreferences::IntegrationPreferences(KConfigDialog *parent, Qt::WindowFlags f) : QWidget(parent, f) { ui.setupUi(this); //AutoPaste stuff ui.type->addItem(KIcon("list-add"), i18n("Include"), AutoPasteModel::Include); ui.type->addItem(KIcon("list-remove"), i18n("Exclude"), AutoPasteModel::Exclude); ui.patternSyntax->addItem(i18n("Escape sequences"), AutoPasteModel::Wildcard); ui.patternSyntax->addItem(i18n("Regular expression"), AutoPasteModel::RegExp); ui.add->setGuiItem(KStandardGuiItem::add()); ui.remove->setGuiItem(KStandardGuiItem::remove()); ui.increase->setIcon(KIcon("arrow-up")); ui.decrease->setIcon(KIcon("arrow-down")); m_model = new AutoPasteModel(this); m_model->load(); ui.list->setModel(m_model); AutoPasteDelegate *delegate = new AutoPasteDelegate(ui.type->model(), ui.patternSyntax->model(), this); ui.list->setItemDelegate(delegate); QByteArray loadedState = QByteArray::fromBase64(Settings::autoPasteHeaderState().toAscii()); if (Settings::autoPasteHeaderState().isEmpty()) { ui.list->resizeColumnToContents(AutoPasteModel::Type); } else if (!loadedState.isNull()) { ui.list->header()->restoreState(loadedState); } connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); connect(ui.list->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(slotUpdateButtons())); connect(ui.pattern, SIGNAL(textChanged(QString)), this, SLOT(slotUpdateButtons())); connect(ui.pattern, SIGNAL(returnPressed(QString)), this, SLOT(slotAddItem())); connect(ui.add, SIGNAL(clicked()), this, SLOT(slotAddItem())); connect(ui.remove, SIGNAL(clicked()), this, SLOT(slotRemoveItem())); connect(ui.increase, SIGNAL(clicked()), this, SLOT(slotIncreasePriority())); connect(ui.decrease, SIGNAL(clicked()), this, SLOT(slotDecreasePriority())); connect(parent, SIGNAL(rejected()), m_model, SLOT(load())); connect(parent, SIGNAL(applyClicked()), m_model, SLOT(save())); connect(parent, SIGNAL(okClicked()), m_model, SLOT(save())); connect(parent, SIGNAL(defaultClicked()), m_model, SLOT(resetDefaults())); slotUpdateButtons(); }
void ArchiveMailWidget::customContextMenuRequested(const QPoint&) { const QList<QTreeWidgetItem *> listItems = mWidget->treeWidget->selectedItems(); KMenu menu; menu.addAction(i18n("Add..."),this,SLOT(slotAddItem())); if( !listItems.isEmpty() ) { if( listItems.count() == 1) { menu.addAction(i18n("Open Containing Folder..."),this,SLOT(slotOpenFolder())); } menu.addSeparator(); menu.addAction(i18n("Delete"),this,SLOT(slotRemoveItem())); } menu.exec(QCursor::pos()); }
EditorManagerView::EditorManagerView(const EditorManagerHelper *helper, BasicEntityTableModel *model, QWidget *parent) : Manhattan::MiniSplitter(parent), _helper(helper), _model(model), _dirty(false), _newRow(false) { _navigatorWidget = new ListNavigatorWidget(_helper->mainTitle()); _editorWidget = _helper->createEditor(); /* _buttonBox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel); _cancelButton = _buttonBox->button(QDialogButtonBox::Cancel); _cancelButton->setEnabled(false); _saveButton = _buttonBox->button(QDialogButtonBox::Save); _saveButton->setEnabled(false); _saveButton->setText(_helper->saveChangesButtonText()); _deleteButton = new QPushButton(_helper->deleteButtonText()); _buttonBox->addButton(_deleteButton, QDialogButtonBox::ResetRole); */ _deleteButton = new QPushButton(tr("Delete")); _deleteButton->setEnabled(false); _saveButton = new QPushButton(_helper->saveChangesButtonText()); //_saveButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogSaveButton))); _saveButton->setEnabled(false); _cancelButton = new QPushButton(tr("Cancel")); //_cancelButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogCancelButton))); _cancelButton->setEnabled(false); QHBoxLayout * actionsLayout = new QHBoxLayout; //actionsLayout->setMargin(6); actionsLayout->setSpacing(8); actionsLayout->addWidget(_deleteButton); actionsLayout->addStretch(); actionsLayout->addWidget(_saveButton); actionsLayout->addWidget(_cancelButton); QVBoxLayout * editorLayout = new QVBoxLayout; editorLayout->setMargin(9); editorLayout->addWidget(_editorWidget); editorLayout->addLayout(actionsLayout); QWidget * editorWapper = new QWidget; editorWapper->setLayout(editorLayout); _stackedLayout = new QStackedLayout; _stackedLayout->addWidget(helper->createNoDataWidget()); _stackedLayout->addWidget(editorWapper); QVBoxLayout * rightSideLayout = new QVBoxLayout; rightSideLayout->setMargin(0); rightSideLayout->setSpacing(0); rightSideLayout->addWidget(new Manhattan::StyledBar); rightSideLayout->addLayout(_stackedLayout); QWidget * rightSplitWidget = new QWidget; rightSplitWidget->setLayout(rightSideLayout); insertWidget(0, _navigatorWidget); insertWidget(1, rightSplitWidget); setStretchFactor(0, 0); setStretchFactor(1, 1); _model->select(); _filterProxyModel = new QSortFilterProxyModel(this); _filterProxyModel->setSourceModel(_model); _filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); _filterProxyModel->setFilterKeyColumn(model->getNameColumn()); _navigatorWidget->setModel(_filterProxyModel); _navigatorWidget->setModelColumn(model->getNameColumn()); _editorWidget->setModel(_model); _editorWidget->setCurrentIndex(-1); connect(_navigatorWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString))); connect(_navigatorWidget, SIGNAL(itemSelected(QModelIndex)), this, SLOT(slotItemSelected(QModelIndex)), Qt::QueuedConnection); connect(_navigatorWidget, SIGNAL(addNewItem()), this, SLOT(slotAddItem())); connect(_navigatorWidget, SIGNAL(deleteItem(QModelIndex)), this, SLOT(slotDeleteItem(QModelIndex))); connect(_editorWidget, SIGNAL(contentChanged()), this, SLOT(slotContentChanged())); //connect(_model, SIGNAL(primeInsert(int,QSqlRecord&)), this, SLOT(slotPrimeInsert(int,QSqlRecord&))); //connect(_buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept())); //connect(_buttonBox, SIGNAL(rejected()), this, SLOT(slotReject())); connect(_saveButton, SIGNAL(clicked(bool)), this, SLOT(slotAccept())); connect(_cancelButton, SIGNAL(clicked(bool)), this, SLOT(slotReject())); connect(_deleteButton, SIGNAL(clicked()), this, SLOT(slotDelete())); }
foreach( CatalogTemplate *templ, templates ) { slotAddItem( kat, templ ); }
// Add a new item. A katalog is required if user wants to store it in a // catalog immediately. FIXME - now the current active catalog in the // catalog selection is used. void KraftView::slotAddNewItem() { Katalog* kat = mAssistant->catalogSelection()->currentSelectedKat(); slotAddItem( kat, 0 ); }