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 convert list<size> to list<string>?
Forum Updated to NodeBB v4.3 + New Features

How to convert list<size> to list<string>?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 586 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.
  • K Offline
    K Offline
    krokoziabla
    wrote on last edited by
    #1

    I want to make the result of Camera::supportedViewfinderResolutions() a model for a ComboBox. Simple assigning like

    myCombo.model = myCamera.supportedViewfinderResolutions()
    

    produces:

    ...
    my.qml:610:23: Unable to assign QJSValue to QString
    my.qml:610:23: Unable to assign QJSValue to QString
    my.qml:610:23: Unable to assign QJSValue to QString
    ...
    

    How do I do that properly?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      krokoziabla
      wrote on last edited by krokoziabla
      #2

      Well, I found a solution. Not sure if it's the best one.

      function foo()
      {
          myCombo.model = myCamera.supportedViewfinderResolutions().map(function(item, i, arr)
          {
             return item.width + "x" + item.height
          })
      }
      
      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