File indexing completed on 2025-10-30 08:52:22
0001
0002
0003
0004 #ifndef QSQLINDEX_H
0005 #define QSQLINDEX_H
0006
0007 #include <QtSql/qtsqlglobal.h>
0008 #include <QtSql/qsqlrecord.h>
0009 #include <QtCore/qlist.h>
0010 #include <QtCore/qmetaobject.h>
0011 #include <QtCore/qstring.h>
0012
0013
0014 QT_BEGIN_NAMESPACE
0015
0016
0017 class Q_SQL_EXPORT QSqlIndex : public QSqlRecord
0018 {
0019 Q_GADGET
0020 Q_PROPERTY(QString name READ name WRITE setName)
0021 Q_PROPERTY(QString cursorName READ cursorName WRITE setCursorName)
0022
0023 public:
0024 explicit QSqlIndex(const QString &cursorName = QString(), const QString &name = QString());
0025 QSqlIndex(const QSqlIndex &other);
0026 QSqlIndex(QSqlIndex &&other) noexcept = default;
0027 ~QSqlIndex();
0028 QSqlIndex &operator=(const QSqlIndex &other);
0029 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QSqlIndex)
0030
0031 void swap(QSqlIndex &other) noexcept {
0032 QSqlRecord::swap(other);
0033 cursor.swap(other.cursor);
0034 nm.swap(other.nm);
0035 sorts.swap(other.sorts);
0036 }
0037
0038 void setCursorName(const QString &cursorName);
0039 inline QString cursorName() const { return cursor; }
0040 void setName(const QString& name);
0041 inline QString name() const { return nm; }
0042
0043 void append(const QSqlField &field);
0044 void append(const QSqlField &field, bool desc);
0045
0046 bool isDescending(int i) const;
0047 void setDescending(int i, bool desc);
0048
0049 private:
0050
0051 QString cursor;
0052 QString nm;
0053 QList<bool> sorts;
0054 };
0055
0056 Q_DECLARE_SHARED(QSqlIndex)
0057
0058 QT_END_NAMESPACE
0059
0060 #endif