问题标签 [qtreewidgetitem]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 输入新值后如何获取 qtreewidgetitem 的新值
我创建了一个 treewidget,并添加了一些可编辑的 treewidgetitems。
我现在的目标是在输入项目后捕捉它的新价值。
这是代码:
设置“editItem”后,我可以在界面上输入 manuel 新值。我需要的是在按下“enter”键后能够捕捉到新值。当项目变为可编辑时,名称为“新建文件夹”,文本被选中,我输入一个新名称,例如“blabla”,然后按 Enter。
我需要抓住“blabla”。我试过使用下面的代码:
但 utf8_text 报告“新文件夹”而不是“blabla”
任何想法 ?
c++ - 如何与 TreeView 共享数据,例如 gtk_list_store
我在 Qt/C++ 中使用 TreeView 管理应用程序
为了不混合文件系统访问和窗口/UI 管理,我确实创建了一个 C++ 代码,它管理与 FileSystem 交互和一个负责显示树的 C++ 类
我看到 Gtk 有一个
C++ / Qt 中是否有任何等价物?
我要做的是能够使用来自文件系统端的 API 或方法来归档 TreeWidgetItem,而显示树部分只需要读取这个值。
任何想法如何正确地做到这一点?
我正在考虑在 FileSystem 的代码中实例化 TreeWidget 类,但我想让它更智能。
FileSystem 文件树视图模型和 ui 读取此模型。
谢谢你的帮助
c++ - qtreewidgetitem expand action
I have currently design an interface using TreeWidgetItems.
I have connected some actions depending on what i want to do. such as below
the itemClicked is working fine but I'm not able to catch event when I'm expanding a item.
itemClicked is generated as soon as we click but itemExpanded seems only reacting when we expand the specified item.
I need to generate this signal as soon as I'm trying to expand without need to specify the item. What I'm looking for is something like itemClicked which give you which item has been clicked. when accessing to Interface, and expand the item, I want to generate the signal and get the item which has been expanded.
Any idea to avoid the "This signal is emitted when the specified item is expanded so that all of its children are displayed." and have "This signal is emitted when the any item is expanded so that all of its children are displayed."
c++ - Char* 在尝试获取/设置时损坏
我曾经基于 treewidget 在我的应用程序中添加一个功能。
当右键单击一个项目时,我可以在使用 USB 的 FS 上创建一个文件夹。
这主要是说,当在 TreeWidget 上选择一个项目时,我得到它的名称并检查它是否是一个文件夹,如果是,我创建一个子文件夹并添加一个新文件夹并将名称归档。
在FS上完成文件夹创建,我正在使用这个:
当左键单击操作并选择添加文件夹时,此代码连接到 CONNECT。
我这样做是为了避免在重命名时使用对话框。我在添加一个名为 New Folder 的项目,使其可编辑并允许用户更改它。当用户按下回车时,itemChanged 信号被触发,我开始 onTreeItemChanged。
我的问题是父不包含正确的名称。
我正在使用 onAddFolderAction 备份它
并使用它取回
两者都声明如下
使用 getParent 时,返回的值不正确。但似乎什么值更早被破坏了。
在 AddFolderACtion() 中,我有:
parent_folder_name 包含“BLABLA”,但在 setParentFolder 上逐步移动时,parent_folder_name 更改为“XFZV”奇怪的字符。
知道为什么吗?
python - 如何删除 QTreeWidgetItem 中的图标?
我有一个QTreeWidget
with QTreeWidgetItems
,有时这些项目有一个图标。所以我使用以下方法设置图标:
但是如何再次删除该图标?
给
c++ - 在鼠标悬停时突出显示 treewidget 的项目
我确实有一个带有支持拖放的 treeWidget 的应用程序。
我试图在拖放操作期间突出显示一个项目。在拖放文件时,我想突出显示目标项目。
有趣的是,它突出显示了该项目,但之后.. 就像 DnD 允许设置模型并在他保留它以用于整体行为之后。我期待 DnD 期间的亮点,但不是在正常使用期间。通过正常使用,我的意思是让鼠标越过任何文件到 DnD。
DnD 的亮点是预期的(通过陈词滥调选择内容并移入/移出项目)
我也有 3 列,但只有第 1 列中的项目被突出显示。
当前代码突出显示项目,但在 DnD 之后不是在期间,即使它在 dragMoveEvent 中完成
有任何想法吗 ?
qt - QtreeWidget 边框问题
我的应用程序中有一个 qtreewidget。我已经为它设置了如下样式表。
现在的问题是 qtreewidget 周围没有边框,这是正确的行为,但是当我单击此小部件的任何项目时,小部件周围会出现黑色边框。虽然我没有提到这个小部件的边框,但为什么它会在单击任何项目时出现。
css - 孩子的 QTreeWidget 样式表颜色
系统:Linux Mint,来自 Repo 的 QT Creator -> QT 版本 5.2,C++)
我创建了一个自定义小部件,我在 QTreeView 中使用
我想要的是为 QTreeWidget 设置一个样式表,包括正常模式和选定模式下的 Backgroundcolor 和 Textcolor。
至今:
问题是 Backgroundcolor 有效,而 Color (TextColor) 无效(在这两种情况下)。我知道,当单独设置子样式表时,这将不起作用,但小部件本身及其所有子项(一些标签和按钮)都是“样式表”免费的。
TextColor 作品的唯一案例“颜色:....”就是这种情况
但这不适用于“选定”状态
c++ - 如何将 itemExpanded 与 QTreeWidgetItem 的子类一起使用
我确实有与 Qt/C++ 中使用的 SIGNAL/SLOT 相关的连接
我使用 QTreeWidget + QTreeWidgetItems 编写了一个应用程序。为了应用程序的需要,我不得不将 QTreeWidgetItem 子类化为 MyQTreeWidgetItem 以添加一些参数。
由于我从 QTreeWidgetItem 类移动到 MyQTreeWidgetItem 类,
不再工作了。
问题是
我认为问题出在 itemExpanded 期望 QTreeWidgetItem 而不是 MyQTreeWidgetItem 的事实。但是如果我用 QTreeWidgetItem 替换 MyQTreeWidgetItem ,例如
运行抱怨 SIGNAL/SLOT 没有相同的类型,这很正常。
我的项目是通过 MyQTreeWidgetItem 而不是 QTreeWidgetItem 定义的,因为我有它的子类。
连接是在 QTreeWidget 部分完成的任何想法?
谢谢
c++ - How to get the number of items of a QTreeWidget
I have created a QTreeWidget, I'm trying to list all the items displayed.
I do not want to go inside the items if the item have child but not expanded. It's really getting the number of Items I can see in the tree.
I have tried :
but this is giving me only the topLevelItem and I want all I can see. In the example, I should be able to count 14 items