void Q3DataBrowser::del() { QSqlRecord* buf = d->frm.record(); Q3SqlCursor* cur = d->cur.cursor(); if (!buf || !cur) return; QSql::Confirm conf = QSql::Yes; switch (d->dat.mode()){ case QSql::Insert: if (confirmCancels()) conf = confirmCancel(QSql::Insert); if (conf == QSql::Yes) { cur->editBuffer(true); /* restore from cursor */ readFields(); d->dat.setMode(QSql::Update); } else d->dat.setMode(QSql::Insert); break; default: if (confirmDelete()) conf = confirmEdit(QSql::Delete); switch (conf) { case QSql::Yes: emit primeDelete(buf); deleteCurrent(); break; case QSql::No: case QSql::Cancel: break; } d->dat.setMode(QSql::Update); break; } }
int Q3DataBrowser::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 24) qt_static_metacall(this, _c, _id, _a); _id -= 24; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = boundaryChecking(); break; case 1: *reinterpret_cast< QString*>(_v) = filter(); break; case 2: *reinterpret_cast< QStringList*>(_v) = sort(); break; case 3: *reinterpret_cast< bool*>(_v) = confirmEdits(); break; case 4: *reinterpret_cast< bool*>(_v) = confirmInsert(); break; case 5: *reinterpret_cast< bool*>(_v) = confirmUpdate(); break; case 6: *reinterpret_cast< bool*>(_v) = confirmDelete(); break; case 7: *reinterpret_cast< bool*>(_v) = confirmCancels(); break; case 8: *reinterpret_cast< bool*>(_v) = isReadOnly(); break; case 9: *reinterpret_cast< bool*>(_v) = autoEdit(); break; } _id -= 10; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setBoundaryChecking(*reinterpret_cast< bool*>(_v)); break; case 1: setFilter(*reinterpret_cast< QString*>(_v)); break; case 2: setSort(*reinterpret_cast< QStringList*>(_v)); break; case 3: setConfirmEdits(*reinterpret_cast< bool*>(_v)); break; case 4: setConfirmInsert(*reinterpret_cast< bool*>(_v)); break; case 5: setConfirmUpdate(*reinterpret_cast< bool*>(_v)); break; case 6: setConfirmDelete(*reinterpret_cast< bool*>(_v)); break; case 7: setConfirmCancels(*reinterpret_cast< bool*>(_v)); break; case 8: setReadOnly(*reinterpret_cast< bool*>(_v)); break; case 9: setAutoEdit(*reinterpret_cast< bool*>(_v)); break; } _id -= 10; } else if (_c == QMetaObject::ResetProperty) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 10; } #endif // QT_NO_PROPERTIES return _id; }
void ImagePane::deleteCurrentBox() //if an inscription or surface box is deleted //all boxes below it in the hierarchy (graphs, or graphs and inscriptions) //are deleted too { if(locked || currentBoxIndex == -1) return; switch(mode) { case SURFACE: if(surf->inscriptionCount() == 0 || confirmDelete("inscription")) { *surf = BoundingBox(QPoint(0,0), QPoint(0,0), 0); surf->deleteAllInscriptions(); emit inscrImgListModified(); //signal picked up by TranscriptionWindow currentBoxIndex = -1; } break; case INSCRIPTION: if(surf->ptrInscrAt(currentBoxIndex)->boxCount() == 0 || confirmDelete("graph")) { surf->deleteInscr(currentBoxIndex); emit inscrImgListModified(); //signal picked up by TranscriptionWindow currentBoxIndex--; if(currentBoxIndex == -1) currentBoxIndex = surf->inscriptionCount() - 1; } break; case GRAPH: surf->ptrInscrAt(currentInscrIndex)->deleteBox(currentBoxIndex); currentBoxIndex--; if(currentBoxIndex == -1) currentBoxIndex = surf->ptrInscrAt(currentInscrIndex)->count() - 1; break; default: break; } update(); }
int deleteIndexForm::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: confirmDelete(); break; case 1: populateOptions((*reinterpret_cast< QStringList(*)>(_a[1]))); break; case 2: languageChange(); break; default: ; } _id -= 3; } return _id; }
//mouse up, end rubberband void ImagePane::mouseReleaseEvent(QMouseEvent* event) //TODO after adding new item, TranscriptionWindow::reset() must be called //use signal and slot arrangement. { rubberBand->hide(); //get bBox, accounting for rotation and zoom QRect rect(origin/zoom, event->pos()/zoom); rect = rect.normalized(); //topLeft etc. are not reliable without this //if it was a tiny drag, it was probably an accident if(rect.height()<3 || rect.width()<3 || locked) { update(); //to remove the mess return; } BoundingBox box(rect.topLeft(), rect.bottomRight(), rotation/*, false*/); //append the box to the appropriate list, according to mode switch(mode) { case SURFACE: if(surf->inscriptionCount() == 0 || confirmDelete("inscription")) { surf->deleteAllInscriptions(); surf->setBox(rect.topLeft(), rect.bottomRight(), rotation/*, false*/); currentBoxIndex = 0; emit inscrImgListModified(); //picked up by TranscriptionWindow //TODO FIX THIS!! } break; case INSCRIPTION: surf->insertInscr(box, ++currentBoxIndex); emit inscrImgListModified(); //picked up by TranscriptionWindow break; case GRAPH: surf->ptrInscrAt(currentInscrIndex)->insertBox(box, ++currentBoxIndex); break; default: break; } update(); }
void UserFiles::checkTypeOfItem(QListWidgetItem *item) { /* Tipo 0 = Arquivo Tipo 1 = Diretorio Tipo 2 = Novo diretorio (Naum faz nada) */ QDialog *menuDialog = new QDialog; QVBoxLayout *layoutMenu = new QVBoxLayout; QPushButton *deleteButton = new QPushButton("Deletar"); QPushButton *closeButton = new QPushButton("Fechar"); switch(item->type()) { case 0: setCurrentFile(item); layoutMenu->addWidget(deleteButton); layoutMenu->addWidget(closeButton); connect(deleteButton,SIGNAL(clicked()),this,SLOT(confirmDelete())); connect(closeButton,SIGNAL(clicked()),menuDialog,SLOT(close())); connect(deleteButton,SIGNAL(clicked()),menuDialog,SLOT(close())); menuDialog->setLayout(layoutMenu); menuDialog->exec(); break; case 1: layout->removeWidget(listWidget); if(item->text() == "..") ServicosRedes::getSingletonInstance()->listarPasta(parentFolder); else ServicosRedes::getSingletonInstance()->listarPasta("/" + item->text()); break; case 2: break; } }
bool Q3DataManager::confirmEdits() const { return (confirmInsert() && confirmUpdate() && confirmDelete()); }
EditUserDialog::EditUserDialog (Session* parent) : EncryptedWindow(parent, parent->highestWindowLayer(), true, true), _user(NoUser) { setBorder(new FrameBorder()); setLayout(new BoxLayout(Qt::Vertical, BoxLayout::HStretch, Qt::AlignCenter, 1)); Container* scont = BoxLayout::createHStretchBox(1); addChild(scont); scont->addChild(new Label(tr("Username:"******"", 16))); connect(_username, SIGNAL(textChanged()), SLOT(updateSearch())); scont->addChild(_search = new Button(tr("Search")), BoxLayout::Fixed); connect(_search, SIGNAL(pressed()), SLOT(search())); _search->connect(_username, SIGNAL(enterPressed()), SLOT(doPress())); Container* icont = new Container(new TableLayout(2)); icont->setBorder(new CharBorder(QMargins(1, 0, 1, 0), 0)); addChild(icont); icont->addChild(new Label(tr("ID:"))); icont->addChild(_id = new Label()); icont->addChild(new Label(tr("Created:"))); icont->addChild(_created = new Label()); icont->addChild(new Label(tr("Last Online:"))); icont->addChild(_lastOnline = new Label()); icont->addChild(new Spacer(1, 1)); icont->addChild(new Spacer(1, 1)); icont->addChild(new Label(tr("New Username:"******"", 16))); connect(_newUsername, SIGNAL(textChanged()), SLOT(updateApply())); icont->addChild(new Label(tr("Password:"******"(Keep Current)")); connect(_password, SIGNAL(textChanged()), SLOT(updateApply())); icont->addChild(new Label(tr("Confirm Password:"******"Date of Birth:"))); icont->addChild(_dob = new TextField()); connect(_dob, SIGNAL(textChanged()), SLOT(updateApply())); icont->addChild(new Label(tr("Email:"))); icont->addChild(_email = new TextField(20, new RegExpDocument(PartialEmailExp))); connect(_email, SIGNAL(textChanged()), SLOT(updateApply())); icont->addChild(new Label(tr("Banned:"))); icont->addChild(BoxLayout::createHBox(Qt::AlignLeft, 0, _banned = new CheckBox())); icont->addChild(new Label(tr("Admin:"))); icont->addChild(BoxLayout::createHBox(Qt::AlignLeft, 0, _admin = new CheckBox())); icont->addChild(new Label(tr("Insider:"))); icont->addChild(BoxLayout::createHBox(Qt::AlignLeft, 0, _insider = new CheckBox())); addChild(_status = new StatusLabel()); Button* cancel = new Button(tr("Cancel")); connect(cancel, SIGNAL(pressed()), SLOT(deleteLater())); connect(_delete = new Button(tr("Delete")), SIGNAL(pressed()), SLOT(confirmDelete())); connect(_apply = new Button(tr("Apply")), SIGNAL(pressed()), SLOT(apply())); connect(_ok = new Button(tr("OK")), SIGNAL(pressed()), SLOT(apply())); connect(_ok, SIGNAL(pressed()), SLOT(deleteLater())); addChild(BoxLayout::createHBox(Qt::AlignCenter, 2, cancel, _delete, _apply, _ok)); updateSearch(); }