Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Right way to hold and manage a lot of data

Right way to hold and manage a lot of data

Scheduled Pinned Locked Moved Unsolved General and Desktop
right waydatamanagment
6 Posts 3 Posters 1.9k 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.
  • R Offline
    R Offline
    RegineerCZ
    wrote on 30 Oct 2015, 14:17 last edited by
    #1

    Hello,
    I'm here to ask for advice in my development.
    What im trying to make is an app that will connect to device (BLE device) and will send message to it and receive response from it. This device is actually a bridge between a communication for luminaires and my application.

    I need a way of holding all data from these luminaires, setting these data and if they change, producing signals (individual for each device and each value) which will connect to slots of widget on screen. So in example if user is looking at screen with like, actual level of certain luminaire, and this value changes, i need to change it on screen as well.

    What i did is i created my own object called DaliDevice. This object inherits from QObject, and it holds all data, it has functions for each of these data to be set (which sends an emit valueXYZChanged() signal.
    Then i created a QList<DaliDevice> * deviceList inside my Communication object. Which handles connection and sending and receiving data for me, also inherits from QObject.
    I also created a pointer to this object inside my window header file, Communication * communicationHandler

    What i tried then is to call a function inside one of these DaliDevices. I did following:

    DaliDevice device = communicationHandler->deviceList.at(0);
    device.foo();

    I got error on deviceList.at(0), saying "use of deleted function DaliDevice::DaliDevice(const DaliDevice&)"

    Does anybody here knows better way of doing such a communication? Or what is the problem with my code?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      ttuna
      wrote on 30 Oct 2015, 15:07 last edited by
      #2

      Maybe you should try to hold a pointer to DaliDevice in your QList.
      Or implement a copy constructor for DaliDevice... ;-)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 30 Oct 2015, 23:03 last edited by
        #3

        Hi and welcome to devnet,

        @ttuna: bad idea, QObject are not http://doc.qt.io/qt-5/qobject.html#no-copy-constructor-or-assignment-operator

        But the first solution is correct: use a QList<DaliDevice*> or QVector<DaliDevice *>. Note that you don't need to allocate deviceList on the heap.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        T 1 Reply Last reply 31 Oct 2015, 08:42
        0
        • S SGaist
          30 Oct 2015, 23:03

          Hi and welcome to devnet,

          @ttuna: bad idea, QObject are not http://doc.qt.io/qt-5/qobject.html#no-copy-constructor-or-assignment-operator

          But the first solution is correct: use a QList<DaliDevice*> or QVector<DaliDevice *>. Note that you don't need to allocate deviceList on the heap.

          T Offline
          T Offline
          ttuna
          wrote on 31 Oct 2015, 08:42 last edited by
          #4

          @SGaist Maybe you missed the little smiley on this hint ... ;-)

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 31 Oct 2015, 20:45 last edited by
            #5

            No I didn't, but I can assure you that written second degree doesn't work as well as spoken ;-)

            And I've already saw code implementing them… So I avoid the risk of misguiding people

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • T Offline
              T Offline
              ttuna
              wrote on 1 Nov 2015, 14:39 last edited by
              #6

              Sorry, my fault ... I will hold back this inner ironic imp in the future.

              1 Reply Last reply
              0

              4/6

              31 Oct 2015, 08:42

              • Login

              • Login or register to search.
              4 out of 6
              • First post
                4/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved