Re: Problem With Gtk::CellLayout and Gtk::TreeModel



Thanks for the suggestion. I have modified the method as follows:

  void set_family(Gtk::TreeIter iter) {
           Gtk::TreeModel::Row row = *iter;
           Glib::ustring family = row[col1];
           std::cout << family << std::endl;
           renderer.property_family() = family;
	    renderer.property_family_set() = true;
           renderer.property_style() =  Pango::STYLE_ITALIC;
	    renderer.property_style_set() = true;
           renderer.property_size_points() = 20;
	    renderer.property_size_set() = false;
   }

Only     renderer.property_size_set() = false;

had any effect by turning the size setting off (back to default).

Jim




Andrew E. Makeev wrote:
I guess, you should do

renderer.property_<name>_set() = true;

as well.
When I last time looked at sources, there was check for those booleans
before actually changing cell font and colors.

Regards,

В Пнд, 24/05/2010 в 09:48 -0400, Jim Orcheson пишет:
Thank you Murray.

set_family is now called as I expect it to, but it has no effect on the font. To help debug things, I made some additions to the method:

   void set_family(Gtk::TreeIter iter) {
           Gtk::TreeModel::Row row = *iter;
           Glib::ustring family = row[col1];
           std::cout << family << std::endl;
           renderer.property_family() = family;
           renderer.property_style() =  Pango::STYLE_ITALIC;
           renderer.property_size_points() = 20;
   }

The expected font family names are printed, but:
1. The cell entries are still displayed in the default font.
2. The cell entries are displayed in normal style.
3. The cell entries are displayed in default size, but they are spaced farther apart.

I also tried setting these properties using a Pango::FontDescription object, but the effect was the same.

Am I missing something such as another method that has to be called, or have I found a bug?

Jim



Murray Cumming wrote:
On Sun, 2010-05-23 at 13:27 -0400, Jim Orcheson wrote:
2. If I change the problem line to:
sigc::slot<void, Gtk::TreeIter> s = sigc::ptr_fun(&FontSelector::set_family);
        set_cell_data_func(renderer, s);
then I get the following compiler error on the first line:
error: no matching function for call to 'ptr_fun(void (FontSelector::*)(Gtk::TreeIter))'
Your set_family() is a member function. Surely you should be using
sigc::mem_fun(). It's iter method should probably be const & too.


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]