mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-07-30 07:44:13 +02:00
Fix remaining Qt6 build warnings (narrowing, nodiscard, qHash)
Clears the 9 non-deprecation warnings from the Qt6 build: - qHash(QColor): hash rgba() (unambiguous QRgb) instead of name(), and use the size_t seed signature on Qt6 (guarded for Qt5). Fixes the ambiguous-overload warning in terminalstripmodel.h. - Two qsizetype->int narrowings in brace-init: explicit static_cast<int> (elementscene.cpp, terminalstrip.cpp). - main.cpp: keep the QtConcurrent::run QFuture in a [[maybe_unused]] variable (nodiscard). - qetapp.cpp: guard the stylesheet load on QFile::open() succeeding (nodiscard) instead of ignoring the result.
This commit is contained in:
@@ -639,7 +639,7 @@ bool TerminalStrip::isBridgeable(const QVector<QSharedPointer<RealTerminal>> &re
|
||||
// Get the physical terminal and pos
|
||||
auto first_physical_terminal = first_real_terminal->physicalTerminal();
|
||||
QVector<shared_physical_terminal> physical_vector{first_physical_terminal};
|
||||
QVector<int> pos_vector{m_physical_terminals.indexOf(first_physical_terminal)};
|
||||
QVector<int> pos_vector{static_cast<int>(m_physical_terminals.indexOf(first_physical_terminal))};
|
||||
|
||||
auto bridge_ = isBridged(first_real_terminal);
|
||||
//bool to know at the end of this function if at least one terminal is not bridged
|
||||
|
||||
@@ -29,9 +29,15 @@
|
||||
#include "modelTerminalData.h"
|
||||
|
||||
//Code to use QColor as key for QHash
|
||||
inline uint qHash(const QColor &key, uint seed) {
|
||||
return qHash(key.name(), seed);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
inline size_t qHash(const QColor &key, size_t seed = 0) {
|
||||
return qHash(key.rgba(), seed);
|
||||
}
|
||||
#else
|
||||
inline uint qHash(const QColor &key, uint seed) {
|
||||
return qHash(key.rgba(), seed);
|
||||
}
|
||||
#endif
|
||||
|
||||
//needed to use QPointer<Element> as key of QHash
|
||||
inline uint qHash(const QPointer<Element> &key, uint seed) {
|
||||
|
||||
Reference in New Issue
Block a user