Qt6 migration

This commit is contained in:
eelke 2021-03-06 13:13:31 +01:00
parent 87553b2554
commit 423043d431
19 changed files with 64 additions and 87 deletions

View file

@ -40,9 +40,10 @@ public:
this->reportResult(result); this->reportResult(result);
} }
} catch (QException &e) { } catch (QException &e) {
reportException(e); QFutureInterfaceBase::reportException(e);
} catch (...) { } catch (...) {
reportException(QUnhandledException()); QUnhandledException ex;
QFutureInterfaceBase::reportException(ex);
} }
this->reportFinished(); this->reportFinished();

View file

@ -100,8 +100,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
} }
length = m_pos - startpos; length = m_pos - startpos;
tokentype = BasicTokenType::WhiteSpace; tokentype = BasicTokenType::WhiteSpace;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
} }
@ -117,8 +116,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
} }
length = m_pos - startpos; length = m_pos - startpos;
tokentype = BasicTokenType::Comment; tokentype = BasicTokenType::Comment;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
else if (c == ':') { else if (c == ':') {
@ -127,8 +125,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
nextChar(); nextChar();
length = m_pos - startpos; length = m_pos - startpos;
tokentype = BasicTokenType::Cast; tokentype = BasicTokenType::Cast;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
} }
@ -139,8 +136,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
else else
tokentype = BasicTokenType::Self; tokentype = BasicTokenType::Self;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
else if (isOperatorChar(c)) { else if (isOperatorChar(c)) {
@ -153,8 +149,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
// unexpected end, pretend nothings wrong // unexpected end, pretend nothings wrong
length = m_pos - startpos; length = m_pos - startpos;
tokentype = BasicTokenType::Operator; tokentype = BasicTokenType::Operator;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
} }
@ -162,8 +157,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
else if (c == '\'') { else if (c == '\'') {
// Single quoted string so it's an SQL text literal // Single quoted string so it's an SQL text literal
if (parseSingleQuotedString(startpos, length, tokentype)) { if (parseSingleQuotedString(startpos, length, tokentype)) {
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
return false; return false;
@ -171,8 +165,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
else if (c == '"') { else if (c == '"') {
// Double quoted identifier // Double quoted identifier
if (parseDoubleQuotedIdentifier(startpos, length, tokentype)) { if (parseDoubleQuotedIdentifier(startpos, length, tokentype)) {
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
return false; return false;
@ -200,8 +193,7 @@ bool SqlLexer::nextBasicToken(int &startpos, int &length, BasicTokenType &tokent
} }
length = m_pos - startpos; length = m_pos - startpos;
tokentype = BasicTokenType::Symbol; tokentype = BasicTokenType::Symbol;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
// } // }
@ -301,8 +293,7 @@ bool SqlLexer::parseDollarQuote(int startpos, int &length, BasicTokenType &token
} }
tokentype = BasicTokenType::Parameter; tokentype = BasicTokenType::Parameter;
length = m_pos - startpos; length = m_pos - startpos;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
@ -314,8 +305,7 @@ bool SqlLexer::parseDollarQuote(int startpos, int &length, BasicTokenType &token
// Found valid dollar quote // Found valid dollar quote
tokentype = BasicTokenType::DollarQuote; tokentype = BasicTokenType::DollarQuote;
length = m_pos - startpos; length = m_pos - startpos;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return true; return true;
} }
@ -323,8 +313,7 @@ bool SqlLexer::parseDollarQuote(int startpos, int &length, BasicTokenType &token
// ERROR, unallowed character // ERROR, unallowed character
tokentype = BasicTokenType::None; tokentype = BasicTokenType::None;
length = m_pos - startpos; length = m_pos - startpos;
QStringRef sr(&m_block, startpos, length); out = m_block.mid(startpos, length);
out = sr.toString();
return false; return false;
} }
} }

View file

@ -21,7 +21,6 @@
// Qt includes // Qt includes
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>
#include <QDesktopWidget>
#include <QDir> #include <QDir>
#include <QEvent> #include <QEvent>
#include <QLabel> #include <QLabel>

View file

@ -20,7 +20,7 @@
// Qt includes // Qt includes
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> //#include <QDesktopWidget>
#include <QDialog> #include <QDialog>
#include <QDir> #include <QDir>
#include <QEvent> #include <QEvent>
@ -416,7 +416,7 @@ void ctkPopupWidget::leaveEvent(QEvent* event)
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void ctkPopupWidget::enterEvent(QEvent* event) void ctkPopupWidget::enterEvent(QEnterEvent* event)
{ {
Q_D(ctkPopupWidget); Q_D(ctkPopupWidget);
QTimer::singleShot(d->ShowDelay, this, SLOT(updatePopup())); QTimer::singleShot(d->ShowDelay, this, SLOT(updatePopup()));

View file

@ -109,21 +109,21 @@ public Q_SLOTS:
public: public:
/// Reimplemented for internal reasons /// Reimplemented for internal reasons
virtual void hidePopup(); virtual void hidePopup() override;
protected: protected:
virtual void leaveEvent(QEvent* event); virtual void leaveEvent(QEvent* event) override;
virtual void enterEvent(QEvent* event); virtual void enterEvent(QEnterEvent* event) override;
virtual bool eventFilter(QObject* obj, QEvent* event); virtual bool eventFilter(QObject* obj, QEvent* event) override;
/// Widget the popup is attached to. It opens right under \a baseWidget /// Widget the popup is attached to. It opens right under \a baseWidget
/// and if the ctkPopupWidget sizepolicy contains the growFlag/shrinkFlag, /// and if the ctkPopupWidget sizepolicy contains the growFlag/shrinkFlag,
/// it tries to resize itself to fit the same width of \a baseWidget. /// it tries to resize itself to fit the same width of \a baseWidget.
virtual void setBaseWidget(QWidget* baseWidget); virtual void setBaseWidget(QWidget* baseWidget) override;
protected Q_SLOTS: protected Q_SLOTS:
void updatePopup(); void updatePopup();
virtual void onEffectFinished(); virtual void onEffectFinished() override;
private: private:
Q_DECLARE_PRIVATE(ctkPopupWidget); Q_DECLARE_PRIVATE(ctkPopupWidget);

View file

@ -6,7 +6,6 @@
#include "ConnectionConfig.h" #include "ConnectionConfig.h"
#include <QProcess> #include <QProcess>
class QStringList;
class QLabel; class QLabel;
class QPushButton; class QPushButton;

View file

@ -298,9 +298,9 @@ QVariant ColumnTableModel::data(const QModelIndex &index, int role) const
QVariant v; QVariant v;
int col = index.column(); int col = index.column();
if (col == NullCol || col >= colCount) if (col == NullCol || col >= colCount)
v = Qt::AlignCenter + Qt::AlignVCenter; v = int(Qt::AlignCenter | Qt::AlignVCenter);
else else
v = Qt::AlignLeft + Qt::AlignVCenter; v = int(Qt::AlignLeft | Qt::AlignVCenter);
return v; return v;
} }
return BaseTableModel::data(index, role); return BaseTableModel::data(index, role);

View file

@ -141,21 +141,21 @@ void DatabaseWindow::createActions()
icon.addFile(QString::fromUtf8(":/icons/page_white_delete.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/page_white_delete.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionClose = new QAction(icon, tr("Close"), this); auto action = actionClose = new QAction(icon, tr("Close"), this);
action->setObjectName("actionClose"); action->setObjectName("actionClose");
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W)); action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_W));
} }
{ {
QIcon icon; QIcon icon;
icon.addFile(QString::fromUtf8(":/icons/page_white_copy.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/page_white_copy.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionCopy = new QAction(icon, tr("Copy"), this); auto action = actionCopy = new QAction(icon, tr("Copy"), this);
action->setObjectName("actionCopy"); action->setObjectName("actionCopy");
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C));
} }
{ {
QIcon icon; QIcon icon;
icon.addFile(QString::fromUtf8(":/icons/token_shortland_character.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/token_shortland_character.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionCopyAsCString = new QAction(icon, tr("Copy as C string"), this); auto action = actionCopyAsCString = new QAction(icon, tr("Copy as C string"), this);
action->setObjectName("actionCopyAsCString"); action->setObjectName("actionCopyAsCString");
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C)); action->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_C));
} }
{ {
QIcon icon; QIcon icon;
@ -184,7 +184,7 @@ void DatabaseWindow::createActions()
icon.addFile(QString::fromUtf8(":/icons/lightbulb.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/lightbulb.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionExplainAnalyze = new QAction(icon, tr("Explain analyze"), this); auto action = actionExplainAnalyze = new QAction(icon, tr("Explain analyze"), this);
action->setObjectName("actionExplainAnalyze"); action->setObjectName("actionExplainAnalyze");
action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F7)); action->setShortcut(QKeySequence(Qt::SHIFT | Qt::Key_F7));
} }
{ {
QIcon icon; QIcon icon;
@ -219,21 +219,21 @@ void DatabaseWindow::createActions()
icon.addFile(QString::fromUtf8(":/icons/new_query_tab.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/new_query_tab.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionNewSql = new QAction(icon, tr("New Query"), this); auto action = actionNewSql = new QAction(icon, tr("New Query"), this);
action->setObjectName("actionNewSql"); action->setObjectName("actionNewSql");
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N));
} }
{ {
QIcon icon; QIcon icon;
icon.addFile(QString::fromUtf8(":/icons/folder.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/folder.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionOpenSql = new QAction(icon, tr("Open Query"), this); auto action = actionOpenSql = new QAction(icon, tr("Open Query"), this);
action->setObjectName("actionOpenSql"); action->setObjectName("actionOpenSql");
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_O));
} }
{ {
QIcon icon; QIcon icon;
//icon.addFile(QString::fromUtf8(":/icons/folder.png"), QSize(), QIcon::Normal, QIcon::On); //icon.addFile(QString::fromUtf8(":/icons/folder.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionPasteLangString = new QAction(icon, tr("Paste lang string"), this); auto action = actionPasteLangString = new QAction(icon, tr("Paste lang string"), this);
action->setObjectName("actionPasteLangString"); action->setObjectName("actionPasteLangString");
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); action->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_V));
} }
{ {
QIcon icon; QIcon icon;
@ -253,7 +253,7 @@ void DatabaseWindow::createActions()
icon.addFile(QString::fromUtf8(":/icons/script_save.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/script_save.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionSaveSql = new QAction(icon, tr("Save query"), this); auto action = actionSaveSql = new QAction(icon, tr("Save query"), this);
action->setObjectName("actionSaveSql"); action->setObjectName("actionSaveSql");
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
} }
{ {
auto action = actionSaveSqlAs = new QAction(tr("Save query as"), this); auto action = actionSaveSqlAs = new QAction(tr("Save query as"), this);

View file

@ -103,10 +103,10 @@ void PgLabItemDelegate::initStyleOption(QStyleOptionViewItem *option,
option->text = FormatBoolForDisplay(value.toBool()); option->text = FormatBoolForDisplay(value.toBool());
else { else {
auto str = value.toString(); auto str = value.toString();
auto s = str.leftRef(100); auto s = str.left(100);
// auto f = s.indexOf('\n'); // auto f = s.indexOf('\n');
// option->text = ((f > 0) ? s.left(f) : s).toString(); // option->text = ((f > 0) ? s.left(f) : s).toString();
option->text = s.toString(); option->text = s;
} }
} }
else { else {

View file

@ -54,13 +54,13 @@ if (role == Qt::DisplayRole) {
} }
else if (role == Qt::TextAlignmentRole) { else if (role == Qt::TextAlignmentRole) {
if (col == c_ColumnNode || col == c_ColumnDetails) { if (col == c_ColumnNode || col == c_ColumnDetails) {
result = Qt::AlignLeft + Qt::AlignVCenter; result = int(Qt::AlignLeft | Qt::AlignVCenter);
} }
else { else {
result = Qt::AlignRight + Qt::AlignVCenter; result = int(Qt::AlignRight | Qt::AlignVCenter);
} }
} }
else if (role == Qt::BackgroundColorRole) { else if (role == Qt::BackgroundRole) {
if (col == c_ColumnExclusive || col == c_ColumnInclusive) { if (col == c_ColumnExclusive || col == c_ColumnInclusive) {
float t = col == 1 ? item->exclusiveTime() : item->inclusiveTime(); float t = col == 1 ? item->exclusiveTime() : item->inclusiveTime();
float tt = explain->plan->inclusiveTime(); float tt = explain->plan->inclusiveTime();

View file

@ -7,8 +7,8 @@
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QStatusBar> #include <QStatusBar>
#include <QStringConverter>
#include <QTabWidget> #include <QTabWidget>
#include <QTextCodec>
#include <QTextDocumentFragment> #include <QTextDocumentFragment>
#include <QTextStream> #include <QTextStream>
#include <QClipboard> #include <QClipboard>
@ -90,12 +90,9 @@ bool QueryTool::load(const QString &filename)
QFile file(filename); QFile file(filename);
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
QByteArray ba = file.readAll(); QByteArray ba = file.readAll();
const char *ptr = ba.constData(); auto toUtf16 = QStringDecoder(QStringDecoder::Utf8);
QString text = toUtf16(ba);
QTextCodec *codec = QTextCodec::codecForUtfText(ba, QTextCodec::codecForName("utf-8")); if (toUtf16.hasError()) {
QTextCodec::ConverterState state;
QString text = codec->toUnicode(ptr, ba.size(), &state);
if (state.invalidChars > 0) {
file.reset(); file.reset();
QTextStream stream(&file); QTextStream stream(&file);
text = stream.readAll(); text = stream.readAll();
@ -280,7 +277,8 @@ bool QueryTool::saveSqlTo(const QString &filename)
QFile file(filename); QFile file(filename);
if (file.open(QIODevice::WriteOnly)) { if (file.open(QIODevice::WriteOnly)) {
QTextStream stream(&file); QTextStream stream(&file);
stream.setCodec("utf-8"); //stream.setCodec("utf-8");
stream.setEncoding(QStringConverter::Utf8);
QString text = ui->queryEdit->toPlainText(); QString text = ui->queryEdit->toPlainText();
stream << text; stream << text;

View file

@ -8,7 +8,7 @@ using namespace Pgsql;
Qt::Alignment GetDefaultAlignmentForType(Oid o) Qt::Alignment GetDefaultAlignmentForType(Oid o)
{ {
int r; Qt::Alignment r;
switch (o) { switch (o) {
case int2_oid: case int2_oid:
case int4_oid: case int4_oid:

View file

@ -34,7 +34,7 @@ public:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
void setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat); void setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat);
void SequenceModel::setNamespaceFilter(NamespaceFilter filter); void setNamespaceFilter(NamespaceFilter filter);
int rowCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override;

View file

@ -10,7 +10,6 @@ UserConfiguration* UserConfiguration::instance()
UserConfiguration::UserConfiguration() UserConfiguration::UserConfiguration()
: m_settings(nullptr) : m_settings(nullptr)
{ {
m_settings.setIniCodec("UTF-8");
} }
QFont UserConfiguration::codeFont() const QFont UserConfiguration::codeFont() const

View file

@ -7,14 +7,6 @@
namespace { namespace {
class registerMetaTypes {
public:
registerMetaTypes()
{
qRegisterMetaTypeStreamOperators<ConnectionConfig>("ConnectionConfig");
}
} registerMetaTypes_instance;
struct { struct {
SslMode mode; SslMode mode;
const char* string; const char* string;

View file

@ -5,7 +5,7 @@
void FormatToStream(QTextStream &stream, QString format, std::function<void(QTextStream &, QString)> field_callback) void FormatToStream(QTextStream &stream, QString format, std::function<void(QTextStream &, QString)> field_callback)
{ {
// Use static to optimize only once // Use static to optimize only once
static QRegularExpression cached_find_var_re("(?:[^\\\\]|^)(\\/%([a-zA-Z0-9_-]+)%\\/)", QRegularExpression::OptimizeOnFirstUsageOption); static QRegularExpression cached_find_var_re("(?:[^\\\\]|^)(\\/%([a-zA-Z0-9_-]+)%\\/)");
int from = 0; int from = 0;
QRegularExpressionMatch match; QRegularExpressionMatch match;
@ -17,7 +17,7 @@ void FormatToStream(QTextStream &stream, QString format, std::function<void(QTex
++from; ++from;
} }
// copy code before the var to the stream // copy code before the var to the stream
stream << format.midRef(from, match.capturedStart(1) - from); stream << format.mid(from, match.capturedStart(1) - from);
field_callback(stream, match.captured(2)); field_callback(stream, match.captured(2));
from = match.capturedEnd()-1; // -1 because it wants to match one character before or start of line to make sure there is no backslash from = match.capturedEnd()-1; // -1 because it wants to match one character before or start of line to make sure there is no backslash
} }
@ -25,5 +25,5 @@ void FormatToStream(QTextStream &stream, QString format, std::function<void(QTex
// same reason as at the start of the loop // same reason as at the start of the loop
++from; ++from;
} }
stream << format.midRef(from); stream << format.mid(from);
} }

View file

@ -2,7 +2,7 @@
/** /**
*/ */
QString convert(QStringRef in, ConvertToNumericEscape conversion, NumericEscapeFormat format, QString prefix) QString convert(QStringView in, ConvertToNumericEscape conversion, NumericEscapeFormat format, QString prefix)
{ {
return ""; return "TODO";
} }

View file

@ -86,7 +86,7 @@ void copySelectionToClipboard(const QTableView *view)
if (selectedIndexes.count() > 0) { if (selectedIndexes.count() > 0) {
QString clipboard_string; QString clipboard_string;
QTextStream out(&clipboard_string, QIODevice::WriteOnly); QTextStream out(&clipboard_string, QTextStream::WriteOnly);
CsvWriter csv(&out); CsvWriter csv(&out);
csv.setSeperator('\t'); csv.setSeperator('\t');
csv.setQuote('"'); csv.setQuote('"');
@ -153,7 +153,7 @@ QString ConvertToMultiLineCString(const QString &in_)
if (token.ok) { if (token.ok) {
if (token.tokenType == BasicTokenType::Comment) { if (token.tokenType == BasicTokenType::Comment) {
// save comment is seperate variable // save comment is seperate variable
comment = "//" + token.out.rightRef(token.out.length()-2); comment = "//" + token.out.right(token.out.length()-2);
// Trim whitespace on right // Trim whitespace on right
int idx; int idx;
for (idx = comment.length() - 1; idx >= 0 && comment[idx].isSpace(); --idx) ; for (idx = comment.length() - 1; idx >= 0 && comment[idx].isSpace(); --idx) ;
@ -168,7 +168,7 @@ QString ConvertToMultiLineCString(const QString &in_)
++idx; ++idx;
if (!comment.isEmpty()) { if (!comment.isEmpty()) {
// put the whitespace in front of the comment so it will be outside the contents of the string literal but alignment of comments is preserved // put the whitespace in front of the comment so it will be outside the contents of the string literal but alignment of comments is preserved
comment = line.rightRef(line.length() - (idx)) + comment; comment = line.right(line.length() - (idx)) + comment;
} }
line.truncate(idx); line.truncate(idx);
} }

View file

@ -56,9 +56,9 @@ Param Params::addText(const char *data, Oid oid)
{ {
m_paramTypes.push_back(oid); m_paramTypes.push_back(oid);
m_paramValues.push_back(data); m_paramValues.push_back(data);
m_paramLengths.push_back(data ? strlen(data) + 1 : 0); m_paramLengths.push_back(data ? static_cast<int>(strlen(data)) + 1 : 0);
m_paramFormats.push_back(0); m_paramFormats.push_back(0);
return Param(*this, m_paramValues.size() - 1); return Param(*this, static_cast<int>(m_paramValues.size()) - 1);
} }
Param Params::add(const QString &s, Oid oid) Param Params::add(const QString &s, Oid oid)
@ -76,7 +76,7 @@ Param Params::add(const char *data, Oid oid)
char * p = nullptr; char * p = nullptr;
int len = 0; int len = 0;
if (data) { if (data) {
len = std::strlen(data); len = static_cast<int>(std::strlen(data));
p = new char[len+1]; p = new char[len+1];
std::memcpy(p, data, len); std::memcpy(p, data, len);
p[len] = 0; p[len] = 0;
@ -108,7 +108,7 @@ void Params::clear()
void Params::copyValues(const t_paramValues &r) void Params::copyValues(const t_paramValues &r)
{ {
const int n = m_paramTypes.size(); const int n = static_cast<int>(m_paramTypes.size());
m_paramValues.reserve(n); m_paramValues.reserve(n);
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
if (r[i]) { if (r[i]) {