0
我知道一些專業開發人員在令人失望的情況下在那裏晃動頭部......我只是試圖圍繞如何使用Qlist來存儲多種類型的數據在一個表內。我知道我會用QTableModel來設置這個數據嗎?建立結算應用程序。基本的想法或鏈接將罰款...謝謝你們如何使用Qlist創建一個包含15個不同字段的用戶配置文件模型
我知道一些專業開發人員在令人失望的情況下在那裏晃動頭部......我只是試圖圍繞如何使用Qlist來存儲多種類型的數據在一個表內。我知道我會用QTableModel來設置這個數據嗎?建立結算應用程序。基本的想法或鏈接將罰款...謝謝你們如何使用Qlist創建一個包含15個不同字段的用戶配置文件模型
這是一個很好的閱讀Model/View Programming in Qt的最佳做法。
以上鍊接底部的示例和鏈接也很好。
至於存儲多種類型,我會看看QVariant和QSettings;使用QVariant在Qt中的模型/視圖編程中被多次引用。
QVariant非常強大,適用於許多不同類型。它是從QSettings中讀取數值的核心。請務必閱讀QSettings的描述以獲取更多建議。
QBitArray toBitArray() const
bool toBool() const
QByteArray toByteArray() const
QChar toChar() const
QDate toDate() const
QDateTime toDateTime() const
double toDouble (bool * ok = 0) const
QEasingCurve toEasingCurve() const
float toFloat (bool * ok = 0) const
QHash<QString, QVariant> toHash() const
int toInt (bool * ok = 0) const
QLine toLine() const
QLineF toLineF() const
QList<QVariant> toList() const
QLocale toLocale() const
qlonglong toLongLong (bool * ok = 0) const
QMap<QString, QVariant> toMap() const
QPoint toPoint() const
QPointF toPointF() const
qreal toReal (bool * ok = 0) const
QRect toRect() const
QRectF toRectF() const
QRegExp toRegExp() const
QSize toSize() const
QSizeF toSizeF() const
QString toString() const
QStringList toStringList() const
QTime toTime() const
uint toUInt (bool * ok = 0) const
qulonglong toULongLong (bool * ok = 0) const
QUrl toUrl() const
另一個不錯的選擇是QString。它有許多內置的轉換也:)
QByteArray toAscii() const
QString toCaseFolded() const
double toDouble (bool * ok = 0) const
float toFloat (bool * ok = 0) const
int toInt (bool * ok = 0, int base = 10) const
QByteArray toLatin1() const
QByteArray toLocal8Bit() const
long toLong (bool * ok = 0, int base = 10) const
qlonglong toLongLong (bool * ok = 0, int base = 10) const
QString toLower() const
short toShort (bool * ok = 0, int base = 10) const
std::string toStdString() const
std::wstring toStdWString() const
uint toUInt (bool * ok = 0, int base = 10) const
ulong toULong (bool * ok = 0, int base = 10) const
qulonglong toULongLong (bool * ok = 0, int base = 10) const
ushort toUShort (bool * ok = 0, int base = 10) const
QVector<uint> toUcs4() const
QString toUpper() const
QByteArray toUtf8() const
int toWCharArray (wchar_t * array) const
當保存數值爲QString,一定要使用QString ::號碼(。