Re: Error Cannot Convert TextView to GtkWidget

On Wed, 2010-09-22 at 08:50 +0300, محمد الحبيِّب wrote:
> I am trying to play with GNote since it is based on Gtkmm.
> I typed this:
> gtk_widget_modify_base(m_editor, GTK_STATE_NORMAL, mihColor);
> Then I got this error message:
> error: cannot convert ‘Gtk::TextView*’ to ‘GtkWidget*’ for argument
> ‘1’ to ‘void gtk_widget_modify_base(GtkWidget*, GtkStateType, const
> GdkColor*)’

You are calling a C function, passing it a pointer to a C++ object. The
compiler can't convert because the types are not related by any

Maybe you want to either
a) Call m_editor->modify_base( ... )
b) get the C object so you can call the C function:
gtk_widget_modify_base(m_editor.gobj(), ...)

> Why is that?
> As learned in Qt if QTextEdit is inherited from QWidget then I do not
> have to convert it.
> Is it the same case with Gtkmm? I think this is one of the advantages
> of inheritance in C++.

murrayc murrayc com

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