some Qt6 adustments for the iot-dashboard
This commit is contained in:
parent
3485709ea3
commit
bfe76356b8
|
@ -4,7 +4,6 @@ TEMPLATE = subdirs
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
desktop \
|
desktop \
|
||||||
gallery \
|
gallery \
|
||||||
iot-dashboard \
|
|
||||||
layouts \
|
layouts \
|
||||||
listbox \
|
listbox \
|
||||||
messagebox \
|
messagebox \
|
||||||
|
@ -12,6 +11,8 @@ SUBDIRS += \
|
||||||
thumbnails \
|
thumbnails \
|
||||||
tabview
|
tabview
|
||||||
|
|
||||||
|
lessThan(QT_MAJOR_VERSION, 6): SUBDIRS += iot-dashboard
|
||||||
|
|
||||||
qtHaveModule(svg) {
|
qtHaveModule(svg) {
|
||||||
|
|
||||||
# when checking in qvg files we could drop the svg dependency
|
# when checking in qvg files we could drop the svg dependency
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#include "Diagram.h"
|
#include "Diagram.h"
|
||||||
|
|
||||||
#include <QVectorIterator>
|
|
||||||
|
|
||||||
class Diagram::PrivateData
|
class Diagram::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <QskSetup.h>
|
#include <QskSetup.h>
|
||||||
#include <QskSkin.h>
|
#include <QskSkin.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
|
#include <QskFunctions.h>
|
||||||
|
|
||||||
#include <QFontMetricsF>
|
#include <QFontMetricsF>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
@ -149,11 +150,13 @@ void PieChartPainted::updateLayout()
|
||||||
m_progressBar->setContentsSize( size().toSize() );
|
m_progressBar->setContentsSize( size().toSize() );
|
||||||
m_progressBar->update();
|
m_progressBar->update();
|
||||||
|
|
||||||
auto rect = contentsRect();
|
const auto rect = layoutRect();
|
||||||
QFontMetricsF progressMetrics( m_progressLabel->effectiveFont( QskTextLabel::Text ) );
|
|
||||||
auto textWidth = progressMetrics.width( m_progressLabel->text() );
|
QFontMetricsF fm( m_progressLabel->effectiveFont( QskTextLabel::Text ) );
|
||||||
|
auto textWidth = qskHorizontalAdvance( fm, m_progressLabel->text() );
|
||||||
auto posX = rect.width() / 2 - textWidth / 2;
|
auto posX = rect.width() / 2 - textWidth / 2;
|
||||||
auto posY = rect.height() / 2 - progressMetrics.height() / 2;
|
auto posY = rect.height() / 2 - fm.height() / 2;
|
||||||
m_progressLabel->setPosition( {posX, posY} );
|
|
||||||
|
m_progressLabel->setPosition( { posX, posY } );
|
||||||
m_progressLabel->setFixedWidth( textWidth );
|
m_progressLabel->setFixedWidth( textWidth );
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <QskGraphicLabel.h>
|
#include <QskGraphicLabel.h>
|
||||||
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
QSK_SUBCONTROL( RoundedIcon, Panel )
|
QSK_SUBCONTROL( RoundedIcon, Panel )
|
||||||
QSK_SUBCONTROL( RoundedIcon, Icon )
|
QSK_SUBCONTROL( RoundedIcon, Icon )
|
||||||
|
|
|
@ -46,7 +46,13 @@ void DiagramDataNode::update( const QRectF& rect, Type type, const QColor& color
|
||||||
m_position = position;
|
m_position = position;
|
||||||
m_type = type;
|
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 );
|
m_geometry.setDrawingMode( drawingMode );
|
||||||
|
|
||||||
const int vertexCount = ( m_type == Line ) ? m_dataPoints.size() * 2 - 1 : m_dataPoints.size() * 2;
|
const int vertexCount = ( m_type == Line ) ? m_dataPoints.size() * 2 - 1 : m_dataPoints.size() * 2;
|
||||||
|
|
|
@ -10,7 +10,11 @@
|
||||||
DiagramSegmentsNode::DiagramSegmentsNode()
|
DiagramSegmentsNode::DiagramSegmentsNode()
|
||||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
: 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 );
|
m_geometry.setDrawingMode( GL_LINES );
|
||||||
|
#endif
|
||||||
|
|
||||||
setGeometry( &m_geometry );
|
setGeometry( &m_geometry );
|
||||||
setMaterial( &m_material );
|
setMaterial( &m_material );
|
||||||
|
|
Loading…
Reference in New Issue