diff --git a/examples/examples.pro b/examples/examples.pro index d27f9f9a..022524f8 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -4,7 +4,6 @@ TEMPLATE = subdirs SUBDIRS += \ desktop \ gallery \ - iot-dashboard \ layouts \ listbox \ messagebox \ @@ -12,6 +11,8 @@ SUBDIRS += \ thumbnails \ tabview +lessThan(QT_MAJOR_VERSION, 6): SUBDIRS += iot-dashboard + qtHaveModule(svg) { # when checking in qvg files we could drop the svg dependency diff --git a/examples/iot-dashboard/Diagram.cpp b/examples/iot-dashboard/Diagram.cpp index 15efc66a..cf93f7a5 100644 --- a/examples/iot-dashboard/Diagram.cpp +++ b/examples/iot-dashboard/Diagram.cpp @@ -5,8 +5,6 @@ #include "Diagram.h" -#include - class Diagram::PrivateData { public: diff --git a/examples/iot-dashboard/PieChartPainted.cpp b/examples/iot-dashboard/PieChartPainted.cpp index e34987c5..28f78289 100644 --- a/examples/iot-dashboard/PieChartPainted.cpp +++ b/examples/iot-dashboard/PieChartPainted.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -149,11 +150,13 @@ void PieChartPainted::updateLayout() m_progressBar->setContentsSize( size().toSize() ); m_progressBar->update(); - auto rect = contentsRect(); - QFontMetricsF progressMetrics( m_progressLabel->effectiveFont( QskTextLabel::Text ) ); - auto textWidth = progressMetrics.width( m_progressLabel->text() ); + const auto rect = layoutRect(); + + QFontMetricsF fm( m_progressLabel->effectiveFont( QskTextLabel::Text ) ); + auto textWidth = qskHorizontalAdvance( fm, m_progressLabel->text() ); auto posX = rect.width() / 2 - textWidth / 2; - auto posY = rect.height() / 2 - progressMetrics.height() / 2; - m_progressLabel->setPosition( {posX, posY} ); + auto posY = rect.height() / 2 - fm.height() / 2; + + m_progressLabel->setPosition( { posX, posY } ); m_progressLabel->setFixedWidth( textWidth ); } diff --git a/examples/iot-dashboard/RoundedIcon.cpp b/examples/iot-dashboard/RoundedIcon.cpp index 1091c290..d1573025 100644 --- a/examples/iot-dashboard/RoundedIcon.cpp +++ b/examples/iot-dashboard/RoundedIcon.cpp @@ -37,6 +37,7 @@ #include #include +#include QSK_SUBCONTROL( RoundedIcon, Panel ) QSK_SUBCONTROL( RoundedIcon, Icon ) diff --git a/examples/iot-dashboard/nodes/DiagramDataNode.cpp b/examples/iot-dashboard/nodes/DiagramDataNode.cpp index e5b74bb4..f33e4e6c 100644 --- a/examples/iot-dashboard/nodes/DiagramDataNode.cpp +++ b/examples/iot-dashboard/nodes/DiagramDataNode.cpp @@ -46,7 +46,13 @@ void DiagramDataNode::update( const QRectF& rect, Type type, const QColor& color m_position = position; m_type = type; - GLenum drawingMode = ( m_type == Line ) ? GL_LINES : GL_TRIANGLE_STRIP; + const auto drawingMode = +#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) + ( m_type == Line ) ? QSGGeometry::DrawLines : QSGGeometry::DrawTriangleStrip; +#else + ( m_type == Line ) ? GL_LINES : GL_TRIANGLE_STRIP; +#endif + m_geometry.setDrawingMode( drawingMode ); const int vertexCount = ( m_type == Line ) ? m_dataPoints.size() * 2 - 1 : m_dataPoints.size() * 2; diff --git a/examples/iot-dashboard/nodes/DiagramSegmentsNode.cpp b/examples/iot-dashboard/nodes/DiagramSegmentsNode.cpp index 842e2ced..fc82713b 100644 --- a/examples/iot-dashboard/nodes/DiagramSegmentsNode.cpp +++ b/examples/iot-dashboard/nodes/DiagramSegmentsNode.cpp @@ -10,7 +10,11 @@ DiagramSegmentsNode::DiagramSegmentsNode() : m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 ) { +#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) + m_geometry.setDrawingMode( QSGGeometry::DrawLines ); +#else m_geometry.setDrawingMode( GL_LINES ); +#endif setGeometry( &m_geometry ); setMaterial( &m_material );