From 64b1e9b360045b6ed2794d17b4fd07bc2ca8a47e Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 16 Jun 2009 12:08:46 +0200 Subject: Improved styling of expander arrows with Gtk+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation was based on the GtkExpander widget. However we do not have such a widget and the primary use case is for expanders inside item views. Hence it makes sense to base it on gtktreeview instead. As I can not reproduce the crash with any recent versions of cleanice I will remove the workaround as well. omment and edit as applicable ]---| Task-number: 256146 Reviewed-by: Thorbjørn --- src/gui/styles/qgtkstyle.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 0e54af8..84ec4af 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -789,24 +789,21 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_IndicatorBranch: if (option->state & State_Children) { QRect rect = option->rect; - rect = QRect(0, 0, 10, 10); + rect = QRect(0, 0, 12, 12); rect.moveCenter(option->rect.center()); rect.translate(2, 0); GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED; GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED; - GtkWidget *gtkExpander = QGtk::gtkWidget(QLS("GtkExpander")); - guint expanderSize; - QGtk::gtk_widget_style_get(gtkExpander, "expander-size", &expanderSize, NULL); - // Note CleanIce will crash unless a GtkExpander is provided - // but providing the expander will enforce the expander-size, which we - // don't neccessarily have room for + GtkWidget *gtkTreeView = QGtk::gtkWidget(QLS("GtkTreeView")); + GtkStateType state = GTK_STATE_NORMAL; if (!(option->state & State_Enabled)) state = GTK_STATE_INSENSITIVE; else if (option->state & State_MouseOver) state = GTK_STATE_PRELIGHT; - gtkPainter.paintExpander(expanderSize <= 10 ? gtkExpander : NULL, "expander", rect, state, - option->state & State_Open ? openState : closedState , gtkExpander->style); + + gtkPainter.paintExpander(gtkTreeView, "treeview", rect, state, + option->state & State_Open ? openState : closedState , gtkTreeView->style); } break; case PE_PanelItemViewItem: -- cgit v0.12