Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML Contact Model Problem

QML Contact Model Problem

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 4.1k 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.
  • H Offline
    H Offline
    horxpig
    wrote on last edited by
    #1

    Hi everyone!

    I'm developing an application for N950 that must allow users to save new contacts in the address book, but when I try to use the ContactModel component it gives me an error.

    Here's the code I'm using:

    @

    ContactModel{
    id:cm
    }

    Contact{
    id: contactoNuevo
    Name {
    firstName: "Medico";
    lastName: variable1;
    }
    EmailAddress {
    emailAddress: variable2;
    }
    address.street: variable3;
    address.locality: "Ciudad de Mexico"
    address.country:"Mexico"
    PhoneNumber {
    number: variable4;
    }
    }

    Image{
    id:agregarBtn
    source: "imagenes/button.png"
    MouseArea{
    anchors.fill: parent
    onClicked: {
    cm.saveContact(contactoNuevo);
    }
    }
    }
    @

    And it throws this error:
    @
    libqtcontacts-tracker: contactsaverequest.cpp:1969: Save request prematurely failed for contact 1/1
    QSparqlConnection::exec: connection not open
    libqtcontacts-tracker: sparqlresolver.cpp:144: Connection not open
    libqtcontacts-tracker: contactsaverequest.cpp:2046: Cannot resolve local ids of saved contacts
    @

    Thanks in advance :)

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

      @import QtMobility.contacts 1.1@

      There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        horxpig
        wrote on last edited by
        #3

        [quote author="shoyeb" date="1329972133"]@import QtMobility.contacts 1.1@[/quote]

        I already did this, but now I noticed that it only fails when I`m debbuging my application, qhen I use it for real in my N950 it does create a new contact but it wont save any of the information I added to it in my QML :(

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kahon
          wrote on last edited by
          #4

          Hi,
          look at this:
          http://qt-project.org/forums/viewthread/13889

          Best,
          Fernando Moreno.

          1 Reply Last reply
          0
          • H Offline
            H Offline
            horxpig
            wrote on last edited by
            #5

            Hello, I already solved it by creating a custom QML element through C++ and the qmlRegisterType method. But thanks anyway :)

            [quote author="kahon" date="1339929061"]Hi,
            look at this:
            http://qt-project.org/forums/viewthread/13889

            Best,
            Fernando Moreno.[/quote]

            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