From: Manuel Nickschas Date: Sun, 18 Nov 2018 22:18:47 +0000 (+0100) Subject: serializers: Fix quint16 deserialization, remove code duplication X-Git-Tag: 0.13.1~20 X-Git-Url: https://git.quassel-irc.org/?a=commitdiff_plain;ds=sidebyside;h=c81e540aeea2b9787fbb09e2896d3e5c5adf0bbd;hp=c81e540aeea2b9787fbb09e2896d3e5c5adf0bbd;p=quassel.git serializers: Fix quint16 deserialization, remove code duplication Fix a bug where a quint16 would be deserialized into a QVariant of type Int (instead of UShort). This broke the sync of autoReconnectRetries in the network settings, because the slot's signature didn't match the type of the QVariant. The issue was caused by QVariant not having a constructor for quint16, thus casting it into an int. Fix this by using QVariant::fromValue(), which handles the type correctly. Use the opportunity to remove much of the code duplication in the deserialization code by providing and using a template function, avoiding potential other issues with using QVariant's constructor. (cherry picked from commit 95848fd9232d92f388e0e533adb15f6ba9d2d492) ---