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