Business Data App

July 14, 2016 — 21 Comments

Work in Progress – wait for Tweet @ekkescorner

Overview

This is part 7 of a series of demo apps helping you to understand Qt 5.7 for x-platform development on Android and iOS. This app demonstrates some aspects of a Business App. Please read the blogs abvout my other Examples before:

  1. First app with One Page
  2. StackView
  3. SwipeView
  4. TabBar
  5. Bottom Navigation
  6. Drawer Navigation

xxxxxxxx

orderList

xxxxxxx

Sources

as usual at Github: https://github.com/ekke/biz_data_x

Summary

You learned ….xxxxxxx

Stay tuned for the next Example Apps …


← Back (Drawer Navigation App)

→ Next Article (Qt Con Conference APP)

⇐ Home (Overview / Topics)

21 responses to Business Data App

  1. 

    I would offer you to show database on mobile pages with simple SQL statemant as “SELECT * FROM Tablename;”. Could you think about that in future?🙂 Or do you prefer JSON data to save data.

    • 

      it depends. for some apps where it makes sense to use a in-memory-datamodel and with data < 50'000 records JSON is easy to use and fast. For larger datamodels, complex queries etc SQL works better. I already have an option in my entity-generator for SQL – but have to find the time to provide a good example. I'll enhance the QtWorldSummitConf App and use SQL to store previous conferences. Then I can demo and provide examples for both: JSON for actual conference and SQL for previous ones. you have to wait until december – have to finish some customer projects yet.

  2. 

    I’n trying to build this app ang getting some strange messages:
    — File: F:/PROJECTS8/build-biz_data_x-Android_for_armeabi_v7a_GCC_4_9_Qt_5_7_0-Release/android-build//bin/QtApp-debug.apk
    Warning: QML import could not be resolved in any of the import paths: org.ekkescorner.data
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Material.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Universal.impl
    15:13:34: The process “C:\Qt\5.7\android_armv7\bin\androiddeployqt.exe” exited normally.
    15:13:34: Elapsed time: 00:40.
    But running it on real Android device I can see app as Material designed normally or I cheated? Theme dark\light switched successfully.

  3. 

    I found a bug. I study some QML control features and get your sources to experiment.
    What I did. On OrderListPage.qml I changed code to replacing your switcher to SpinBox:
    // SwitchWithLeftLabel {
    // leftPadding: 12
    // rightPadding: 12
    // text: qsTr(“Express”)
    // checked: model.modelData.expressDelivery
    // onCheckedChanged: {
    // model.modelData.expressDelivery = checked
    // }
    // } // switch express
    SpinBox {
    id: goodsCountSpinBox
    leftPadding: 1
    rightPadding: 1
    value: 0
    implicitWidth: 120
    anchors.right: dataRow.right
    onValueChanged: {
    console.log(Qt.formatDateTime(new Date(), “dd.MM.yyyy hh:mm:ss “) + “SpinBox::onValueChanged: ” + goodsCountSpinBox.value)
    }
    }
    And run it on Android. When Spinbox try to change value clicked + or – the app freezes.
    Running on PC Windows is normal.
    Bug is causing when Material is on. When Material is off (commenting
    //qputenv(“QT_QUICK_CONTROLS_STYLE”, “material”);
    ), spinbox works good.

    I try Qt Example Gallery application in Material with Spinpox on page, it is works too, no bug.

    Screenshot here https://cloud.mail.ru/public/BdSB/ggPnVq2TM

    • 

      I found solution. Remove
      // leftPadding: 1
      // rightPadding: 1
      properties, just fun.

      • 

        there’s a bug in 5.7 where app freezed on Android (happened tapping very fast twice on list rows) – fixed in 5.8. perhaps same reason. will switch to 5.8 in a week or so. have to finish some customers projects before.

  4. 

    All graphics in images.qrc are you painted manually or generated or from some icon library?

    • 

      all Icons are from Google Material Style Guide Icons. https://material.io/icons/ But for each Icon there’s some work to match the naming scheme from Qt (and from my projects). I need from normal size up to @4 in black and white and sizes 18, 24 (default), 36, 48
      to provide all my Icons always my latest sample app (Qt World Summit in this cases) contains all Icons I’m current using.

  5. 

    Qt 5.8 is beta for a while, but I`ll try to switch to it too.

  6. 

    I try to use Sqlite db file in mobile apps from PC project. On Android it works, I did to deploy db into apk. It is specific for Android. But I don`t think it is same on ios-winphone devices. In apk db must be copied to assets.
    Yet another specific to work with Sqlite on Qml is showing image on listview delegate from Blob field. I read Qt manual for it. I think you would concern these questions described above in your future sample apps and lessons. It would be interesting.

  7. 
    Camilo del Real November 24, 2016 at 18:16

    Hi, I have been studying the demo applications that you have implemented. They have really been very helpful, I have learned techniques that are not learned by reading Qt help, especially the rapid loading of the application that is quite important to the consumer, at least visually. Thank you for the time you’ve spent for us.

    So, I have a question. Generally I have used QAbstractListModel to create C++ models and use them in QML, but in your implementation of the demo 7 Business Data App and the app for QtCon 2016 you have used QQmlListProperty. I have seen that many recommend both and within their particular characteristics I do not see anything concerning performance or advantages and disadvantages in particular cases.
    So my questions, Why did you neglect to use QQmlListProperty? Do you have any recommendations for using QAbstractListModel vs QQmlListProperty when using a model that will only be updated in C++?

    • 

      the only reason is that I didn’t found the time yet to implement QAbstractListModel😉
      coming from BlackBerry Cascades where I uses a GroupDataModel but nothing like this is out of the box here from Qt
      I generated all my code for Properties where I’m getting QQmlListProrty automagically.
      On my TODO is to implement something similar to Cascades GroupDataModel managing QObject* with grouping and sorting etc

      • 
        Camilo del Real November 24, 2016 at 19:50

        Thanks for the answer. I not associated with Cascades but the idea sound great.
        I will follow your blog with much interest

    • 

      I think that QQmlListProperty is class that allows applications to expose list-like properties to QML. Keyword is “list-like properties”.

      • 

        you can always use things a creative way😉 take a look at Qt World Summit COnference app – all datamodels are done using QQmlListProperties. A “real” QAbstractListModel” is more flexible, but needs some work to provide all I need to deal with QObject*. I always like to use QObject*

      • 
        Camilo del Real November 25, 2016 at 16:49

        QAbstractListModel provides the same but in another way. In fact, I have been testing both and QAbstractListModel offers facilities to manipulate sections of the data allowing to update sections of data that visually gives the advantage of only updating or creating the necessary components according to what is being seen in the UI (for that matter To use ListView ‘s GridView’s). I do not read in the QQmlListProperty documentation that there is some similar mechanism.
        I have already worked with QAbstractListModel several times and I feel very happy, but I was interested to see the opinion of developers with more experience about both as models since I have never worked with QQmlListProperty. Thanks for the answers

  8. 

    I’m generating all my Entity classes from a DSL (Xtext based) where for all 0..* references I got QQmlListProperty out of the box from my generator.
    this was my reason to start with QQmlListProperty
    In BlackBerry10 Cascades there are comfortable GroupDataModels https://developer.blackberry.com/native/reference/cascades/bb__cascades__groupdatamodel.html where I simply can use a List of QObject*
    In Qt I have to do some work to use a QAbstractListModel with QObject*
    (a great post on this here: http://www.embeddeduse.com/2013/08/10/practical-qml-exposing-qobject-subclasses-to-qml/)
    I started with Qt this year (before only used Cascades with another UI Controls Framework) and my first steps where to test the new Qt Quick Controls 2. Of course I also want to use a full featured QAbstractListModel – will try to implement the comfort from Cascades GroupDataModel. Unfortunately Cascades isn’t Open Source.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s