GTK Glade:层次编辑器

时间:2018-02-02 16:12:32

标签: gtk gtk3 gnome glade

我正在使用Glade 3.20。我创建了一个列表库和一个列表视图。列表库有三列;一个gint,一个gchararray和另一个gint

我右键单击我的TreeView对象,然后选择Edit...。 '将军'选项卡显示我在列表库中定义的列。我选择了“层次结构”'选项卡,然后点击' +'按钮。这将创建一个名为column的新视图列。我右键点击它,然后选择“添加子文字'”。没有任何事情发生。

这是沼地3.20的已知问题吗?我在做些蠢事吗?

1 个答案:

答案 0 :(得分:0)

是的,不幸的是它是一个错误。我认为它是围绕Glade 3.19.0引入的。从旧版glade文件复制粘贴单元格渲染器将会起作用,或者通过编辑xml文件手动添加:

示例单元格渲染器pixbuf:

<object class="GtkTreeViewColumn" id="treeviewcolumn1">
   <property name="title">column</property>
   <child>
      <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1">
         <property name="visible">False</property>
         <property name="stock_size">3</property>
      </object>
      <attributes>
         <attribute name="icon-name">0</attribute>
      </attributes>
   </child>
</object>

我刚刚准备了一个简单的glade文件,其中包含所有默认的单元格渲染器,您可以将内部空格中的粘贴复制到您的glade文件中。只需转到窗口小部件层次结构,复制渲染器,转到窗口小部件层次结构,然后在TreeViewColumn下粘贴复制的渲染器。

cell_renderers.glade:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<interface>
  <requires lib="gtk+" version="3.16"/>
  <object class="GtkWindow" id="window1">
    <property name="can_focus">False</property>
    <child>
      <object class="GtkTreeView" id="treeview1">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <property name="vexpand">True</property>
        <property name="headers_visible">False</property>
        <property name="search_column">0</property>
        <child internal-child="selection">
          <object class="GtkTreeSelection" id="treeview-selection6"/>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn8">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererProgress" id="cellrendererprogress1">
                <property name="visible">True</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn7">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererSpinner" id="cellrendererspinner1">
                <property name="visible">True</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn6">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererAccel" id="cellrendereraccel1">
                <property name="visible">True</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn5">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererSpin" id="cellrendererspin1">
                <property name="visible">True</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn4">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererCombo" id="cellrenderercombo1">
                <property name="visible">True</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn3">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererToggle" id="cellrenderertoggle1">
                <property name="visible">True</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn1">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1">
                <property name="visible">True</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkTreeViewColumn" id="treeviewcolumn2">
            <property name="title">column</property>
            <child>
              <object class="GtkCellRendererText" id="cellrenderertext1">
                <property name="height">44</property>
              </object>
              <attributes>
                <attribute name="text">1</attribute>
              </attributes>
            </child>
          </object>
        </child>
      </object>
    </child>
  </object>
</interface>

这可以在即将推出的林间空地版本中解决。