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 \
mycontrols \
thumbnails \
tabview
lessThan(QT_MAJOR_VERSION, 6) {
# the shader for the drop shadows has not yet been migrated
# to work with Qt 6
SUBDIRS += iotdashboard
}
tabview \
iotdashboard
qtHaveModule(svg) {

View File

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

View File

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

View File

@ -30,7 +30,6 @@ SOURCES += \
main.cpp \
SOURCES += \
nodes/BoxShadowNode.cpp \
nodes/DiagramDataNode.cpp \
nodes/DiagramSegmentsNode.cpp \
nodes/RadialTickmarksNode.cpp
@ -61,11 +60,19 @@ HEADERS += \
UsageDiagram.h
HEADERS += \
nodes/BoxShadowNode.h \
nodes/DiagramDataNode.h \
nodes/DiagramSegmentsNode.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 += \
images.qrc \
fonts.qrc \