Skip to content

Commit 40aae14

Browse files
committed
Fix MSVC warnings
1 parent d301d9c commit 40aae14

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/ConnectionStyle.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,11 @@ normalColor(QString typeId) const
166166

167167
std::size_t const hue_range = 0xFF;
168168

169-
std::mt19937 gen(hash);
170-
std::uniform_int_distribution<> distrib(0, hue_range);
169+
std::mt19937 gen(static_cast<unsigned int>(hash));
170+
std::uniform_int_distribution<int> distrib(0, hue_range);
171171

172-
std::size_t hue = distrib(gen);
173-
174-
std::size_t sat = 120 + hash % 129;
172+
int hue = distrib(gen);
173+
int sat = 120 + hash % 129;
175174

176175
return QColor::fromHsl(hue,
177176
sat,

src/FlowScene.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ iterateOverNodeDataDependentOrder(std::function<void(NodeDataModel*)> const & vi
338338
{
339339
for (size_t i = 0; i < model.nPorts(PortType::In); ++i)
340340
{
341-
auto connections = node.nodeState().connections(PortType::In, i);
341+
auto connections = node.nodeState().connections(PortType::In, static_cast<PortIndex>(i));
342342

343343
for (auto& conn : connections)
344344
{

src/NodePainter.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ drawConnectionPoints(QPainter* painter,
126126
{
127127
QPointF p = geom.portScenePosition(i, portType);
128128

129-
auto const & dataType = model->dataType(portType, i);
129+
auto const & dataType =
130+
model->dataType(portType, static_cast<int>(i));
130131

131132
bool canConnect = (state.getEntries(portType)[i].empty() ||
132133
(portType == PortType::Out &&
@@ -208,7 +209,8 @@ drawFilledConnectionPoints(QPainter * painter,
208209

209210
if (!state.getEntries(portType)[i].empty())
210211
{
211-
auto const & dataType = model->dataType(portType, i);
212+
auto const & dataType =
213+
model->dataType(portType, static_cast<int>(i));
212214

213215
if (connectionStyle.useDataDefinedColors())
214216
{
@@ -302,7 +304,7 @@ drawEntryLabels(QPainter * painter,
302304
}
303305
else
304306
{
305-
s = model->dataType(portType, i).name;
307+
s = model->dataType(portType, static_cast<int>(i)).name;
306308
}
307309

308310
auto rect = metrics.boundingRect(s);

0 commit comments

Comments
 (0)