OverviewV-Play 1 SupportRepeating background › Reply To: Repeating background

OverviewV-Play 1 SupportRepeating background › Reply To: Repeating background

V-Play Team

This would be a little more flexible, but still having the possible stretch/collapse issue. The idea is that you provide the tileWidth and tileHeight to determine the number of tiles, just like in your code, but the actual tiles get adjusted a little bit (if needed) to fit in the available space.

Item {
      id: item
      property string imgSource
      property int tileWidth: 32
      property int tileHeight: 32

      Repeater {

        id: repeater
        property int rows: Math.round(item.height / item.tileWidth)
        property int cols: Math.round(item.width / item.tileHeight)
        property double rowWidth : item.width/cols
        property double colHeight : item.height/rows
        model: rows * cols

        Image {
          property int col: index % repeater.cols
          property int row: Math.floor(index / repeater.cols)
          x: repeater.rowWidth * col
          y: repeater.colHeight * row
          width: repeater.rowWidth//col < repeater.cols - 1 ? item.tileWidth : (item.width % item.tileWidth)
          height: repeater.colHeight//row < repeater.rows - 1 ? item.tileHeight : (item.height % item.tileHeight)
          source: item.imgSource
          z: -1



Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support