Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Create custom widgets in QT like C#
Forum Updated to NodeBB v4.3 + New Features

Create custom widgets in QT like C#

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ras1364
    wrote on last edited by
    #1

    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.
    Thanks

    1 Reply Last reply
    0
    • O Offline
      O Offline
      olejl77
      wrote on last edited by
      #2

      Create a new .qml file in the project.

      The property will be available in the designer window.

      Example:
      @
      import QtQuick 2.0

      Rectangle {
      property string caption: "Text"

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

      }
      @

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        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.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0
        • R Offline
          R Offline
          ras1364
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved