GtkTreeView 的行激活和光标更改信号

发布于 2024-08-21 04:04:04 字数 178 浏览 12 评论 0原文

我有一个树视图,我正在观察 cursor-changedrow-activated 信号。问题是,为了触发行激活,我首先必须单击该行(触发 cursor-changed),然后双击,需要单击 3 次。

有没有办法通过两次点击来响应这两个信号?

I have a treeview and I am watching for the cursor-changed and row-activated signals. The problem is that in order to trigger the row-activate I first have to click on the row (triggering cursor-changed) and then do the double click, requiring 3 clicks.

Is there a way to respond to both signals with 2 clicks?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倒带 2024-08-28 04:04:04

目前还不清楚你想要实现什么目标。我猜您正在尝试响应用户更改树视图中的选择。

如果是这种情况,请连接到 gtk.TreeSelection 上的 [changed][1] 信号:

selection = treeview.get_selection()
selection.connect('changed', self.on_treeview_selection_changed)

据我所知,使用林间空地这是不可能的界面设计师。

但是,如果您完全尝试做其他事情,请添加更多信息。

It's not very clear what you're trying to achieve. I guess you're trying to respond to the user changing the selection in the treeview.

If this is the case, connect to the [changed][1] signal on the gtk.TreeSelection:

selection = treeview.get_selection()
selection.connect('changed', self.on_treeview_selection_changed)

As far as I can tell, this is not possible using the glade interface designer.

If, however, you are trying to do something else entirely, please add some more information.

他夏了夏天 2024-08-28 04:04:04

即使单击同一(选定)行,也会发出 cursor-changed 信号。尽管如此,当您双击一行时,无论是否在双击之前选择了该行,都会发出 row-activated 信号。因此,您不需要点击 3 次即可触发行激活

正如 Jon 提到的,您想要连接到选择的 changed 信号,而不是 cursor-changed

The cursor-changed signal is emitted even when single clicking on the same (selected) row. Still, the row-activated signal is emitted when you double click on a row, whether it was selected before the double click or not. Thus you don't need 3 clicks to trigger a row-activated.

As Jon mentioned, you want to connect to the selection's changed signal in stead of cursor-changed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文