Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Importing json in listwid with colored text & after clearing the listwid and importing new data an error is prompted
Forum Updated to NodeBB v4.3 + New Features

Importing json in listwid with colored text & after clearing the listwid and importing new data an error is prompted

Scheduled Pinned Locked Moved Solved Brainstorm
4 Posts 3 Posters 870 Views 2 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.
  • B Offline
    B Offline
    blossomsg
    wrote on last edited by blossomsg
    #1

    Hello,
    Past couple of days i have been trying to color text which are already imported in listwid

    1. i have created a json file in which all the data(dict) is stored
    2. i clear the existing data from the listwid, an error is prompted currently not the concern but still a point which needs to be fixed
    #   File "E:\Proj_Codes\NitinProj\vacuum_cleaner\vacuum_cleaner_delegate.py", line 47, in vacuum_cleaner_textedit_values
    #     self.vacuum_cleaner_listwid.currentItem().text())))
    # AttributeError: 'NoneType' object has no attribute 'text'
    

    and import the updated data in the wid
    3) so here is the issue after importing the new json data(dict) i want to show the wrong values in red and correct in green inside listwid
    i know "listwidgetitem" but after reading json file i have no clue how can i apply color to text
    This tool is for maya with pyside2

    vacuum_cleaner.py
    https://github.com/blossomsg/NitinProj.git

    suggestions would be great and with an example would be cherry on the cake

    Thank You.

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

      Hi,

      Check that the item returned by currentItem() is not None and continue your code only if it's the case.

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

      G 1 Reply Last reply
      0
      • B Offline
        B Offline
        blossomsg
        wrote on last edited by
        #3

        Hello,
        Thank you for your help

        i used ".disconnect" to disconnect the previous json and then import the new json file

        Thank You.

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Check that the item returned by currentItem() is not None and continue your code only if it's the case.

          G Offline
          G Offline
          GersonHdez
          Banned
          wrote on last edited by
          #4
          This post is deleted!
          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