PthinKS PthinKS Developer Forum forum.pthinks.com C++ • Qt • QML Engineering Community
PthinKS Engineering Q&A
forum.pthinks.com
Close
Qt

How should application settings be exposed from C++ to QML?

↗ Original Qt Forum discussion

A Qt Forum discussion asked how to manage application settings so that QML can read and change values while C++ performs persistent storage.

0 votes

1 Answer

DP
Dheerendra V Purohit
September 11, 2026 • Independent answer
✓ Accepted
Dheerendra recommended exposing a custom QObject-based settings class to QML. The class can wrap QSettings and publish values through Q_PROPERTY, keeping persistence details on the C++ side.
cpp
class AppSettings : public QObject {    Q_OBJECT    Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged)};
0 replies
Continue the discussion under Dheerendra V Purohit's answer. This reply remains inside this answer thread.
Optional reply code

Answer this Question

Each person can post an independent answer. To discuss a specific answer, use Reply to this answer under that answer.

Explain your own solution first; add reusable code if needed.

Optional code solution