void connectActions() { QObject::connect(aSave, SIGNAL(triggered()), q, SLOT(save())); QObject::connect(aRemoveCurrent, SIGNAL(triggered()), q, SLOT(removeCurrent())); QObject::connect(aEdit, SIGNAL(triggered()), q, SLOT(editCurrent())); QObject::connect(aRevert, SIGNAL(triggered()), q, SLOT(revertEdition())); // QObject::connect(aTranslateThis, SIGNAL(triggered()), q, SLOT(translateCurrent())); QObject::connect(aNextUnreviewedOrUnlinked, SIGNAL(triggered()), q, SLOT(nextUnreviewedOrUnlinked())); // QObject::connect(aDownloadAllNeededPmids, SIGNAL(triggered()), ddiCore(), SLOT(downloadAllPmids())); QObject::connect(_searchToolButton, SIGNAL(triggered(QAction*)), q, SLOT(searchButtonActivated(QAction*))); QObject::connect(aCreateNewClass, SIGNAL(triggered()), q, SLOT(onNewInteractorRequested())); QObject::connect(aCreateNewInteractor, SIGNAL(triggered()), q, SLOT(onNewInteractorRequested())); }
NepomukWebMiner::RegExpBox::RegExpBox(QWidget *parent) : QWidget(parent) , ui(new Ui::RegExpBox) { ui->setupUi(this); m_model = new NepomukWebMiner::RegExpModel(); ui->tableView->setModel(m_model); connect(ui->moveUpButton, SIGNAL(clicked()), this, SLOT(moveCurrentUp())); connect(ui->moveDownButton, SIGNAL(clicked()), this, SLOT(moveCurrentDown())); connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeCurrent())); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addRegExp())); connect(ui->editButton, SIGNAL(clicked()), this, SLOT(editCurrent())); ui->moveUpButton->setIcon(KIcon("arrow-up")); ui->moveDownButton->setIcon(KIcon("arrow-down")); ui->removeButton->setIcon(KIcon("list-remove")); ui->addButton->setIcon(KIcon("list-add")); ui->editButton->setIcon(KIcon("document-edit")); }
void PeopleApplication::createDetailPage(const QModelIndex &index) { if (m_detailPage) return; if (!index.isValid()) return; searchCancel(); m_currentIndex = index; m_currentPerson = new SeasidePerson(index); m_currentPerson->setViewType("personDetail"); connect(m_currentPerson, SIGNAL(callNumber(const QString&)), this, SLOT(callNumber(const QString&))); connect(m_currentPerson, SIGNAL(composeIM(const QString&)), this, SLOT(composeIM(const QString&))); connect(m_currentPerson, SIGNAL(composeSMS(const QString&)), this, SLOT(composeSMS(const QString&))); connect(m_currentPerson, SIGNAL(composeEmail(const QString&)), this, SLOT(composeEmail(const QString&))); connect(m_currentPerson, SIGNAL(viewRequest(qreal,qreal)), this, SLOT(scrollIntoView(qreal,qreal))); m_detailPage = new MApplicationPage; m_detailPage->setTitle(QObject::tr("Contact Detail","Title for detail view")); m_detailPage->setCentralWidget(m_currentPerson); MAction *action = new MAction(QObject::tr("<b>Edit</b>","Edit toolbar button to edit contact details"), this); action->setLocation(MAction::ApplicationMenuLocation); m_detailPage->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(editCurrent())); connect(m_detailPage, SIGNAL(backButtonClicked()), this, SLOT(detailBack())); m_detailPage->appear(MApplicationPage::DestroyWhenDismissed); }
m_model = new %ModelClassName%(this); m_proxyModel = new QSortFilterProxyModel(this); m_editWdg = new %EditWidgetClassName%(); m_editDialog = new EditDialog(m_editWdg, this); m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterKeyColumn(%ModelClassName%::NameCol); ui->tableView->horizontalHeader()->setDefaultSectionSize(%ModelClassName%::IdCol, 50); ui->tableView->setModel(m_proxyModel, %ModelClassName%::IdCol, Qt::DisplayRole); connect(ui->btnAdd, SIGNAL(clicked()), SLOT(add())); connect(ui->btnEdit, SIGNAL(clicked()), SLOT(editCurrent())); connect(ui->btnDelete, SIGNAL(clicked()), SLOT(deleteSelected())); connect(ui->btnPrint, SIGNAL(print(Report&)), SLOT(slotPrint(Report&))); connect(ui->edFind, SIGNAL(textEdited(QString)), m_proxyModel, SLOT(setFilterRegExp(QString))); connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), SLOT(viewDoubleClicked(QModelIndex))); restoreSettings(); } %TableClassName%::~%TableClassName%() { saveSettings(); delete ui; } AdvTableView *%TableClassName%::view() const
RequestsTableWidget::RequestsTableWidget(QWidget *parent) : TableEditInterface(parent) { m_view = new AdvTableView(this); m_model = new RequestsModel(this); m_proxyModel = new SortFilterProxyModel(this); m_proxyModel->setSourceModel(m_model); m_view->setContextMenuPolicy(Qt::CustomContextMenu); setSettingPrefix("RequestsTableWidget"); m_view->setSettingPrefix("RequestsTableWidget/view"); m_view->addColumn(RequestsModel::IdCol, 60, false); m_view->addColumn(RequestsModel::StateCol, 100, true); m_view->addColumn(RequestsModel::StorageCol, 100, false); m_view->addColumn(RequestsModel::EquipmentTypeCol, 120, true); m_view->addColumn(RequestsModel::ItemCol, -1, true); m_view->addColumn(RequestsModel::ArticleCol, 120, true); m_view->addColumn(RequestsModel::QtyCol, 60, true); m_view->addColumn(RequestsModel::UnitCol, 50, true); m_view->addColumn(RequestsModel::BalanceCol, 60, true); m_view->addColumn(RequestsModel::NoteCol, -1, true); m_view->setModel(m_proxyModel); m_btnAdd = new QPushButton(tr("Add"), this); m_btnEdit = new QPushButton(tr("Edit"), this); m_btnRemove = new QPushButton(tr("Remove"), this); m_btnPrint = new PrintButton(this); m_btnAdd->setMinimumHeight(30); m_btnEdit->setMinimumHeight(30); m_btnRemove->setMinimumHeight(30); m_btnPrint->setMinimumHeight(30); m_editWdg = new RequestEditWidget(); m_editDlg = new EditDialog(m_editWdg,this); m_editWdg->setSettingPrefix("RequestsTableWidget/editWidget"); m_acAdd = new QAction(tr("Add"), this); m_acEdit = new QAction(tr("Edit"), this); m_acRemove = new QAction(tr("Remove"), this); m_acStateToHidden = new QAction(tr("To Hidden"), this); m_acStateToPublic = new QAction(tr("To Public"), this); m_acStateToDelivered = new QAction(tr("To Delivered"), this); m_acAdd->setShortcut(Qt::Key_Insert); m_acRemove->setShortcut(QKeySequence::Delete); addAction(m_acAdd); addAction(m_acEdit); addAction(m_acRemove); m_ckFilterHidden = new QCheckBox(tr("Hidden"), this); m_ckFilterPublic = new QCheckBox(tr("Public"), this); m_ckFilterDelivered = new QCheckBox(tr("Delivered"), this); m_ckFilterHidden->setChecked(true); m_ckFilterPublic->setChecked(true); QVBoxLayout *centrLay = new QVBoxLayout(this); QHBoxLayout *filterLay = new QHBoxLayout(); filterLay->addWidget(m_ckFilterHidden); filterLay->addWidget(m_ckFilterPublic); filterLay->addWidget(m_ckFilterDelivered); filterLay->addStretch(); centrLay->addLayout(filterLay); centrLay->addWidget(m_view); QHBoxLayout *btnLay = new QHBoxLayout(); btnLay->addWidget(m_btnAdd); btnLay->addWidget(m_btnEdit); btnLay->addWidget(m_btnRemove); btnLay->addWidget(m_btnPrint); btnLay->addStretch(); centrLay->addLayout(btnLay); centrLay->setMargin(0); setFocusProxy(m_view); setWindowTitle(tr("Requests")); connect(m_btnAdd, SIGNAL(clicked()), SLOT(add())); connect(m_btnEdit, SIGNAL(clicked()), SLOT(editCurrent())); connect(m_btnRemove, SIGNAL(clicked()), SLOT(removeSelected())); connect(m_view, SIGNAL(doubleClicked(QModelIndex)), SLOT(editCurrent())); connect(m_btnPrint, SIGNAL(print(Report&)), SLOT(print(Report&))); connect(m_acAdd, SIGNAL(triggered()), SLOT(add())); connect(m_acEdit, SIGNAL(triggered()), SLOT(editCurrent())); connect(m_acRemove, SIGNAL(triggered()), SLOT(removeSelected())); connect(m_acStateToHidden, SIGNAL(triggered()), SLOT(stateToHidden())); connect(m_acStateToPublic, SIGNAL(triggered()), SLOT(stateToPublic())); connect(m_acStateToDelivered, SIGNAL(triggered()), SLOT(stateToDelivered())); connect(m_ckFilterHidden, SIGNAL(clicked()), SLOT(updateFilter())); connect(m_ckFilterPublic, SIGNAL(clicked()), SLOT(updateFilter())); connect(m_ckFilterDelivered, SIGNAL(clicked()), SLOT(updateFilter())); connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), SLOT(onViewMenu())); }