⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 q3sqlmanager_p.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        }#ifndef QT_NO_CURSOR        QApplication::restoreOverrideCursor();#endif    }#ifdef QT_DEBUG_DATAMANAGER        qDebug(" Done, result:" + QString::number(indexEquals));#endif    return indexEquals;}#ifndef QT_NO_SQL_FORMclass Q3SqlFormManagerPrivate{public:    Q3SqlFormManagerPrivate() : frm(0), rcd(0) {}    Q3SqlForm* frm;    QSqlRecord* rcd;};/*! \internal  Creates a form manager.*/Q3SqlFormManager::Q3SqlFormManager(){    d = new Q3SqlFormManagerPrivate();}/*! \internal  Destroys the object and frees any allocated resources.*/Q3SqlFormManager::~Q3SqlFormManager(){    delete d;}/*!  \internal  Clears the default form values.  If there is no default form,  nothing happens,*/void Q3SqlFormManager::clearValues(){    if (form())        form()->clearValues();}/*! \internal  Sets the form used by the form manager to \a form.  If a record has  already been assigned to the form manager, that record is also used by  the \a form to display data.  \sa form()*/void Q3SqlFormManager::setForm(Q3SqlForm* form){    d->frm = form;    if (d->rcd && d->frm)        d->frm->setRecord(d->rcd);}/*! \internal  Returns the default form used by the form manager, or 0 if there is  none.  \sa setForm()*/Q3SqlForm* Q3SqlFormManager::form(){    return d->frm;}/*! \internal  Sets the record used by the form manager to \a record.  If a form has  already been assigned to the form manager, \a record is also used by  the default form to display data.  \sa record()*/void Q3SqlFormManager::setRecord(QSqlRecord* record){    d->rcd = record;    if (d->frm) {        d->frm->setRecord(d->rcd);    }}/*! \internal  Returns the default record used by the form manager, or 0 if there is  none.  \sa setRecord()*/QSqlRecord* Q3SqlFormManager::record(){    return d->rcd;}/*! \internal  Causes the default form to read its fields .  If there is no  default form, nothing happens.  \sa setForm()*/void Q3SqlFormManager::readFields(){    if (d->frm) {        d->frm->readFields();    }}/*! \internal  Causes the default form to write its fields .  If there is no  default form, nothing happens.  \sa setForm()*/void Q3SqlFormManager::writeFields(){    if (d->frm) {        d->frm->writeFields();    }}#endif // QT_NO_SQL_FORMclass Q3DataManagerPrivate{public:    Q3DataManagerPrivate()        : mode(QSql::None), autoEd(true), confEdits(3),          confCancs(false) {}    QSql::Op mode;    bool autoEd;    QBitArray confEdits;    bool confCancs;};/*!  \class Q3DataManager qsqlmanager_p.h  \brief The Q3DataManager class is an internal class for implementing  the data-aware widgets.  \internal  \compat  Q3DataManager is a strictly internal class that acts as a base class  for other data-aware widgets.*//*!  \internal  Constructs an empty data handler.*/Q3DataManager::Q3DataManager(){    d = new Q3DataManagerPrivate();}/*! \internal  Destroys the object and frees any allocated resources.*/Q3DataManager::~Q3DataManager(){    delete d;}/*!  \internal  Virtual function which is called when an error has occurred The  default implementation displays a warning message to the user with  information about the error.*/void Q3DataManager::handleError(QWidget* parent, const QSqlError& e){#ifndef QT_NO_MESSAGEBOX    if (e.driverText().isEmpty() && e.databaseText().isEmpty()) {        QMessageBox::warning (parent, QLatin1String("Warning"), QLatin1String("An error occurred while accessing the database"));    } else {        QMessageBox::warning (parent, QLatin1String("Warning"), e.driverText() + QLatin1Char('\n') + e.databaseText(),                           0, 0);    }#endif // QT_NO_MESSAGEBOX}/*! \internal  Sets the internal mode to \a m.*/void Q3DataManager::setMode(QSql::Op m){    d->mode = m;}/*! \internal  Returns the current mode.*/QSql::Op Q3DataManager::mode() const{    return d->mode;}/*! \internal  Sets the auto-edit mode to \a auto.*/void Q3DataManager::setAutoEdit(bool autoEdit){    d->autoEd = autoEdit;}/*! \internal  Returns true if auto-edit mode is enabled; otherwise returns false.*/bool Q3DataManager::autoEdit() const{    return d->autoEd;}/*! \internal  If \a confirm is true, all edit operations (inserts, updates and  deletes) will be confirmed by the user.  If \a confirm is false (the  default), all edits are posted to the database immediately.*/void Q3DataManager::setConfirmEdits(bool confirm){    d->confEdits = QBitArray(d->confEdits.size(), confirm);}/*! \internal  If \a confirm is true, all inserts will be confirmed by the user.  If \a confirm is false (the default), all edits are posted to the  database immediately.*/void Q3DataManager::setConfirmInsert(bool confirm){    d->confEdits[QSql::Insert] = confirm;}/*! \internal  If \a confirm is true, all updates will be confirmed by the user.  If \a confirm is false (the default), all edits are posted to the  database immediately.*/void Q3DataManager::setConfirmUpdate(bool confirm){    d->confEdits[QSql::Update] = confirm;}/*! \internal  If \a confirm is true, all deletes will be confirmed by the user.  If \a confirm is false (the default), all edits are posted to the  database immediately.*/void Q3DataManager::setConfirmDelete(bool confirm){    d->confEdits[QSql::Delete] = confirm;}/*! \internal  Returns true if the table confirms all edit operations (inserts,  updates and deletes), otherwise returns false.*/bool Q3DataManager::confirmEdits() const{    return (confirmInsert() && confirmUpdate() && confirmDelete());}/*! \internal  Returns true if the table confirms inserts, otherwise returns  false.*/bool Q3DataManager::confirmInsert() const{    return d->confEdits[QSql::Insert];}/*! \internal  Returns true if the table confirms updates, otherwise returns  false.*/bool Q3DataManager::confirmUpdate() const{    return d->confEdits[QSql::Update];}/*! \internal  Returns true if the table confirms deletes, otherwise returns  false.*/bool Q3DataManager::confirmDelete() const{    return d->confEdits[QSql::Delete];}/*! \internal  If \a confirm is true, all cancels will be confirmed by the user  through a message box.  If \a confirm is false (the default), all  cancels occur immediately.*/void Q3DataManager::setConfirmCancels(bool confirm){    d->confCancs = confirm;}/*! \internal  Returns true if the table confirms cancels, otherwise returns false.*/bool Q3DataManager::confirmCancels() const{    return d->confCancs;}/*!  \internal  Virtual function which returns a confirmation for an edit of mode \a  m.  Derived classes can reimplement this function and provide their  own confirmation dialog.  The default implementation uses a message  box which prompts the user to confirm the edit action.  The dialog  is centered over \a parent.*/QSql::Confirm Q3DataManager::confirmEdit(QWidget* parent, QSql::Op m){    int ans = 2;    if (m == QSql::Delete) {#ifndef QT_NO_MESSAGEBOX        ans = QMessageBox::information(parent,                                        qApp->translate("QSql", "Delete"),                                        qApp->translate("QSql", "Delete this record?"),                                        qApp->translate("QSql", "Yes"),                                        qApp->translate("QSql", "No"),                                        QString(), 0, 1);#else        ans = QSql::No;#endif // QT_NO_MESSAGEBOX    } else if (m != QSql::None) {        QString caption;        if (m == QSql::Insert) {            caption = qApp->translate("QSql", "Insert");        } else { // QSql::Update            caption = qApp->translate("QSql", "Update");        }#ifndef QT_NO_MESSAGEBOX        ans = QMessageBox::information(parent, caption,                                        qApp->translate("QSql", "Save edits?"),                                        qApp->translate("QSql", "Yes"),                                        qApp->translate("QSql", "No"),                                        qApp->translate("QSql", "Cancel"),                                        0, 2);#else        ans = QSql::No;#endif // QT_NO_MESSAGEBOX    }    switch (ans) {    case 0:        return QSql::Yes;    case 1:        return QSql::No;    default:        return QSql::Cancel;    }}/*!  \internal  Virtual function which returns a confirmation for canceling an edit  mode \a m.  Derived classes can reimplement this function and  provide their own confirmation dialog.  The default implementation  uses a message box which prompts the user to confirm the edit  action. The dialog is centered over \a parent.*/QSql::Confirm Q3DataManager::confirmCancel(QWidget* parent, QSql::Op){#ifndef QT_NO_MESSAGEBOX    switch (QMessageBox::information(parent,                                       qApp->translate("QSql", "Confirm"),                                       qApp->translate("QSql", "Cancel your edits?"),                                       qApp->translate("QSql", "Yes"),                                       qApp->translate("QSql", "No"),                                       QString(), 0, 1)) {    case 0:        return QSql::Yes;    case 1:        return QSql::No;    default:        return QSql::Cancel;    }#else    return QSql::Yes;#endif // QT_NO_MESSAGEBOX}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -