I hope this email finds you well. I am writing to discuss a function that
we are currently using in our QML codebase to apply scalability. While the
function serves its purpose, we have identified some areas where it can be
optimized to avoid multiple function calls from C++.

Our goal is to reduce the repetitive function calls made from C++ to
enhance the performance of our application

"theme.h" Theme::Theme() { refDpi = 96.; refHeight = 600.; refWidth =
1024.; rect = QGuiApplication::primaryScreen()->geometry(); qDebug()<<rect;
height = rect.height(); width = rect.width(); dpi =
QGuiApplication::primaryScreen()->logicalDotsPerInch(); qDebug()<<dpi;
m_hratio = height/refHeight; m_wratio = width/refWidth; m_ratioFont =
qMin(height*refDpi/(dpi*refHeight), width*refDpi/(dpi*refWidth)); } int
Theme::applyFontRatio(const int value) { return int(value * m_ratioFont); }
int Theme::applyHeightRatio(const int value) { return qMax(2, int(value *
m_hratio)); } int Theme::applyWidthRatio(const int value) { return qMax(2,
int(value * m_wratio)); }

main.qml import QtQuick 2.15 import QtQuick.Window 2.15 import
QtQuick.Controls 2.5 import QtQuick.Layouts 1.3 ApplicationWindow {
id:mainWindow width: owner.applyWidthRatio(909,"Width for Region3(register
page)") height: owner.applyHeightRatio(802,"Width for Region3(register
page)") visible: true
}

Thanks,
Poonam
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to