Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix behavior of DitheringMode with QVariant in Qt5 #3307

Merged
merged 1 commit into from Jul 6, 2023

Conversation

10110111
Copy link
Contributor

@10110111 10110111 commented Jul 5, 2023

Fixes #3304

I didn't quite understand how DitheringMode gets into QVariant via the RemoteSync plugin, but at least with this change QVariant::fromValue(DitheringMode::Color888).toString() yields the correct string. Before this change the output string was empty. So I suppose this should be sufficient for #3304.

@gzotti
Copy link
Member

gzotti commented Jul 5, 2023

Thanks. Unfortunately it does not improve the issue.

RemoteSync transmits properties and property changes to connected clients. Only QVariant types work with that. Something positive appears to have changed between Qt5 and Qt6, making enums just work properly. However, on Qt5 I see that connection still fails at the same point.

Please do the following:

plugins/RemoteSync/src/SyncClientHandlers.cpp, line 309-10, replace with:

	if(!ok)
	{
		qWarning() << "Problem deserializing " << msg.propId;
		return false;
	}

Then, build with Qt5 and start one instance, start RemoteSync server (you must go to config/plugins/RemoteSync configure).
Start another instance and connect to the first as client.

You will see in the top left corner a status message indicating failure, reconnection will fail.
Inspect the logfile: This is super verbose, and indeed I am attempting to make it less so. (Reading about QLoggingCategory now)
Near the end, you see messages like "Disconnecting with error: "last message of type 8 was rejected".

Go up to identify the first such message.

" [Sync][Peer "127.0.0.1:20180" ]: received header for STELPROPERTY"
" [Sync][Peer "127.0.0.1:20180" ]: received body, processing"
" QVariant::load: unable to load type 1133."
" Problem deserializing "StelCore.ditheringMode""
" [SyncPlugin] Disconnecting with error: "last message of type 8 was rejected""
" [Sync][Peer "127.0.0.1:20180" ]: Send message ERROR [ ]"
" [Sync][Peer "127.0.0.1:20180" ]: Socket state: QAbstractSocket::ClosingState"
" [Sync][Peer "127.0.0.1:20180" ]: Socket state: QAbstractSocket::UnconnectedState"
" [Sync][Peer "127.0.0.1:20180" ]: Socket disconnected"

The issues is still around StelCore.ditheringMode.

It may be easier to declare that if the DitheringMode enum was defined inside a class. Is there a technical reason for keeping this separate from e.g. StelCore?

There may be more recent changes which break this plugin in Qt5 now, just that this property shows itself first.

@10110111 10110111 force-pushed the fix-dithering-mode-qvariant branch from d4a5b01 to 7e89ba7 Compare July 6, 2023 09:30
@10110111
Copy link
Contributor Author

10110111 commented Jul 6, 2023

Should work now.

@gzotti
Copy link
Member

gzotti commented Jul 6, 2023

Ah yes, there!
Hmm, did you compile with Qt5? An operator >> is missing.

@10110111
Copy link
Contributor Author

10110111 commented Jul 6, 2023

Compiled with Qt 5.15 successfully. What is your error message?

@alex-w alex-w added this to the 23.3 milestone Jul 6, 2023
@gzotti
Copy link
Member

gzotti commented Jul 6, 2023

Ah yes, it works on 5.15.2.

Previously I tried 5.12.12 which we usually need. Sorry, MSVC has German compiler output:

C:\Qt\5.12.12\msvc2017_64\include\QtCore/qmetatype.h(815): error C2679: Bin„rer Operator ">>": Es konnte kein Operator gefunden werden, der einen rechtsseitigen Operanden vom Typ "T" akzeptiert (oder keine geeignete Konvertierung m”glich)
with
[
T=DitheringMode
]
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(164): note: kann "QDataStream &QDataStream::operator >>(char *&)" sein
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(163): note: oder "QDataStream &QDataStream::operator >>(double &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(162): note: oder "QDataStream &QDataStream::operator >>(float &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(161): note: oder "QDataStream &QDataStream::operator >>(qfloat16 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(160): note: oder "QDataStream &QDataStream::operator >>(bool &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(158): note: oder "QDataStream &QDataStream::operator >>(std::nullptr_t &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(352): note: oder "QDataStream &QDataStream::operator >>(quint64 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(156): note: oder "QDataStream &QDataStream::operator >>(qint64 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(349): note: oder "QDataStream &QDataStream::operator >>(quint32 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(154): note: oder "QDataStream &QDataStream::operator >>(qint32 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(346): note: oder "QDataStream &QDataStream::operator >>(quint16 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(152): note: oder "QDataStream &QDataStream::operator >>(qint16 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(343): note: oder "QDataStream &QDataStream::operator >>(quint8 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qdatastream.h(150): note: oder "QDataStream &QDataStream::operator >>(qint8 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore\qtimezone.h(181): note: oder "QDataStream &operator >>(QDataStream &,QTimeZone &)"
C:\Qt\5.12.12\msvc2017_64\include\QtWidgets/qsizepolicy.h(174): note: oder "QDataStream &operator >>(QDataStream &,QSizePolicy &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qpalette.h(208): note: oder "QDataStream &operator >>(QDataStream &,QPalette &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qpen.h(57): note: oder "QDataStream &operator >>(QDataStream &,QPen &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qbrush.h(145): note: oder "QDataStream &operator >>(QDataStream &,QBrush &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qpixmap.h(194): note: oder "QDataStream &operator >>(QDataStream &,QPixmap &)"
C:\Qt\5.12.12\msvc2017_64\include\QtPositioning\qgeopositioninfo.h(108): note: oder "QDataStream &operator >>(QDataStream &,QGeoPositionInfo::Attribute &)"
C:\Qt\5.12.12\msvc2017_64\include\QtPositioning\qgeopositioninfo.h(96): note: oder "QDataStream &operator >>(QDataStream &,QGeoPositionInfo &)"
C:\Qt\5.12.12\msvc2017_64\include\QtPositioning\qgeocoordinate.h(129): note: oder "QDataStream &operator >>(QDataStream &,QGeoCoordinate &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qvector2d.h(282): note: oder "QDataStream &operator >>(QDataStream &,QVector2D &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qurl.h(411): note: oder "QDataStream &operator >>(QDataStream &,QUrl &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qkeysequence.h(59): note: oder "QDataStream &operator >>(QDataStream &,QKeySequence &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui\qcursor.h(128): note: oder "QDataStream &operator >>(QDataStream &,QCursor &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qeasingcurve.h(125): note: oder "QDataStream &operator >>(QDataStream &,QEasingCurve &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore\qdatetime.h(386): note: oder "QDataStream &operator >>(QDataStream &,QDateTime &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore\qdatetime.h(213): note: oder "QDataStream &operator >>(QDataStream &,QTime &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore\qdatetime.h(149): note: oder "QDataStream &operator >>(QDataStream &,QDate &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qfont.h(326): note: oder "QDataStream &operator >>(QDataStream &,QFont &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui\qimage.h(491): note: oder "QDataStream &operator >>(QDataStream &,QImage &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qtransform.h(374): note: oder "QDataStream &operator >>(QDataStream &,QTransform &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qpainterpath.h(230): note: oder "QDataStream &operator >>(QDataStream &,QPainterPath &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qmatrix.h(185): note: oder "QDataStream &operator >>(QDataStream &,QMatrix &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qline.h(431): note: oder "QDataStream &operator >>(QDataStream &,QLineF &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qline.h(208): note: oder "QDataStream &operator >>(QDataStream &,QLine &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qregion.h(163): note: oder "QDataStream &operator >>(QDataStream &,QRegion &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qpolygon.h(196): note: oder "QDataStream &operator >>(QDataStream &,QPolygonF &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qpolygon.h(117): note: oder "QDataStream &operator >>(QDataStream &,QPolygon &)"
D:\StelDev\GIT\stellarium\src\core\StelLocation.hpp(153): note: oder "QDataStream &operator >>(QDataStream &,StelLocation &)"
D:\StelDev\GIT\stellarium\src\core\StelSphereGeometry.hpp(133): note: oder "QDataStream &operator >>(QDataStream &,SphericalRegionP &)"
D:\StelDev\GIT\stellarium\src\core\OctahedronPolygon.hpp(116): note: oder "QDataStream &operator >>(QDataStream &,OctahedronPolygon &)"
D:\StelDev\GIT\stellarium\src\core\OctahedronPolygon.hpp(46): note: oder "QDataStream &operator >>(QDataStream &,EdgeVertex &)"
D:\StelDev\GIT\stellarium\src\core\StelVertexArray.hpp(108): note: oder "QDataStream &operator >>(QDataStream &,StelVertexArray &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore\qregularexpression.h(172): note: oder "QDataStream &operator >>(QDataStream &,QRegularExpression &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui\qcolor.h(61): note: oder "QDataStream &operator >>(QDataStream &,QColor &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui\qmatrix4x4.h(1108): note: oder "QDataStream &operator >>(QDataStream &,QMatrix4x4 &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qrect.h(637): note: oder "QDataStream &operator >>(QDataStream &,QRectF &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qrect.h(177): note: oder "QDataStream &operator >>(QDataStream &,QRect &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qsize.h(277): note: oder "QDataStream &operator >>(QDataStream &,QSizeF &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qsize.h(109): note: oder "QDataStream &operator >>(QDataStream &,QSize &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qmargins.h(328): note: oder "QDataStream &operator >>(QDataStream &,QMarginsF &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qmargins.h(95): note: oder "QDataStream &operator >>(QDataStream &,QMargins &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qquaternion.h(399): note: oder "QDataStream &operator >>(QDataStream &,QQuaternion &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qtextstream.h(227): note: oder "QTextStream &operator >>(QTextStream &,QTextStreamFunction)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qlocale.h(1123): note: oder "QDataStream &operator >>(QDataStream &,QLocale &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qvariant.h(564): note: oder "QDataStream &operator >>(QDataStream &,QVariant::Type &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qvariant.h(562): note: oder "QDataStream &operator >>(QDataStream &,QVariant &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qregexp.h(125): note: oder "QDataStream &operator >>(QDataStream &,QRegExp &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qvector4d.h(310): note: oder "QDataStream &operator >>(QDataStream &,QVector4D &)"
C:\Qt\5.12.12\msvc2017_64\include\QtGui/qvector3d.h(309): note: oder "QDataStream &operator >>(QDataStream &,QVector3D &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qpoint.h(278): note: oder "QDataStream &operator >>(QDataStream &,QPointF &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qpoint.h(113): note: oder "QDataStream &operator >>(QDataStream &,QPoint &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore\qstring.h(1416): note: oder "QDataStream &operator >>(QDataStream &,QString &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qbytearray.h(696): note: oder "QDataStream &operator >>(QDataStream &,QByteArray &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qchar.h(626): note: oder "QDataStream &operator >>(QDataStream &,QChar &)"
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qmetatype.h(815): note: bei Anpassung der Argumentliste "(QDataStream, T)"
with
[
T=DitheringMode
]
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qmetatype.h(814): note: beim Kompilieren der Klasse Vorlage-Memberfunktion "void QtMetaTypePrivate::QMetaTypeFunctionHelper<T,true>::Load(QDataStream &,void *)"
with
[
T=DitheringMode
]
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qmetatype.h(1920): note: Siehe Verweis auf die gerade kompilierte Instanziierung "void QtMetaTypePrivate::QMetaTypeFunctionHelper<T,true>::Load(QDataStream &,void *)" der Funktions-Vorlage.
with
[
T=DitheringMode
]
C:\Qt\5.12.12\msvc2017_64\include\QtCore/qmetatype.h(1920): note: Siehe Verweis auf die gerade kompilierte Klasse Vorlage-Instanziierung "QtMetaTypePrivate::QMetaTypeFunctionHelper<T,true>".
with
[
T=DitheringMode
]
D:\StelDev\GIT\stellarium\src\core\StelCore.cpp(2076): note: Siehe Verweis auf die gerade kompilierte Instanziierung "int qRegisterMetaTypeStreamOperators(void)" der Funktions-Vorlage.
[210/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\MultiLevelJsonBase.cpp.obj
[211/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelVideoMgr.cpp.obj
[212/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelSkyDrawer.cpp.obj
[213/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelPainter.cpp.obj
[214/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelSkyImageTile.cpp.obj
[215/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelLocationMgr.cpp.obj
[216/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelObjectModule.cpp.obj
[217/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelOpenGL.cpp.obj
[218/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelLocaleMgr.cpp.obj
[219/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelToneReproducer.cpp.obj
[220/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelIniParser.cpp.obj
[221/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelApp.cpp.obj
[222/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelObject.cpp.obj
[223/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelModuleMgr.cpp.obj
[224/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelSkyCultureMgr.cpp.obj
[225/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelObjectMgr.cpp.obj
[226/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelTextureMgr.cpp.obj
[227/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelSkyLayer.cpp.obj
[228/368 7.9/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\OctahedronPolygon.cpp.obj
[229/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\core\StelTexture.cpp.obj
[230/368 7.8/sec] Building CXX object src\CMakeFiles\stelMain.dir\stelMain_autogen\mocs_compilation.cpp.obj
ninja: build stopped: subcommand failed.
12:05:36: Der Prozess "C:\Qt\Tools\CMake_64\bin\cmake.exe" wurde mit dem Rückgabewert 1 beendet.
Fehler beim Erstellen/Deployment des Projekts Stellarium (Kit: Desktop Qt 5.12.12 MSVC2017 64bit)
Bei der Ausführung von Schritt "Erstellen"
12:05:36: Verstrichene Zeit: 00:30.

@gzotti
Copy link
Member

gzotti commented Jul 6, 2023

We could move to Qt5.15 on Windows of course. However, I don't know about Linux practice, are Qt5.15 packages easily available everywhere? Ubuntu 20.4LTS? Arch? Mandriva? RaspberryOS? Or whatever you are using? Small Linux SBCs make nice client screens.

@10110111 10110111 force-pushed the fix-dithering-mode-qvariant branch from 7e89ba7 to e49a0dc Compare July 6, 2023 18:04
@10110111
Copy link
Contributor Author

10110111 commented Jul 6, 2023

OK, the new version should support Qt 5.12 too.

@10110111 10110111 force-pushed the fix-dithering-mode-qvariant branch from e49a0dc to 0aa7b83 Compare July 6, 2023 19:55
Copy link
Member

@gzotti gzotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! Many thanks!

@gzotti gzotti merged commit 018c706 into Stellarium:master Jul 6, 2023
9 of 10 checks passed
@10110111 10110111 deleted the fix-dithering-mode-qvariant branch July 6, 2023 20:18
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Jul 15, 2023
@github-actions
Copy link

Hello @10110111!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Sep 26, 2023
@github-actions
Copy link

Hello @10110111!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RemoteSync issues with Qt5
3 participants