Re: Error Cannot Convert TextView to GtkWidget
- From: Murray Cumming <murrayc murrayc com>
- To: محمد الحبيِّب <mih1406 gmail com>
- Cc: Gtkmm Mailing List <gtkmm-list gnome org>
- Subject: Re: Error Cannot Convert TextView to GtkWidget
- Date: Wed, 22 Sep 2010 09:51:38 +0200
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
inheritance.
Maybe you want to either
a) Call m_editor->modify_base( ... )
http://library.gnome.org/devel/gtkmm/stable/classGtk_1_1Widget.html#ae5ba3a8e3b370bac1558a2dc7968c034
or
b) get the C object so you can call the C function:
gtk_widget_modify_base(m_editor.gobj(), ...)
http://library.gnome.org/devel/gtkmm-tutorial/stable/sec-basics-gobj-and-wrap.html.en
> 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
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]