我应该如何在 gtk4 中添加一个可折叠的侧边栏?

How should I add a collapsible sidebar in gtk4?

提问人:user22609924 提问时间:11/8/2023 更新时间:11/8/2023 访问量:17

问:

我发现的几个选项与使用以下内容有关:

<child>
      <object class="GtkBox" id="content_box">
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkSearchBar" id="searchbar">
            <child>
              <object class="GtkSearchEntry" id="searchentry">
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkBox" id="hbox">
            <child>
              <object class="GtkRevealer" id="sidebar">
                <property name="transition-type">slide-right</property>
                <child>
                 <object class="GtkScrolledWindow" id="sidebar-sw">
                   <property name="hscrollbar-policy">never</property>
                   <child>
                     <object class="GtkListBox" id="words">
                       <property name="selection-mode">none</property>
                     </object>
                   </child>
                 </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkStack" id="stack">
                <property name="transition-duration">500</property>
              </object>
            </child>
          </object>
        </child>
      </object>
    </child>

在 GTK 网站本身上,有一个名为 的选项,但它似乎对子节点的可见性非常严格。GtkStackSidebar

我应该如何创建一个侧边栏,我可以单击以显示该侧边栏,并具有可以从其余代码填充的元素?

用户界面 GTK 侧边栏

评论


答: 暂无答案