some Qt6 adustments for the iot-dashboard

This commit is contained in:
Uwe Rathmann 2021-04-26 08:38:10 +02:00
parent 3485709ea3
commit bfe76356b8
6 changed files with 22 additions and 9 deletions

View File

@ -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

View File

@ -5,8 +5,6 @@
#include "Diagram.h"
#include <QVectorIterator>
class Diagram::PrivateData
{
public:

View File

@ -38,6 +38,7 @@
#include <QskSetup.h>
#include <QskSkin.h>
#include <QskTextLabel.h>
#include <QskFunctions.h>
#include <QFontMetricsF>
#include <QGuiApplication>
@ -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 );
}

View File

@ -37,6 +37,7 @@
#include <QskGraphicLabel.h>
#include <QImage>
#include <QFile>
QSK_SUBCONTROL( RoundedIcon, Panel )
QSK_SUBCONTROL( RoundedIcon, Icon )

View File

@ -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;

View File

@ -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 );