// Rename the current tag. This is just the setup for the edit. When it is // complete the editComplete() function is called so the edit can be validated. void NTagView::renameRequested() { editor = new TreeWidgetEditor(this); connect(editor, SIGNAL(editComplete()), this, SLOT(editComplete())); QList<QTreeWidgetItem*> items = selectedItems(); editor->setText(items[0]->text(NAME_POSITION)); editor->lid = items[0]->data(NAME_POSITION, Qt::UserRole).toInt(); editor->setTreeWidgetItem(items[0], NAME_POSITION); QFontMetrics m(font()); editor->setMinimumHeight(m.height()+4); editor->setMaximumHeight(m.height()+4); setItemWidget(items[0], NAME_POSITION, editor); editor->setFocus(); }
void EditAllAssignmentsDialog::connectWidgets() { connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(editButton, SIGNAL(clicked()), this, SLOT(editAssignment())); connect(editWindow, SIGNAL(saveGradebook()), this, SLOT(emitSaveGradebook())); connect(editWindow, SIGNAL(editComplete()), this, SLOT(close())); }
// Get the point value entered by the user, edit the assignment if the value entered // is acceptable. Emit signals notifying the calling dialog that the assignment // as successfully edited. void EditMultipleAssignments::editAssignment() { QString stringPointValue(pointsBox->text()); double newPointValue(stringPointValue.toDouble()); // Is the point value entered greater than zero? if(newPointValue <= 0) // Error, display alert { messageWin->setWindowTitle("ALERT"); messageWin->setText("You must enter a point value above zero."); messageWin->exec(); pointsBox->clear(); return; } else // Accept new point value was entered, edit assignment { messageWin->setWindowTitle("Success!"); messageWin->setText("Points successfully saved!"); messageWin->exec(); gradebook->editPointsPossibleAll(assignmentName, newPointValue); save(); close(); emit editComplete(); } }
void ProviderWindow::saveAction() { try { if(record != NULL) dbwrite(); if(record != NULL) { if(record->getType() == PROVIDER_NEW) emit newComplete(); else emit editComplete(); delete record; record = NULL; } close(); } catch(pqxx::broken_connection) { DBErrorWindow *dialog = new DBErrorWindow(this, database); dialog->setAttribute(Qt::WA_DeleteOnClose,true); connect(dialog,SIGNAL(reconnected()),this,SLOT(saveAction())); dialog->exec(); } }
void TreeWidgetEditor::focusOutEvent(QFocusEvent *e) { // suppress unused Q_UNUSED(e); originalWidgetItem->setData(0, Qt::DisplayRole, text().trimmed()); parent->setItemWidget(originalWidgetItem, column, originalWidget); emit(editComplete()); }
void ProviderWindow::cancelAction() { if(record != NULL) { if(record->getType() == PROVIDER_NEW) emit newComplete(); else emit editComplete(); delete record; record = NULL; } close(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); word_list<<"Java"<<"C++"<<"C#"<<"PHP"<<"Perl"<<"Python"<<"Delphi"<<"Ruby"; QFile *inFile = new QFile ("input.txt"); search_line_edit = new QLineEdit(this); completer = new QCompleter(this); string_list_model = new QStringListModel(word_list, this); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setModel(string_list_model); search_line_edit->setCompleter(completer); connect(search_line_edit, SIGNAL(editingFinished()), this, SLOT(editComplete())); }
void ProviderWindow::deletewindowDelete() { record->setType(PROVIDER_DELETE); database->dbaction(record); if(record != NULL) { if(record->getType() == PROVIDER_NEW) emit newComplete(); else emit editComplete(); delete record; record = NULL; } close(); }
// When a user presses "Enter", force a focus out to save the data void TreeWidgetEditor::textChanged() { // originalWidgetItem->setData(0, Qt::DisplayRole, text().trimmed()); // parent->setItemWidget(originalWidgetItem, column, originalWidget); emit(editComplete()); }