Giter Club home page Giter Club logo

Comments (25)

Liskelleo avatar Liskelleo commented on July 20, 2024 1

Np ;)

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

Hello :)

First one takes a lot of time to do it, since we cannot get the updated value from the qtreewidgetitem.

i can't make it by making child class of qtreewidgetitem to add the signal because qtreewidgetitem is not from qobject.

So rename something at once needs a different method. I give you this though: self.selectionItems()

Second one is thankfully working well by using recursive function. You can just clone my recent repository to check that out.

Third one is.. i can't fully understand what you said so i need more information. I assume the thing you want to save is QTreeWidget's hierarchy, but what kind of form do you want to convert it into?

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

First one is just a matter of time. I didn't take much time to do it so i have to check it out once more.

Second one is.. i don't know. Could you clarify for me again? I understand your second request as "make it unable to change the QTreeWidgetItem's name if it has at least one child".

You have to check the checkbox next to the QTreeWidget to make it work. UI is updated but i've not updated in my README.md

I got the third one so it can be done with dictionary or other method and i can save it with hierarchy.ini or something like that with QSettings.

I will check those things out next day. I'm currently busy :)

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

I found that second one was working but it was actually flawed, So i've just fixed it. Check it out

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

OK, for the first one:

image

I've somehow never got your request in the first place, i thought you've said that you want to change multiple "items", not columns.

Why did i miss that point? silly me.

OK, i assume this is the point of what you've said.

So, how to make it editable more than one single column? Actually you can click manually to change it. But that is not obviously you want to hear.

Pressing enter from the first column to focus on the second column is on my mind, but sorry to say the demand is kinda abstract. I need your purpose(doesn't need to be detailed) to do so or similar application which can operate like that as an example.

I'm working on third one. btw

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

No problem 👌🙂

I've just completed the third one. Keep in mind, it won't work if there are at least two items shared the same name in the same hiearchical level. Because i convert the QTreeWidget into Python dictionary to save it and dictionary doesn't allow to save the multiple keys.

I got that! Then i need to add the multiple columns in case of the people who need that. That actually can significantly change the second and third one. But i hope that's not the case.

I cannot do it right away. please wait :)

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

Good to hear, thanks to the compliment. You can still feel free to ask something to me if those functions are not enough. I personally keep it as well. 🙂

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

So if you’ve done the rest part of the work in your spare time, don’t hesitate to let me know. Best wishes!

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

Oops, when I cloned your recent repository to check, something went wrong for the first run:

Traceback (most recent call last):
  File "C:\Users\***\Desktop\editableTreeWidgetExample.py", line 248, in <module>
    example = MainWindow()
  File "C:\Users\***\Desktop\editableTreeWidgetExample.py", line 133, in __init__
    self.__initUi()
  File "C:\Users\***\Desktop\editableTreeWidgetExample.py", line 174, in __initUi
    self.__load()
  File "C:\Users\***\Desktop\editableTreeWidgetExample.py", line 210, in __load
    data = eval(self.__settings_struct.value('dict'))
TypeError: eval() arg 1 must be a string, bytes or code object

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

That was simple. The error occurs because the given argument of the eval was "None" since there is no ini file or dict attribute at all at the first time.

I should've checked that as well. Now it works

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

Hi, there. So now the hierarchy of this widget can be saved in terms of dictionary, and I wonder how to preset some FIXED items which can't be renamed? Which means that the rest items can be created and modified freely by users and those fixed ones always remain the same once they were preset.

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

I changed up a bit.

The FIXED(which means should not be able to be renamed) property is now saved as well.

You can even fix certain item in the context menu.

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

Okay, I've checked your update and it works out fine. Thx^^

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

yup :)

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

Current week is really busy 😅. I will take care of it this weekend!

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

No hurry then;)

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

It seems that this project's almost complete. Just three point of my views:

  1. The first is about the "ExtendedSelection" mode, which should be adapted to the function of deleting items, that means that when getting more than one item that selected by users under the "ExtendedSelection" mode, users can press delete key to delete them all instead of deleting the first item of all selected items.
  2. It seems that the "KeyBindingWidget" can not be displayed correctly on my computer like this, I wonder whether you have frozen the widget due to this fuction is still under testing.
  3. Still wonder about your "Allow duplicated name" mode, could you please give me some introdution of this function?
    image

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

Sorry for my belated reply 😥 It's been a while :)

step by step answer:

  1. I fixed it. I tested it very loosely though..
  2. That is indeed under testing. Because of that, it is disabled so you can't change the key command or scroll it.
  3. "Allow duplicated names" indicates that attributes with the same name can exist at the same level of the tree. It must be confusing to someone that the attributes carrying the same name exists.

I've been very busy cause the deadline of my company project is near and some of my personal project, but i will definitely check that out soon enough.

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

Thanks a lot for your patient reply, even though you are fully engaged presently :)
The last two points are clear enough for me now, however, there might be a little problem in the first point: when getting currentItem() as 'NoneType' object under the multi-seletion mode, it may raise AttributeError: 'NoneType' object has no attribute 'addChild'. So I've just modified it as below ;)

    def addChildAttr(self, text=None):
        text = 'New Attr' if not text or isinstance(text, bool) else text
        item = EditableTreeWidgetItem()
        item.setText(0, text)
        item.setFlags(item.flags() | Qt.ItemIsEditable)
        if self.currentItem() is not None:  # add a judging statement
            self.currentItem().addChild(item)
            self.setCurrentItem(item)
            self.editItem(item, 0)
            if self.__parentItemShouldNotChangedFlag:
                item.parent().setFlags(item.flags() & ~Qt.ItemIsEditable)

Btw, no need to hurry and best wishes!

from pyqt-editable-treewidget-example.

yjg30737 avatar yjg30737 commented on July 20, 2024

that's great one, thanks for that :)

from pyqt-editable-treewidget-example.

Liskelleo avatar Liskelleo commented on July 20, 2024

So far so good, any new updates may help in the future.

from pyqt-editable-treewidget-example.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.