gpt4 book ai didi

c++ - 从 GTKMM 2.4 移动到 GTK3.0 时 Gtk::TextView::modify_font 出现问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:57:55 27 4
gpt4 key购买 nike

我有一个使用 gtkmm 2.4 的应用程序,在我最近切换到 gtkmm 3.0 之前一直运行良好。我在使用 g++(版本 4.6.1)时遇到问题,它不断吐出错误“错误:‘class Gtk::TextView’没有名为‘modify_font’的成员”。当我将构建包含恢复到 gtkmm 2.4 时(通过将 pkg-config gtkmm-3.0 --cflags --libs 更改回 gtkmm-2.4),情况并非如此。

我按照 header 返回(从 code::blocks 中),函数 header 肯定在那里。看起来 Gtk::Widget::modify_font 也没有贬值。

关于 Gtk::TextView 我的类层次结构的示例:

// The parent of the offending TextView
class popupWindow : public Gtk::Window
{
public:
popupWindow();
private:
Gtk::TextView theView;
Gtk::ScrolledWindow scrollView;
Gtk::VBox layoutBox;
Glib::RefPtr<Gtk::TextBuffer> textBuffer;
};

// The main window class
class mainWindow : public Gtk::Window
{
private:
popupWindow foo;
};

// Part of the header where I try and set the modified font
popupWindow::popupwindow() : layoutBox(false, 8)
{
// Modify the font styling of the TextView
{
Pango::FontDescription fdesc;
fdesc.set_family("monospace");
fdesc.set_size(10 * PANGO_SCALE);
theView.modify_font(fdesc);
}

// Make a new text buffer
textBuffer = Gtk::TextBuffer::create();


add(layoutBox);
layoutBox.pack_start(scrollView);
scrollView.add(theView);
theView.set_buffer(textBuffer);
}

最佳答案

gtkmm 3.0 has override_font()而不是 modify_font()。

文档确实缺少 3.0 中更改内容的详细信息,并且一些符号在 2.4 中被重命名但没有被弃用。我相信 gtkmm 开发人员会对一些帮助使文档处于更好的状态感兴趣,如果您有时间帮忙的话。

关于c++ - 从 GTKMM 2.4 移动到 GTK3.0 时 Gtk::TextView::modify_font 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6990289/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com