summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2018-10-22 16:53:46 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-10-29 13:21:28 +0000
commit892933136932552f626cdc6e4922ddea10bd2605 (patch)
tree6cc1c262d397f0effb49b7fc8ccb2a826309e8aa
parent55b43d3e1c3a100f4ad41d94c132afd2a0d029b3 (diff)
Print state changes using the states string name
This is just for convenience to avoid the need to look up the values each time. Change-Id: I4a2ebc0ba8e8dda16a71c555a51b4d411f3d03c4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/runtime/q3dsslideplayer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/q3dsslideplayer.cpp b/src/runtime/q3dsslideplayer.cpp
index 81d04b0..d994f01 100644
--- a/src/runtime/q3dsslideplayer.cpp
+++ b/src/runtime/q3dsslideplayer.cpp
@@ -31,6 +31,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qloggingcategory.h>
+#include <QtCore/qmetaobject.h>
#include "q3dsscenemanager_p.h"
#include "q3dsanimationmanager_p.h"
#include "q3dslogging_p.h"
@@ -48,6 +49,12 @@
QT_BEGIN_NAMESPACE
+template <typename Enum>
+const char *getEnumName(Enum e)
+{
+ return QMetaEnum::fromType<Enum>().valueToKey(int(e));
+}
+
class Q3DSSlidePositionCallback : public Qt3DAnimation::QAnimationCallback
{
public:
@@ -644,7 +651,7 @@ void Q3DSSlidePlayer::reset()
void Q3DSSlidePlayer::setInternalState(Q3DSSlidePlayer::PlayerState state)
{
m_data.pendingState = state;
- qCDebug(lcSlidePlayer, "Setting internal state from %d to %d", int(m_data.state), int(m_data.pendingState));
+ qCDebug(lcSlidePlayer, "Setting internal state from %s to %s", getEnumName(m_data.state), getEnumName(m_data.pendingState));
Q3DSSlide *currentSlide = m_data.slideDeck->currentSlide();