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. cumulative value in tablewidget
Qt 6.11 is out! See what's new in the release blog

cumulative value in tablewidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 671 Views 3 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.
  • F Offline
    F Offline
    farhanrbn
    wrote on last edited by
    #1

    greetings all,

    i'm a student who just learned Qt.
    i got a project to build a program for warehouse data inventory. i use MySQL workbench in this project.

    so, i have this table preview
    0_1553063718670_62887741-a4d1-4263-9219-053b3f5b8beb-image.png

    everytime i input data on column "masuk" and "keluar" it just replace the value. I want every time I input data in the column "masuk" and "keluar, the value is added from the previous value and so on.

    if anyone knows the answer, i would be appriciate it

    K 1 Reply Last reply
    0
    • F farhanrbn

      greetings all,

      i'm a student who just learned Qt.
      i got a project to build a program for warehouse data inventory. i use MySQL workbench in this project.

      so, i have this table preview
      0_1553063718670_62887741-a4d1-4263-9219-053b3f5b8beb-image.png

      everytime i input data on column "masuk" and "keluar" it just replace the value. I want every time I input data in the column "masuk" and "keluar, the value is added from the previous value and so on.

      if anyone knows the answer, i would be appriciate it

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @farhanrbn

      That is not an issue of Qt. That need to be part of the logic behind where you define what has to be changed with some input to the table. This could be possibly done in MySQL or in the classes and objects you have programmed to bring up the information.
      AFAIK there is no direct help from Qt classes.
      Basically you can find out that something has been changed through a signal emitted by the field where you changed. In the associated slot you can have all the logic you want.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        If I understand your requirements correctly, you will have to implement a custom QStyledItemDelegate and modify the setModelData method to do the addition there.

        Be sure to also implement a custom editor so that it will be clear that you are doing something special on these columns. Otherwise your application users will be pretty surprised by the difference of behaviour between the different columns.

        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
        1

        • Login

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