]> OCCT Git - occt-copy.git/commitdiff
0029741: Samples - Inspector tool - wide icon size in table of TNamingNamedShape...
authornds <nds@opencascade.com>
Mon, 7 May 2018 12:40:18 +0000 (15:40 +0300)
committerabv <abv@opencascade.com>
Wed, 23 May 2018 03:58:41 +0000 (06:58 +0300)
tools/DFBrowserPane/DFBrowserPane_ItemDelegateButton.cxx

index 39ede2c6029c77a1b68ca58fd2adc9fff5a3af77..0cc2e2c7155b1fe67665fdad44577f05932dcf9a 100644 (file)
@@ -21,6 +21,8 @@
 #include <QPainter>
 #include <Standard_WarningsRestore.hxx>
 
+const int ICON_SIZE = 20;
+
 // =======================================================================
 // function : Constructor
 // purpose :
@@ -38,8 +40,14 @@ DFBrowserPane_ItemDelegateButton::DFBrowserPane_ItemDelegateButton (QObject* the
 void DFBrowserPane_ItemDelegateButton::paint (QPainter* thePainter, const QStyleOptionViewItem& theOption,
                                               const QModelIndex& theIndex) const
 {
-  if (!myFreeRows.contains (theIndex.row()))
-    thePainter->drawPixmap (theOption.rect, myIcon.pixmap (20,20));
+  if (myFreeRows.contains (theIndex.row()))
+    return;
+
+  int aWidth = std::min (theOption.rect.width(), ICON_SIZE);
+  int aHeight = std::min (theOption.rect.height(), ICON_SIZE);
+  QPoint aTopLeft = theOption.rect.topLeft();
+  thePainter->drawPixmap (QRect (theOption.rect.topLeft(), QPoint (aTopLeft.x() + aWidth, aTopLeft.y() + aHeight)),
+                          myIcon.pixmap (ICON_SIZE, ICON_SIZE));
 }
 
 // =======================================================================