AMDataViewWithActionButtons::AMDataViewWithActionButtons(AMDatabase* database, QWidget *parent) : QWidget(parent) { QVBoxLayout* vl = new QVBoxLayout; dataView_ = new AMDataView(database); QFrame* actionsBarFrame = new QFrame; ui_ = new Ui::AMDataViewActionsBar; ui_->setupUi(actionsBarFrame); vl->setContentsMargins(0,0,0,0); vl->setSpacing(0); vl->addWidget(dataView_); vl->addWidget(actionsBarFrame); setLayout(vl); connect(ui_->sizeSlider, SIGNAL(valueChanged(int)), dataView_, SLOT(setItemSize(int))); connect(ui_->expandAllButton, SIGNAL(clicked()), dataView_, SLOT(expandAll())); connect(ui_->collapseAllButton, SIGNAL(clicked()), dataView_, SLOT(collapseAll())); connect(ui_->openSameEditorButton, SIGNAL(clicked()), this, SLOT(onCompareScansAction())); connect(ui_->openSeparateEditorButton, SIGNAL(clicked()), this, SLOT(onEditScansAction())); connect(ui_->exportButton, SIGNAL(clicked()), this, SLOT(onExportScansAction())); connect(ui_->scanConfigurationButton, SIGNAL(clicked()), this, SLOT(onLaunchScanConfigurationsFromDb())); connect(dataView_, SIGNAL(viewDoubleClicked()), this, SLOT(onDoubleClick())); connect(dataView_, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); connect(dataView_, SIGNAL(editScansFromDb()), this, SLOT(onEditScansAction())); connect(dataView_, SIGNAL(compareScansFromDb()), this, SLOT(onCompareScansAction())); connect(dataView_, SIGNAL(exportScansFromDb()), this, SLOT(onExportScansAction())); connect(dataView_, SIGNAL(launchScanConfigurationsFromDb()), this, SLOT(onLaunchScanConfigurationsFromDb())); connect(dataView_, SIGNAL(fixCDF()), this, SLOT(onFixCDF())); }
void CharTableView::keyPressEvent(QKeyEvent *k) { switch (k->key()) { case Qt::Key_Backspace: case Qt::Key_Delete: emit delChar(); break; case Qt::Key_Insert: // safely emit selectChar(model()->characters()[currentCharactersIndex()]); viewDoubleClicked(QModelIndex()); break; } QTableView::keyPressEvent(k); }
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 { return ui->tableView; }