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. Spinbox not fitting to rectangle, If it fits focus is missing
Forum Updated to NodeBB v4.3 + New Features

Spinbox not fitting to rectangle, If it fits focus is missing

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 277 Views
  • 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.
  • S Offline
    S Offline
    Shankar B
    wrote on last edited by
    #1

    Am able to set spinbox inside rectangle, Spinbox up and down arrow image looks enlarged and if I click on it, spinbox value is not changing.

    1 Reply Last reply
    0
    • MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by Markkyboy
      #2

      Post a snippet of working code if you want some help.

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Shankar B
        wrote on last edited by
        #3

        Rectangle{
        id:upperValue
        width:0.065 * widthValue
        height:0.086 * heightValue
        color: "gray"
        anchors{
        top: upperValue.top
        topMargin: 0.006 * heightValue
        bottom: upperValue.bottom
        }

        SpinBox{
            id:spinbox
            minimumValue: 0.2
            maximumValue: 39.0
            stepSize: 0.1
            decimals: 2
            anchors.fill:parent
        
            onEditingFinished: {
                upperValueTxt.visible = true
                upperValueTxt.text = spinbox.value
                spinbox.visible = false
            }
        }
        

        }

        1 Reply Last reply
        0
        • MarkkyboyM Offline
          MarkkyboyM Offline
          Markkyboy
          wrote on last edited by Markkyboy
          #4

          This code does not compile. Where are the import statements?, I have to assume you are using QtQuick.Controls 1.4 not Quick 2.

          It is important to give as much info as you can and where possible, learn how to paste it properly making it readable and repeatable for those reading/helping.

          You are using components that do not exist, where does 'widthValue' and 'heightValue' come from in Rectangle?

          Not forgetting the strange use of anchors, why are you trying to anchor the rectangle to the top of itself?, error after error.

          So, all you are wanting to do, is place SpinBox in a Rectangle?;

              Rectangle{
                  id: upperValue
                  color: "red"
                  width: 200
                  height: 100
                  anchors.centerIn: parent
          
                  SpinBox {
                      id:spinbox
                      minimumValue: 0.2
                      maximumValue: 40
                      stepSize: 0.2
                      decimals: 2
                      focus: true
                      anchors.centerIn: parent
                  }
              }
          }
          

          shankarb-image.JPG

          Don't just sit there standing around, pick up a shovel and sweep up!

          I live by the sea, not in it.

          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