From 17c7749f3bef98d2843c025f4fda84c34477a807 Mon Sep 17 00:00:00 2001
From: Jens Bache-Wiig <jens.bache-wiig@nokia.com>
Date: Mon, 23 May 2011 13:02:49 +0200
Subject: [PATCH] Add styling for Splitter

---
 components/styleitem/qstyleitem.cpp | 13 +++++++++++++
 components/styleitem/qstyleitem.h   |  1 +
 examples/ItemViewGallery.qml        |  8 +++-----
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/components/styleitem/qstyleitem.cpp b/components/styleitem/qstyleitem.cpp
index 72dd3b9b7..80f24f8c1 100644
--- a/components/styleitem/qstyleitem.cpp
+++ b/components/styleitem/qstyleitem.cpp
@@ -131,6 +131,13 @@ void QStyleItem::initStyleOption()
         }
         break;
 
+    case Splitter: {
+            if (!m_styleoption) {
+                m_styleoption = new QStyleOption;
+            }
+        }
+        break;
+
     case Item: {
             if (!m_styleoption) {
                 m_styleoption = new QStyleOptionViewItemV4();
@@ -753,6 +760,9 @@ void QStyleItem::setElementType(const QString &str)
         m_dummywidget = new QComboBox();
         visible = true;
         m_itemType = ComboBox;
+    } else if (str == "splitter") {
+        visible = true;
+        m_itemType = Splitter;
     } else if (str == "progressbar") {
         m_dummywidget = new QProgressBar();
         visible = true;
@@ -949,6 +959,9 @@ void QStyleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWid
     case Widget:
         qApp->style()->drawPrimitive(QStyle::PE_Widget, m_styleoption, painter, widget());
         break;
+    case Splitter:
+        qApp->style()->drawControl(QStyle::CE_Splitter, m_styleoption, painter, widget());
+        break;
     case ComboBox:
         qApp->style()->drawComplexControl(QStyle::CC_ComboBox,
                                           qstyleoption_cast<QStyleOptionComplex*>(m_styleoption),
diff --git a/components/styleitem/qstyleitem.h b/components/styleitem/qstyleitem.h
index da56942d9..1b9f9c875 100644
--- a/components/styleitem/qstyleitem.h
+++ b/components/styleitem/qstyleitem.h
@@ -100,6 +100,7 @@ public:
         Header,
         Item,
         ItemRow,
+        Splitter,
         Menu,
         MenuItem,
         Widget
diff --git a/examples/ItemViewGallery.qml b/examples/ItemViewGallery.qml
index 13ed6230e..e6077f27c 100644
--- a/examples/ItemViewGallery.qml
+++ b/examples/ItemViewGallery.qml
@@ -186,9 +186,9 @@ Rectangle {
 
                 ListModel {
                     id: delegatemenu
-                    ListElement { text: "Shiny" }
-                    ListElement { text: "Scale" }
-                    ListElement { text: "Editable" }
+                    ListElement { text: "Shiny delegate" }
+                    ListElement { text: "Scale selected" }
+                    ListElement { text: "Editable items" }
                 }
 
                 Component {
@@ -207,8 +207,6 @@ Rectangle {
                     }
                 }
 
-
-
                 Component {
                     id: slickRowDelegate
                     Rectangle{
-- 
GitLab