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. QLineEdit/CheckBox/etc with a model for data?
Forum Updated to NodeBB v4.3 + New Features

QLineEdit/CheckBox/etc with a model for data?

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

    Hey

    Uhh this one has been bothering me for a long while. Essentially I'd like to configure my widgets to receive data from and to central location. The main issue I have is that I can have as many widgets as user wants representing given "data" so if one widget is being updated, then all others should as well. I wonder if qt overs anything like that, or has a signals that I can use to build it up ? Or it will be mostly custom job?

    Something like.... QGraphicsScene or QAbstractItemModel. Where any view using the model gets update info to redraw when user does stuff?

    Regards
    Dariusz
    TIA

    raven-worxR 1 Reply Last reply
    0
    • D Dariusz

      Hey

      Uhh this one has been bothering me for a long while. Essentially I'd like to configure my widgets to receive data from and to central location. The main issue I have is that I can have as many widgets as user wants representing given "data" so if one widget is being updated, then all others should as well. I wonder if qt overs anything like that, or has a signals that I can use to build it up ? Or it will be mostly custom job?

      Something like.... QGraphicsScene or QAbstractItemModel. Where any view using the model gets update info to redraw when user does stuff?

      Regards
      Dariusz
      TIA

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Dariusz said in QLineEdit/CheckBox/etc with a model for data?:

      Something like.... QGraphicsScene or QAbstractItemModel. Where any view using the model gets update info to redraw when user does stuff?

      you can write a generic wrapper which listens to a QPersistentModelIndex and emits a signal whenever the dataChanged() signal for that index is triggered. If thats the case the wrapper can emit another signal. The target widget then can connect to this signal and update it's value accordingly. Then you can reuse the wrapper implementation for any widget.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      D 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @Dariusz said in QLineEdit/CheckBox/etc with a model for data?:

        Something like.... QGraphicsScene or QAbstractItemModel. Where any view using the model gets update info to redraw when user does stuff?

        you can write a generic wrapper which listens to a QPersistentModelIndex and emits a signal whenever the dataChanged() signal for that index is triggered. If thats the case the wrapper can emit another signal. The target widget then can connect to this signal and update it's value accordingly. Then you can reuse the wrapper implementation for any widget.

        D Offline
        D Offline
        Dariusz
        wrote on last edited by Dariusz
        #3

        @raven-worx said in QLineEdit/CheckBox/etc with a model for data?:

        @Dariusz said in QLineEdit/CheckBox/etc with a model for data?:

        Something like.... QGraphicsScene or QAbstractItemModel. Where any view using the model gets update info to redraw when user does stuff?

        you can write a generic wrapper which listens to a QPersistentModelIndex and emits a signal whenever the dataChanged() signal for that index is triggered. If thats the case the wrapper can emit another signal. The target widget then can connect to this signal and update it's value accordingly. Then you can reuse the wrapper implementation for any widget.

        Oh humh, I dont want to connect to the model systems of treeviews/graphicsScenes, I'm looking for a standalone one for qlineedit/checkbox/radio button etc etc. But the more I think of it I think I might need to write my own class for it whh or at least a "signal" "manager".

        Something like

        connect(this,&QLineEdit::textChanged,={widgetSignalManager::lineEditTextChanged(this, dataId,widgetKey, textOld,textNew)})

        connect(widgetSignalManager, &widgetSignalManager::lineEditTextChanged,={if(widget!=this){if(widgetDataId==dataId){setText(textNew)}})

        And then on widgetSignalManager I can emit that to any listening widgets as well as find the member objects that holds the map with the data to update it... hmmmmmmmmmmm o.O

        something like this o.O oh dear.... this is gonna be "fun" ;- )

        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