some Qt6 adustments for the iot-dashboard
This commit is contained in:
parent
3485709ea3
commit
bfe76356b8
@ -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
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
#include "Diagram.h"
|
||||
|
||||
#include <QVectorIterator>
|
||||
|
||||
class Diagram::PrivateData
|
||||
{
|
||||
public:
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <QskGraphicLabel.h>
|
||||
|
||||
#include <QImage>
|
||||
#include <QFile>
|
||||
|
||||
QSK_SUBCONTROL( RoundedIcon, Panel )
|
||||
QSK_SUBCONTROL( RoundedIcon, Icon )
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user