Skip to content
  • 0 Votes
    7 Posts
    1k Views
    X

    @sierdzio Many thanks!

  • 0 Votes
    14 Posts
    2k Views
    JonBJ

    @SpaceToon I might worry at 20,000, but not at 20 :)

  • 0 Votes
    7 Posts
    619 Views
    T

    Okay, I have solved the problem with a workaround: In the code for my development board I added a new line character after every value.
    Then, in my Qt code I check every time the SLOT is called if the value does have a new line char.
    Either the value is saved in another variable until it receives a value with a new line character or it is output immediately (if it has a new line character).

    static QString newValue= ""; void MainWindow::updateData(const QLowEnergyCharacteristic &c,const QByteArray &value) { newValue = newValue + (QString)value; if (newValue.contains("\n") || newValue.contains("\r")){ ui->dataList->addItem(newValue.simplified()); ui->dataList->scrollToBottom(); newValue = ""; } }
  • 0 Votes
    2 Posts
    350 Views
    IntruderExcluderI

    If data at that models is uniform it is better to have 1 model and change its data. Anyway, JS arrays can be used as models too, so you can have array of arrays.

  • 0 Votes
    6 Posts
    2k Views
    VRoninV

    @elfring said in Support for multi-index containers?:

    Would you like to distinguish any more between the usage of one- and two-dimensional structures for data models?

    Nope, the 2 dimensional structure is strictly more general of the 1D version so anything that goes for the first works in the second case.

    beginRant();

    You have been discussing a lot of theoretical problems relating to models across different threads. In all of them the feeling has been that you are uselessly overcomplicating things.
    I feel it would be useful for you and easier for us to walk you through a concrete example of what you are trying to achieve rather than discuss endlessly on theoretical concepts.

    endRant();
  • 0 Votes
    4 Posts
    3k Views
    6thC6

    Well, there is some it seems... just not all? I note there's quite a few comments: // ECMAScript 6 @: http://doc.qt.io/qt-5/qtqml-javascript-functionlist.html

    While I've not used it - that page has:
    map(callbackfn [, thisArg])
    but not Set.. not sure if that helps...

  • 0 Votes
    3 Posts
    1k Views
    M

    @medyakovvit exactly what I need! Thanks a lot

  • 0 Votes
    2 Posts
    990 Views
    H

    I have found a solution.
    I have to create first my object column. Then I can create "children" :

    Item { id:previewInfo property variant dataCurrentItem: myApp.searchResult.length>0 ? myApp.searchResult[listResult.currentIndex] : "" Component { id:simpleComponent Text{ wrapMode: Text.WordWrap; font.pixelSize: 21; } } Component { id: columnComponent Column { id:myColumComposed width:200; function addText(data){ if(data) { simpleComponent.createObject(myColumComposed,{"text":data}); } } } } Column { id: mainColumn width: parent.width; height:parent.height spacing:20 } onDataCurrentItemChanged: { for(var i=0; i<mainColumn.children.length; ++i) { mainColumn.children[i].destroy() } if(dataCurrentItem) { if(dataCurrentItem.data1) { simpleComponent.createObject(mainColumn,{"text":data1}); } if(dataCurrentItem.data2) { simpleComponent.createObject(mainColumn,{"text":data2}); } var objectColumn = columnComponent.createObject(mainColumn); objectColumn.addText("data3"); objectColumn.addText("data4"); } } }
  • 0 Votes
    2 Posts
    992 Views
    Chris KawaC

    In general no. QList is not really a linked list (QLinkedList is). It is a sorta vector-list hybrid that allocates chunks of the data as contiguous arrays. How many chunks there are, what is their overhead size, does it hold pointers to elements or optimizes small sized items by holding them in place, what is the alignment overhead - these are all implementation details that affect the size and there's no reliable way to estimate them, or even if you did, they might change in future versions.

  • 0 Votes
    3 Posts
    2k Views
    TheBadgerT

    Thanks I was expecting as much.
    Also thanks for the code, I will probably replace my foreach with something similar.