Results 1 to 6 of 6

Thread: Problem with LocalStorage

  1. #1
    Join Date
    Mar 2015
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Problem with LocalStorage

    Hello,
    I started using Qt and I have a project in which I have to use LocalStorage. I dont know how exactly it works.
    I checked this page: [http://doc.qt.io/qt-5/qtquick-locals...qmlmodule.html ](link url)
    but I still dont know how to use it in bigger project.
    For example how to write my own function that returns a row and use it in other file.qml

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with LocalStorage

    What exactly is the problem?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2015
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Problem with LocalStorage

    @Wysota
    I am gonna write in polish, couse it will be easier to describe problem.
    Chodzi o to, że muszę muszę pracować z tym LocalStorage. Chciałbym zrobic w jednym pliku qml funkcje, a w innym wywolywac je wywolywac, np DodajDoBazy(argumenty), a w innym np onClicked: DodajDoBazy(). I nie weim jak w innym pliku odnosic sie do tych funkcji. Czy mozna zrobic to w jakis lepszy sposob? Nie wiem tez za bardzo jak uzyc localStorage w liscie? Np ze lista ma godziny 00:00 do 23:00 i w niektore godziny jest jakies zdarzenie, a w inne nie, zrobilem przycisk filtruj, zeby wyswietlalo TYLKO godziny w ktorych cos jest i nie weim za bardzo jak to zrobic na liscie, czy jest jakas opcja visible czy co.

    EDIT:
    OK. I want to create functions in a .qml file and use these functions in other file, e.g. AddToDB() nad in other file onClicked: AddToDB() (Now how to call this function??) Is there any other way to do this?
    Second thing is that I dont really know how to use LocalStorage in ListModel. Eg. I have hours 00:00 - 23:00 and things to do on some of them. I created the button and I want it to filter ONLY the hours with things to do.
    Last edited by witusx93; 20th April 2015 at 19:11.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with LocalStorage

    Quote Originally Posted by witusx93 View Post
    @Wysota
    I am gonna write in polish, couse it will be easier to describe problem.
    It is an English-spoken site. If everyone used their native language just because there is one other person who understands it we would have to integrate Google Translate into the site. I understand it is easier for you to ask in Polish but please try translating your question to English.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2015
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Problem with LocalStorage

    Ok, edited my post

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with LocalStorage

    Quote Originally Posted by witusx93 View Post
    @Wysota
    I am gonna write in polish, couse it will be easier to describe problem.
    Chodzi o to, że muszę muszę pracować z tym LocalStorage. Chciałbym zrobic w jednym pliku qml funkcje, a w innym wywolywac je wywolywac, np DodajDoBazy(argumenty), a w innym np onClicked: DodajDoBazy(). I nie weim jak w innym pliku odnosic sie do tych funkcji. Czy mozna zrobic to w jakis lepszy sposob? Nie wiem tez za bardzo jak uzyc localStorage w liscie? Np ze lista ma godziny 00:00 do 23:00 i w niektore godziny jest jakies zdarzenie, a w inne nie, zrobilem przycisk filtruj, zeby wyswietlalo TYLKO godziny w ktorych cos jest i nie weim za bardzo jak to zrobic na liscie, czy jest jakas opcja visible czy co.

    EDIT:
    OK. I want to create functions in a .qml file and use these functions in other file, e.g. AddToDB() nad in other file onClicked: AddToDB() (Now how to call this function??) Is there any other way to do this?
    Second thing is that I dont really know how to use LocalStorage in ListModel. Eg. I have hours 00:00 - 23:00 and things to do on some of them. I created the button and I want it to filter ONLY the hours with things to do.
    You can create a library of functions (with ".pragma library") and then import the script file whenever you want and simply call those functions from whereever you need. Regarding the list model, I have no idea how you would want to use LocalStorage there. ListModel is a crude container for simple item data, if you really have to, you can of course insert data to the model when you need it but that is it. It is much better to implement your model in C++ (e.g. using QtSql module) and then export the objects you need (the model itself and maybe a filter proxy model) to QML.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.