Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to put borders for a camera preview in QML
Forum Updated to NodeBB v4.3 + New Features

How to put borders for a camera preview in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 827 Views 2 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by
    #1

    Hi,

    I have a query, how can we put border for an Camera in QML.

    Thanks,

    Pradeep Kumar
    Qt,QML Developer

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! Just place the video output on top of a rectangle:

      import QtQuick 2.7
      import QtQuick.Controls 2.0
      import QtQuick.Layouts 1.0
      import QtMultimedia 5.6
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Rectangle {
              id: rect
              width: 300
              height: 200
              color: "red"
              border.color: "red"
              border.width: border_width
              radius: border_width
      
              property int border_width: 10
      
              Camera {
                  id: camera
              }
      
              VideoOutput {
                  id: videoOutput
                  source: camera
                  width: parent.width - rect.border_width*2
                  height: parent.height - rect.border_width*2
                  anchors.centerIn: rect
              }
          }
      }
      
      
      
      1 Reply Last reply
      2
      • Pradeep KumarP Offline
        Pradeep KumarP Offline
        Pradeep Kumar
        wrote on last edited by Pradeep Kumar
        #3

        Hi @Wieland

        Thanks , it is working.
        I am customizing your application so i can get dotted borders and at cornered gets highlighted.

        https://www.google.co.in/search?q=dotted+cornered+images&espv=2&biw=1309&bih=651&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjwmY2unZnQAhWKOo8KHQiRAQEQ_AUIBigB#imgrc=q8vaPeDsNyCnOM%3A

        Similar to the above link image.

        Thanks,

        Pradeep Kumar
        Qt,QML Developer

        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