iotdashboard enabled for Qt6 ( BoxShadowNode #ifdef'd for the moment )

This commit is contained in:
Uwe Rathmann 2022-05-30 20:03:56 +02:00
parent b2a95c126e
commit 942e6cc13a
4 changed files with 25 additions and 15 deletions

View File

@ -9,15 +9,8 @@ SUBDIRS += \
messagebox \ messagebox \
mycontrols \ mycontrols \
thumbnails \ thumbnails \
tabview tabview \
iotdashboard
lessThan(QT_MAJOR_VERSION, 6) {
# the shader for the drop shadows has not yet been migrated
# to work with Qt 6
SUBDIRS += iotdashboard
}
qtHaveModule(svg) { qtHaveModule(svg) {

View File

@ -6,7 +6,10 @@
#include "LightDisplaySkinlet.h" #include "LightDisplaySkinlet.h"
#include "LightDisplay.h" #include "LightDisplay.h"
#include "nodes/BoxShadowNode.h" #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include "nodes/BoxShadowNode.h"
#endif
#include "nodes/RadialTickmarksNode.h" #include "nodes/RadialTickmarksNode.h"
#include <QskArcMetrics.h> #include <QskArcMetrics.h>
@ -72,7 +75,7 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
{ {
QRectF valueTextRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel ); QRectF valueTextRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel );
const QFontMetricsF fm( skinnable->effectiveFont( subControl ) ); const QFontMetricsF fm( skinnable->effectiveFont( subControl ) );
const qreal fontWidth = fm.width( QStringLiteral( "100 %" ) ); const qreal fontWidth = qskHorizontalAdvance( fm, QStringLiteral( "100 %" ) );
const QPointF center = valueTextRect.center(); const QPointF center = valueTextRect.center();
const QRectF rect( center.x() - fontWidth / 2, center.y() - fm.height() / 2, fontWidth, fm.height() ); const QRectF rect( center.x() - fontWidth / 2, center.y() - fm.height() / 2, fontWidth, fm.height() );
return rect; return rect;
@ -134,6 +137,7 @@ QSGNode* LightDisplaySkinlet::updateSubNode(
{ {
return updateBoxNode( skinnable, node, LightDisplay::Panel ); return updateBoxNode( skinnable, node, LightDisplay::Panel );
} }
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
case GrooveRole: case GrooveRole:
{ {
const QRectF grooveRect = display->subControlRect( LightDisplay::Groove ); const QRectF grooveRect = display->subControlRect( LightDisplay::Groove );
@ -156,6 +160,7 @@ QSGNode* LightDisplaySkinlet::updateSubNode(
return shadowNode; return shadowNode;
} }
#endif
case ColdAndWarmArcRole: case ColdAndWarmArcRole:
{ {
return updateArcNode( skinnable, node, LightDisplay::ColdAndWarmArc ); return updateArcNode( skinnable, node, LightDisplay::ColdAndWarmArc );
@ -209,7 +214,7 @@ QSizeF LightDisplaySkinlet::textLabelsSize( const LightDisplay* display ) const
{ {
const QFontMetricsF fm( display->effectiveFont( LightDisplay::LeftLabel ) ); const QFontMetricsF fm( display->effectiveFont( LightDisplay::LeftLabel ) );
qreal w = fm.width( QStringLiteral( " 100" ) ); qreal w = qskHorizontalAdvance( fm, QStringLiteral( " 100" ) );
qreal h = fm.height(); qreal h = fm.height();
return { w, h }; return { w, h };

View File

@ -4,7 +4,10 @@
*****************************************************************************/ *****************************************************************************/
#include "ShadowedBox.h" #include "ShadowedBox.h"
#include "nodes/BoxShadowNode.h"
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include "nodes/BoxShadowNode.h"
#endif
#include <QskBoxNode.h> #include <QskBoxNode.h>
#include <QskBoxBorderMetrics.h> #include <QskBoxBorderMetrics.h>
@ -47,6 +50,7 @@ namespace
switch ( nodeRole ) switch ( nodeRole )
{ {
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
case ShadowRole: case ShadowRole:
{ {
auto shadowNode = static_cast< BoxShadowNode* >( node ); auto shadowNode = static_cast< BoxShadowNode* >( node );
@ -65,6 +69,7 @@ namespace
return shadowNode; return shadowNode;
} }
#endif
case PanelRole: case PanelRole:
{ {
auto boxNode = static_cast< QskBoxNode* >( node ); auto boxNode = static_cast< QskBoxNode* >( node );

View File

@ -30,7 +30,6 @@ SOURCES += \
main.cpp \ main.cpp \
SOURCES += \ SOURCES += \
nodes/BoxShadowNode.cpp \
nodes/DiagramDataNode.cpp \ nodes/DiagramDataNode.cpp \
nodes/DiagramSegmentsNode.cpp \ nodes/DiagramSegmentsNode.cpp \
nodes/RadialTickmarksNode.cpp nodes/RadialTickmarksNode.cpp
@ -61,11 +60,19 @@ HEADERS += \
UsageDiagram.h UsageDiagram.h
HEADERS += \ HEADERS += \
nodes/BoxShadowNode.h \
nodes/DiagramDataNode.h \ nodes/DiagramDataNode.h \
nodes/DiagramSegmentsNode.h \ nodes/DiagramSegmentsNode.h \
nodes/RadialTickmarksNode.h nodes/RadialTickmarksNode.h
lessThan(QT_MAJOR_VERSION, 6) {
# the shader for the drop shadows has not yet been migrated
# to work with Qt 6
SOURCES += nodes/BoxShadowNode.cpp
HEADERS += nodes/BoxShadowNode.h
}
RESOURCES += \ RESOURCES += \
images.qrc \ images.qrc \
fonts.qrc \ fonts.qrc \