如何在GTK Stack Switcher中使用图像

问题描述 投票:3回答:1

我正在使用C ++和gtkmm编写应用程序。我在其中制作了一个Gtk堆栈。现在我想在stackswitcher的按钮上添加图像而不是文本。我认为这是可能的,因为这样的东西是在gtk3-demo中制作的:

不幸的是,这个例子是使用UI文件制作的,我想在没有UI设计器的情况下完成。现在我找到了qazxsw poi

但这对我没有多大帮助。答案是使用this answer:但是我检查了gtkmm文档的堆栈,并且C ++没有这样的东西。最接近的匹配是stack.child_set_property,其注释返回Gtk::Stack::child_property_name。我想这可能是我正在寻找的东西,但由于缺乏示例,我不知道如何使用它。

总结一下:有人能告诉我如何将图像设置为StackSwitcher的标签吗?

c++ gtkmm
1个回答
3
投票

好吧,似乎我找到了答案。如果有人在将来需要它我会发布它:要将Stack Switcher的文本标签更改为图像我只需要这样做:

A ChildPropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes
© www.soinside.com 2019 - 2024. All rights reserved.