fix Warning
This commit is contained in:
1 parent
593c221d23
commit
8345470273
316 files changed
+1246
-929
No files matched your search
@@ -97,10 +97,10 @@ bool AddModel::setData(const QModelIndex &index, const QVariant &value, int role
|
||||
}
|
||||
|
||||
|
||||
QVariant::Type AddModel::getColumnType(const int column) const
|
||||
QMetaType::Type AddModel::getColumnType(const int column) const
|
||||
{
|
||||
if (column < 0 || column >= m_headerList.size())
|
||||
return QVariant::Invalid;
|
||||
return QMetaType::UnknownType;
|
||||
return m_headerList.at(column).second;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
void setHeaderList(const HeaderList& headerList);
|
||||
void setTablename(const QString& tableName);
|
||||
const QString& getTableName() const;
|
||||
QVariant::Type getColumnType(const int column) const;
|
||||
QMetaType::Type getColumnType(const int column) const;
|
||||
const HeaderList& getHeaderList() const;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
@@ -41,12 +41,12 @@ void DataModel::addLine(const Data& data)
|
||||
}
|
||||
|
||||
|
||||
void DataModel::addColumn(const QString& columnName, QVariant::Type type)
|
||||
void DataModel::addColumn(const QString& columnName, QMetaType::Type type)
|
||||
{
|
||||
// QPair<QString,QVariant::Type> pair;
|
||||
// pair.first = columnName;
|
||||
// pair.second = type;
|
||||
m_newHeaderList.append(QPair<QString,QVariant::Type>(columnName, type));
|
||||
m_newHeaderList.append(QPair<QString,QMetaType::Type>(columnName, type));
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
if ((element.type() == QVariant::ULongLong || element.type() == QVariant::LongLong)
|
||||
if ((element.typeId() == QMetaType::ULongLong || element.typeId() == QMetaType::LongLong)
|
||||
&& element.toLongLong() > 1000000000)
|
||||
return QDateTime::fromMSecsSinceEpoch(element.toLongLong()).toString(QStringLiteral("dd.MM.yyyy hh:mm:ss.zzz"));
|
||||
|
||||
@@ -137,8 +137,8 @@ QVariant DataModel::headerData(int section, Qt::Orientation orientation, int rol
|
||||
case Qt::DisplayRole:
|
||||
return m_headerList.at(section).first;
|
||||
case Qt::ToolTipRole:
|
||||
int type = m_headerList.at(section).second;
|
||||
return QString::fromUtf8(QMetaType::typeName(type));
|
||||
QMetaType::Type type = m_headerList.at(section).second;
|
||||
return QString::fromUtf8(QMetaType(type).name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
using Data = QVector<QVariant>;
|
||||
using DataList = QVector<Data>;
|
||||
using HeaderList = QVector<QPair<QString, QVariant::Type>>;
|
||||
using HeaderList = QVector<QPair<QString, QMetaType::Type>>;
|
||||
|
||||
class DataModel: public QAbstractTableModel
|
||||
{
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
//void fillModel(const HeaderList &headerList, const DataList &dataList);
|
||||
void dataListReserve(const int size);
|
||||
void addLine(const Data& data);
|
||||
void addColumn(const QString& columnName, QVariant::Type type);
|
||||
void addColumn(const QString& columnName, QMetaType::Type type);
|
||||
const HeaderList& getHeaderList() const;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "LoginWnd.h"
|
||||
#include <utility>
|
||||
#include "ui_LoginUi.h"
|
||||
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
@@ -78,7 +79,7 @@ void LoginWnd::fillPresetComboBox()
|
||||
|
||||
const PresetManager::PresetList &presetList = presetManager.getPresetList();
|
||||
|
||||
for (const Preset &preset : qAsConst(presetList))
|
||||
for (const Preset &preset : std::as_const(presetList))
|
||||
m_ui->cbPresets->addItem(preset.name);
|
||||
|
||||
if (!presetList.isEmpty())
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "PresetManager.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QtWidgets/QApplication>
|
||||
@@ -132,7 +133,7 @@ void PresetManager::savePresets()
|
||||
createFile(); // recreate file
|
||||
|
||||
// save all presets to file
|
||||
for (const Preset &preset : qAsConst(presetList))
|
||||
for (const Preset &preset : std::as_const(presetList))
|
||||
{
|
||||
QString presetString = QStringLiteral("%1:%2%3");
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ui_QueryUi.h"
|
||||
#include <utility>
|
||||
|
||||
#include "Query.h"
|
||||
#include "QueryThread.h"
|
||||
@@ -163,7 +164,7 @@ void Query::slotExportCSV()
|
||||
file.write(columnNames.join(QLatin1Char(',')).toUtf8()); // write header
|
||||
file.write(NEWLINE);
|
||||
|
||||
for (const QString &row : qAsConst(rows))
|
||||
for (const QString &row : std::as_const(rows))
|
||||
{
|
||||
file.write(row.toUtf8());
|
||||
file.write(NEWLINE);
|
||||
|
||||
@@ -194,7 +194,7 @@ QString QueryWorker::selectQuery(const QString &queryString, DataModel* dataMode
|
||||
|
||||
for (int i = 0; i < recordCount; i++)
|
||||
{
|
||||
dataModel->addColumn(record.fieldName(i), record.field(i).type());
|
||||
dataModel->addColumn(record.fieldName(i), static_cast<QMetaType::Type>(record.field(i).metaType().id()));
|
||||
|
||||
if (m_dy) break;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ void QueryWorker::slotAddLines(Query* caller, AddModel* addModel)
|
||||
//{
|
||||
// // value comes from sql database and must be made 'visual'
|
||||
|
||||
// QVariant::Type type = headerList.at(col).second; // get column type from model
|
||||
// QMetaType::Type type = headerList.at(col).second; // get column type from model
|
||||
|
||||
// //qWarning() << "QueryWorker::variantToSqlString: type =" << type;
|
||||
|
||||
@@ -451,7 +451,7 @@ QString QueryWorker::valueToSqlString(const QVariant& val, const HeaderList &hea
|
||||
{
|
||||
// value must be converted to sql value
|
||||
|
||||
QVariant::Type type = headerList.at(col).second; // get column type from model
|
||||
QMetaType::Type type = headerList.at(col).second; // get column type from model
|
||||
|
||||
//qWarning() << "QueryWorker::valueToSqlString: val" << val << "type" << type << "("<<type<<")";
|
||||
|
||||
|
||||
Reference in new issue
Block a user