Important: Please read the Qt Code of Conduct -

Create custom widgets in QT like C#

  • hi, my name is Reza and i'm new in Qt.
    I wanted to learn how to create a custom widget From Zero to a Hundred And also how to write the property in its that can be accessed through the designer window.

  • Create a new .qml file in the project.

    The property will be available in the designer window.

    import QtQuick 2.0

    Rectangle {
    property string caption: "Text"

    width: 100
    height: 100
    Text {
        anchors.centerIn: parent
        text: caption


  • Qt Champions 2017

    Do you want this in Qt or QML ? If you working with Qt look at Analog Clock example in Qt Assistant. It will give you good details. In order to write your widget, you need to inherit from QWidget and implement paintEvent(...) method. If you want to make it available in Designer, you need to write Designer Plugin for the same. Refer the Writing Qt Designer Plugins.

  • thanks Dheerendra,
    I want to have access to the property through the design Mode.
    Can you give me a sample or video that I know better , please.

Log in to reply