fixed MSVC C4267 warnings
Dieser Commit ist enthalten in:
Ursprung
abc37635c4
Commit
a7edcc62a0
@ -774,7 +774,7 @@ void TilePainter::drawTriangle(const QRectF& r)
|
|||||||
{r.right(), r.bottom()},
|
{r.right(), r.bottom()},
|
||||||
{r.left(), r.bottom()}}};
|
{r.left(), r.bottom()}}};
|
||||||
|
|
||||||
m_painter.drawConvexPolygon(points.data(), points.size());
|
m_painter.drawConvexPolygon(points.data(), static_cast<int>(points.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilePainter::drawLED(const QRectF& r, const QColor& color, const QColor& borderColor)
|
void TilePainter::drawLED(const QRectF& r, const QColor& color, const QColor& borderColor)
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class ServerLogTableModel final : public QAbstractTableModel
|
|||||||
ServerLogTableModel(std::shared_ptr<Connection> connection);
|
ServerLogTableModel(std::shared_ptr<Connection> connection);
|
||||||
~ServerLogTableModel();
|
~ServerLogTableModel();
|
||||||
|
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const final { Q_UNUSED(parent); return m_columnHeaders.size(); }
|
int columnCount(const QModelIndex& parent = QModelIndex()) const final { Q_UNUSED(parent); return static_cast<int>(m_columnHeaders.size()); }
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const final;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const final;
|
||||||
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const final;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const final;
|
||||||
|
|||||||
@ -160,7 +160,7 @@ void InputMonitorWidget::keyReleaseEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
uint32_t InputMonitorWidget::pageCount() const
|
uint32_t InputMonitorWidget::pageCount() const
|
||||||
{
|
{
|
||||||
return static_cast<uint32_t>(m_addressMax->toInt64() - m_addressMin->toInt64() + m_leds.size()) / m_leds.size();
|
return static_cast<uint32_t>(m_addressMax->toInt64() - m_addressMin->toInt64() + m_leds.size()) / static_cast<uint32_t>(m_leds.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMonitorWidget::setPage(uint32_t value)
|
void InputMonitorWidget::setPage(uint32_t value)
|
||||||
@ -184,7 +184,7 @@ void InputMonitorWidget::setGroupBy(uint32_t value)
|
|||||||
|
|
||||||
LEDWidget* InputMonitorWidget::getLED(uint32_t address)
|
LEDWidget* InputMonitorWidget::getLED(uint32_t address)
|
||||||
{
|
{
|
||||||
const uint32_t first = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * m_leds.size();
|
const uint32_t first = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * static_cast<uint32_t>(m_leds.size());
|
||||||
|
|
||||||
if(address >= first && (address - first) < m_leds.size())
|
if(address >= first && (address - first) < m_leds.size())
|
||||||
return m_leds[address - first];
|
return m_leds[address - first];
|
||||||
@ -199,7 +199,7 @@ void InputMonitorWidget::updateLEDs()
|
|||||||
|
|
||||||
const uint32_t addressMin = static_cast<uint32_t>(m_addressMin->toInt64());
|
const uint32_t addressMin = static_cast<uint32_t>(m_addressMin->toInt64());
|
||||||
const uint32_t addressMax = static_cast<uint32_t>(m_addressMax->toInt64());
|
const uint32_t addressMax = static_cast<uint32_t>(m_addressMax->toInt64());
|
||||||
uint32_t address = addressMin + m_page * m_leds.size();
|
uint32_t address = addressMin + m_page * static_cast<uint32_t>(m_leds.size());
|
||||||
|
|
||||||
for(auto* led : m_leds)
|
for(auto* led : m_leds)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -161,7 +161,7 @@ OutputKeyboardWidget::OutputKeyboardWidget(std::shared_ptr<OutputKeyboard> objec
|
|||||||
connect(led, &LEDWidget::clicked, this,
|
connect(led, &LEDWidget::clicked, this,
|
||||||
[this, index=i]()
|
[this, index=i]()
|
||||||
{
|
{
|
||||||
const uint32_t address = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * m_leds.size() / 2 + index / 2;
|
const uint32_t address = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * static_cast<uint32_t>(m_leds.size()) / 2 + index / 2;
|
||||||
const auto value = (index & 0x1) ? OutputPairValue::Second : OutputPairValue::First;
|
const auto value = (index & 0x1) ? OutputPairValue::Second : OutputPairValue::First;
|
||||||
callMethod(*m_setOutputValue, nullptr, address, value);
|
callMethod(*m_setOutputValue, nullptr, address, value);
|
||||||
});
|
});
|
||||||
@ -251,7 +251,7 @@ uint32_t OutputKeyboardWidget::pageCount() const
|
|||||||
{
|
{
|
||||||
leds *= 2;
|
leds *= 2;
|
||||||
}
|
}
|
||||||
return static_cast<uint32_t>(leds + m_leds.size() - 1) / m_leds.size();
|
return static_cast<uint32_t>(leds + m_leds.size() - 1) / static_cast<uint32_t>(m_leds.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputKeyboardWidget::setPage(uint32_t value)
|
void OutputKeyboardWidget::setPage(uint32_t value)
|
||||||
@ -277,7 +277,7 @@ LEDWidget* OutputKeyboardWidget::getLED(uint32_t address)
|
|||||||
{
|
{
|
||||||
assert(m_object->outputType() == OutputType::Single);
|
assert(m_object->outputType() == OutputType::Single);
|
||||||
|
|
||||||
const uint32_t first = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * m_leds.size();
|
const uint32_t first = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * static_cast<uint32_t>(m_leds.size());
|
||||||
|
|
||||||
if(address >= first && (address - first) < m_leds.size())
|
if(address >= first && (address - first) < m_leds.size())
|
||||||
return m_leds[address - first];
|
return m_leds[address - first];
|
||||||
@ -289,7 +289,7 @@ std::pair<LEDWidget*, LEDWidget*> OutputKeyboardWidget::getLEDs(uint32_t address
|
|||||||
{
|
{
|
||||||
assert(m_object->outputType() == OutputType::Pair);
|
assert(m_object->outputType() == OutputType::Pair);
|
||||||
|
|
||||||
const uint32_t first = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * m_leds.size() / 2;
|
const uint32_t first = static_cast<uint32_t>(m_addressMin->toInt64()) + m_page * static_cast<uint32_t>(m_leds.size()) / 2;
|
||||||
|
|
||||||
if(address >= first && (address - first) < m_leds.size())
|
if(address >= first && (address - first) < m_leds.size())
|
||||||
return {m_leds[(address - first) * 2], m_leds[(address - first) * 2 + 1]};
|
return {m_leds[(address - first) * 2], m_leds[(address - first) * 2 + 1]};
|
||||||
@ -309,7 +309,7 @@ void OutputKeyboardWidget::updateLEDs()
|
|||||||
{
|
{
|
||||||
case OutputType::Single:
|
case OutputType::Single:
|
||||||
{
|
{
|
||||||
uint32_t address = addressMin + m_page * m_leds.size();
|
uint32_t address = addressMin + m_page * static_cast<uint32_t>(m_leds.size());
|
||||||
for(auto* led : m_leds)
|
for(auto* led : m_leds)
|
||||||
{
|
{
|
||||||
const auto& outputState = m_object->getOutputState(address);
|
const auto& outputState = m_object->getOutputState(address);
|
||||||
@ -329,7 +329,7 @@ void OutputKeyboardWidget::updateLEDs()
|
|||||||
}
|
}
|
||||||
case OutputType::Pair:
|
case OutputType::Pair:
|
||||||
{
|
{
|
||||||
uint32_t address = addressMin + m_page * m_leds.size() / 2;
|
uint32_t address = addressMin + m_page * static_cast<uint32_t>(m_leds.size()) / 2;
|
||||||
bool second = false;
|
bool second = false;
|
||||||
for(auto* led : m_leds)
|
for(auto* led : m_leds)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -162,7 +162,7 @@ OutputMapWidget::~OutputMapWidget()
|
|||||||
|
|
||||||
void OutputMapWidget::updateItems(const std::vector<ObjectPtr>& items)
|
void OutputMapWidget::updateItems(const std::vector<ObjectPtr>& items)
|
||||||
{
|
{
|
||||||
m_table->setRowCount(items.size());
|
m_table->setRowCount(static_cast<int>(items.size()));
|
||||||
m_itemObjects = items;
|
m_itemObjects = items;
|
||||||
m_actions.resize(items.size());
|
m_actions.resize(items.size());
|
||||||
for(size_t i = 0; i < items.size(); i++)
|
for(size_t i = 0; i < items.size(); i++)
|
||||||
@ -197,7 +197,7 @@ void OutputMapWidget::updateItems(const std::vector<ObjectPtr>& items)
|
|||||||
assert(false);
|
assert(false);
|
||||||
text = "?";
|
text = "?";
|
||||||
}
|
}
|
||||||
m_table->setItem(i, columnKey, new QTableWidgetItem(text));
|
m_table->setItem(static_cast<int>(i), columnKey, new QTableWidgetItem(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_hasUseColumn)
|
if(m_hasUseColumn)
|
||||||
@ -211,16 +211,16 @@ void OutputMapWidget::updateItems(const std::vector<ObjectPtr>& items)
|
|||||||
l->setAlignment(Qt::AlignCenter);
|
l->setAlignment(Qt::AlignCenter);
|
||||||
l->addWidget(new PropertyCheckBox(*p, w));
|
l->addWidget(new PropertyCheckBox(*p, w));
|
||||||
w->setLayout(l);
|
w->setLayout(l);
|
||||||
m_table->setCellWidget(i, columnUse, w);
|
m_table->setCellWidget(static_cast<int>(i), columnUse, w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(auto* p = items[i]->getProperty("visible"))
|
if(auto* p = items[i]->getProperty("visible"))
|
||||||
{
|
{
|
||||||
m_table->setRowHidden(i, !p->toBool());
|
m_table->setRowHidden(static_cast<int>(i), !p->toBool());
|
||||||
|
|
||||||
connect(p, &Property::valueChangedBool, this,
|
connect(p, &Property::valueChangedBool, this,
|
||||||
[this, row=i](bool value)
|
[this, row=static_cast<int>(i)](bool value)
|
||||||
{
|
{
|
||||||
m_table->setRowHidden(row, !value);
|
m_table->setRowHidden(row, !value);
|
||||||
});
|
});
|
||||||
@ -228,10 +228,10 @@ void OutputMapWidget::updateItems(const std::vector<ObjectPtr>& items)
|
|||||||
|
|
||||||
if(auto* outputActions = dynamic_cast<ObjectVectorProperty*>(items[i]->getVectorProperty("output_actions")))
|
if(auto* outputActions = dynamic_cast<ObjectVectorProperty*>(items[i]->getVectorProperty("output_actions")))
|
||||||
{
|
{
|
||||||
updateTableOutputActions(*outputActions, i);
|
updateTableOutputActions(*outputActions, static_cast<int>(i));
|
||||||
|
|
||||||
connect(outputActions, &ObjectVectorProperty::valueChanged, this,
|
connect(outputActions, &ObjectVectorProperty::valueChanged, this,
|
||||||
[this, row=i]()
|
[this, row=static_cast<int>(i)]()
|
||||||
{
|
{
|
||||||
updateTableOutputActions(*dynamic_cast<ObjectVectorProperty*>(sender()), row);
|
updateTableOutputActions(*dynamic_cast<ObjectVectorProperty*>(sender()), row);
|
||||||
});
|
});
|
||||||
@ -291,7 +291,7 @@ void OutputMapWidget::updateKeyIcons()
|
|||||||
break; // tileId not supported (yet)
|
break; // tileId not supported (yet)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_table->item(i, columnKey)->setIcon(QPixmap::fromImage(image));
|
m_table->item(static_cast<int>(i), columnKey)->setIcon(QPixmap::fromImage(image));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,7 +169,7 @@ class Message
|
|||||||
std::unique_ptr<Message> message = std::make_unique<Message>(command, Type::Response, requestId);
|
std::unique_ptr<Message> message = std::make_unique<Message>(command, Type::Response, requestId);
|
||||||
message->header().flags.error = 1;
|
message->header().flags.error = 1;
|
||||||
message->write(code);
|
message->write(code);
|
||||||
message->write<Length>(args.size());
|
message->write(static_cast<Length>(args.size()));
|
||||||
for(const auto& arg : args)
|
for(const auto& arg : args)
|
||||||
{
|
{
|
||||||
message->write(arg);
|
message->write(arg);
|
||||||
|
|||||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren