From ce0cde83a461f97814c357d77b306e9d1de92ccd Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Date: Wed, 4 Aug 2010 14:02:35 +0200
Subject: [PATCH] QtQuickToolBar: Bo not allow negative border margins

While editing BorderImage margins I do not allow
negative margins anymore.
---
 .../propertyeditor/contextpanewidgetimage.cpp | 26 ++++++++++++-------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/plugins/qmldesigner/components/propertyeditor/contextpanewidgetimage.cpp b/src/plugins/qmldesigner/components/propertyeditor/contextpanewidgetimage.cpp
index ba5439f9605..bbd2e9b8391 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/contextpanewidgetimage.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/contextpanewidgetimage.cpp
@@ -520,11 +520,14 @@ void PreviewLabel::paintEvent(QPaintEvent *event)
             pen.setColor("#F0F0F0");
             p.setPen(pen);
 
-            p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
-            p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4);
-
-            p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
-            p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom);
+            if (m_left >= 0)
+                p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
+            if (m_right >= 0)
+                p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4);
+            if (m_top >= 0)
+                p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
+            if (m_bottom >= 0)
+                p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom);
         }
 
         {
@@ -534,11 +537,14 @@ void PreviewLabel::paintEvent(QPaintEvent *event)
             pen.setColor("#101010");
             p.setPen(pen);
 
-            p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
-            p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4);
-
-            p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
-            p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom);
+            if (m_left >= 0)
+                p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
+            if (m_right >= 0)
+                p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4);
+            if (m_top >= 0)
+                p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
+            if (m_bottom >= 0)
+                p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom);
         }
     }
 }
-- 
GitLab