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. [solved] qobjectlist-based model: QString for QColor
Forum Updated to NodeBB v4.3 + New Features

[solved] qobjectlist-based model: QString for QColor

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 2.6k Views 1 Watching
  • 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
    spode
    wrote on last edited by
    #1

    see here: http://doc.qt.nokia.com/4.8/qdeclarativemodels.html#qobjectlist-based-model

    here the developer uses color: model.modelData.color, where color returns a qstring.
    why in my app i can not do the same thing?
    @
    ListView { id: list_parolaSalvate; x: 9; y: 130; width: 300; height: 489; clip: true; smooth: true; spacing: 3; model: parolemodello
    delegate: Rectangle {
    id: delegate_grafica; width: 300; height: 37; radius: 9; color: model.modelData.tipo
    Column
    {
    spacing: 4;
    Text { id: worttext; x: 18; y: 0; color: "black"; text: wort; font.bold: true; anchors.verticalCenterOffset: -10;
    anchors.horizontalCenterOffset: -127; font.pixelSize: 15; anchors.centerIn: parent }
    Text { id: deutschbeispiel; x: 18; y: 20; height: 28; color: "black"; text: beispiel; font.pixelSize: 12 }
    }
    MouseArea { anchors.fill: delegate_grafica; onClicked: gestore.visualizzaParola(index); }
    } }
    @

    @
    QString gettipo() const { return this->tipo; }
    void settipo(QString newtipo) { this->tipo = newtipo; }

    private:
    QString tipo;

    signals:
    void tipo_changed();
    @

    1 Reply Last reply
    0
    • S Offline
      S Offline
      spode
      wrote on last edited by
      #2

      solved: strings were words that are not color's names...

      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