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. qt.labs.controls - customizing Tumbler - Material
QtWS25 Last Chance

qt.labs.controls - customizing Tumbler - Material

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qt.labs.controlmaterial designandroid
5 Posts 2 Posters 2.6k 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.
  • E Offline
    E Offline
    ekkescorner
    Qt Champions 2016
    wrote on 16 Feb 2016, 12:20 last edited by
    #1

    I tried to customize the Tumbler.
    a) selected number with accent color and slightly larger font and something less spacing between values
    b) slightly larger font and at top and bottom of selected number a small line in accent color saimilar to TabButton

    a) got it working for color and font size, but didn't found out HowTo change the spacing

    Tumbler {
    	id: tumbler
    	model: 10
    	visibleItemCount: 5
    	delegate: Text {
    		property int displacement: Math.abs(Tumbler.displacement)
    			id: label
    			text: modelData
    			color: displacement == 1 ? Material.accentColor : "darkGray"
    			font: tumbler.font
    			scale: displacement == 1 ? 1.25 : 1.0
    			horizontalAlignment: Text.AlignHCenter
    			verticalAlignment: Text.AlignVCenter
    	}
    }
    

    any ideas HowTo change the space between the values ?

    b) have no idea HowTo draw the accent colored lines

    thx helping

    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
    5.15 --> 6.8 https://t1p.de/ekkeChecklist
    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

    E 1 Reply Last reply 16 Feb 2016, 20:19
    0
    • E ekkescorner
      16 Feb 2016, 12:20

      I tried to customize the Tumbler.
      a) selected number with accent color and slightly larger font and something less spacing between values
      b) slightly larger font and at top and bottom of selected number a small line in accent color saimilar to TabButton

      a) got it working for color and font size, but didn't found out HowTo change the spacing

      Tumbler {
      	id: tumbler
      	model: 10
      	visibleItemCount: 5
      	delegate: Text {
      		property int displacement: Math.abs(Tumbler.displacement)
      			id: label
      			text: modelData
      			color: displacement == 1 ? Material.accentColor : "darkGray"
      			font: tumbler.font
      			scale: displacement == 1 ? 1.25 : 1.0
      			horizontalAlignment: Text.AlignHCenter
      			verticalAlignment: Text.AlignVCenter
      	}
      }
      

      any ideas HowTo change the space between the values ?

      b) have no idea HowTo draw the accent colored lines

      thx helping

      E Offline
      E Offline
      ekkescorner
      Qt Champions 2016
      wrote on 16 Feb 2016, 20:19 last edited by
      #2

      @ekkescorner any ideas or hints ? - thx

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.8 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jpnurmi
        wrote on 16 Feb 2016, 20:26 last edited by
        #3

        It sounds like you would have to replace the builtin contentItem, which is a PathView. You could copy the one from http://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/imports/controls/material/Tumbler.qml and use it as a starting point and tweak the path to your needs.

        E 2 Replies Last reply 16 Feb 2016, 20:33
        0
        • J jpnurmi
          16 Feb 2016, 20:26

          It sounds like you would have to replace the builtin contentItem, which is a PathView. You could copy the one from http://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/imports/controls/material/Tumbler.qml and use it as a starting point and tweak the path to your needs.

          E Offline
          E Offline
          ekkescorner
          Qt Champions 2016
          wrote on 16 Feb 2016, 20:33 last edited by
          #4

          @jpnurmi thx for the hint.
          then at first I have to learn what a PathView is ;-)

          ekke ... Qt Champion 2016 | 2024 ... mobile business apps
          5.15 --> 6.8 https://t1p.de/ekkeChecklist
          QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

          1 Reply Last reply
          0
          • J jpnurmi
            16 Feb 2016, 20:26

            It sounds like you would have to replace the builtin contentItem, which is a PathView. You could copy the one from http://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/imports/controls/material/Tumbler.qml and use it as a starting point and tweak the path to your needs.

            E Offline
            E Offline
            ekkescorner
            Qt Champions 2016
            wrote on 16 Feb 2016, 21:48 last edited by
            #5

            @jpnurmi thx again
            only had to change the implicitHeight:

            Tumbler {
                id: tumbler
                model: 10
                visibleItemCount: 5
                implicitHeight: visibleItemCount * 24
                delegate: Text {
                    property int displacement: Math.abs(Tumbler.displacement)
                    id: label
                    text: modelData
                    color: displacement == 0 ? Material.primaryTextColor : Material.secondaryTextColor
                    font: tumbler.font
                    scale: displacement == 0 ? 1.20 : 1.0
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                }
            }
            

            while flicking the tumbler there's a noticable delay before only the selected number will be scaled,
            but I can live with this.

            ekke ... Qt Champion 2016 | 2024 ... mobile business apps
            5.15 --> 6.8 https://t1p.de/ekkeChecklist
            QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

            1 Reply Last reply
            0

            1/5

            16 Feb 2016, 12:20

            • Login

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