diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 080689779f..31bda752c3 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -953,7 +953,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, } GtkShadowType shadow_type; GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame"); - d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL); + d->gtk_widget_style_get(d->gtk_widget_get_parent(gtkStatusbarFrame), "shadow-type", &shadow_type, NULL); gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL, shadow_type, gtkStatusbarFrame->style); } diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 2ee6c0dca2..42d669e8cf 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -172,6 +172,8 @@ Ptr_gtk_widget_path QGtkStylePrivate::gtk_widget_path = 0; Ptr_gtk_container_get_type QGtkStylePrivate::gtk_container_get_type = 0; Ptr_gtk_window_get_type QGtkStylePrivate::gtk_window_get_type = 0; Ptr_gtk_widget_get_type QGtkStylePrivate::gtk_widget_get_type = 0; +Ptr_gtk_widget_get_parent QGtkStylePrivate::gtk_widget_get_parent = 0; +Ptr_gtk_widget_is_toplevel QGtkStylePrivate::gtk_widget_is_toplevel = 0; Ptr_gtk_rc_get_style_by_paths QGtkStylePrivate::gtk_rc_get_style_by_paths = 0; Ptr_gtk_check_version QGtkStylePrivate::gtk_check_version = 0; Ptr_gtk_border_free QGtkStylePrivate::gtk_border_free = 0; @@ -438,6 +440,8 @@ void QGtkStylePrivate::resolveGtk() const gtk_container_get_type =(Ptr_gtk_container_get_type)libgtk.resolve("gtk_container_get_type"); gtk_window_get_type =(Ptr_gtk_window_get_type)libgtk.resolve("gtk_window_get_type"); gtk_widget_get_type =(Ptr_gtk_widget_get_type)libgtk.resolve("gtk_widget_get_type"); + gtk_widget_get_parent =(Ptr_gtk_widget_get_parent)libgtk.resolve("gtk_widget_get_parent"); + gtk_widget_is_toplevel =(Ptr_gtk_widget_is_toplevel)libgtk.resolve("gtk_widget_is_toplevel"); gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)libgtk.resolve("gtk_rc_get_style_by_paths"); gtk_check_version =(Ptr_gtk_check_version)libgtk.resolve("gtk_check_version"); @@ -755,7 +759,7 @@ void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget) } Q_ASSERT(protoLayout); - if (!widget->parent && !GTK_WIDGET_TOPLEVEL(widget)) + if (!QGtkStylePrivate::gtk_widget_get_parent(widget) && !QGtkStylePrivate::gtk_widget_is_toplevel(widget)) QGtkStylePrivate::gtk_container_add((GtkContainer*)(protoLayout), widget); QGtkStylePrivate::gtk_widget_realize(widget); } diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h index 1c6b261e27..9ed32bd97b 100644 --- a/src/widgets/styles/qgtkstyle_p.h +++ b/src/widgets/styles/qgtkstyle_p.h @@ -215,6 +215,8 @@ typedef void (*Ptr_gtk_menu_shell_append)(GtkMenuShell *, GtkWidget *); typedef GtkType (*Ptr_gtk_container_get_type) (void); typedef GtkType (*Ptr_gtk_window_get_type) (void); typedef GtkType (*Ptr_gtk_widget_get_type) (void); +typedef GtkWidget* (*Ptr_gtk_widget_get_parent) (GtkWidget *); +typedef gboolean (*Ptr_gtk_widget_is_toplevel) (GtkWidget *); typedef GtkStyle* (*Ptr_gtk_rc_get_style_by_paths) (GtkSettings *, const char *, const char *, GType); typedef gint (*Ptr_pango_font_description_get_size) (const PangoFontDescription *); typedef PangoWeight (*Ptr_pango_font_description_get_weight) (const PangoFontDescription *); @@ -438,6 +440,8 @@ public: static Ptr_gtk_container_get_type gtk_container_get_type; static Ptr_gtk_window_get_type gtk_window_get_type; static Ptr_gtk_widget_get_type gtk_widget_get_type; + static Ptr_gtk_widget_get_parent gtk_widget_get_parent; + static Ptr_gtk_widget_is_toplevel gtk_widget_is_toplevel; static Ptr_gtk_rc_get_style_by_paths gtk_rc_get_style_by_paths; static Ptr_gtk_check_version gtk_check_version; static Ptr_gtk_border_free gtk_border_free;