2011-08-09 41 views
2

我有一個使用gtkmm的2.4這一直很好,直到最近,我改變了對gtkmm的3.0的應用程序。我有相剋的問題,保存着吐出錯誤++(4.6.1版)「的錯誤:‘類的Gtk :: TextView的’沒有名爲‘modify_font’成員」。這是不是這樣的,當我恢復我的生成包括回gtkmm的2.4(通過改變pkg-config gtkmm-3.0 --cflags --libs回到gtkmm的-2.4)。問題的跟Gtk :: TextView的:: modify_font從gtkmm的2.4移動時GTK3.0

我跟着頭部背面(從代碼::塊內)和函數頭是肯定有。它看起來不像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); 
} 

回答

2

gtkmm的3.0 has override_font()代替modify_font()。

的文件確實是有所欠缺的是什麼在3.0改變了細節,並更名爲一些符號,而不在2.4被棄用。我相信gtkmm的開發者會對如何讓文檔更好的形成感興趣,如果你有時間來幫忙的話。

+0

感謝您的反饋意見。我無法在任何地方找到它。你對2.4 - > 3.0 changelog有些缺乏是正確的。當我得到時間時,我會盡力幫助它。 –