1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <inspector/DFBrowser_TreeLevelLineDelegate.hxx>
17 #include <inspector/DFBrowserPane_Tools.hxx>
19 #include <Standard_WarningsDisable.hxx>
21 #include <Standard_WarningsRestore.hxx>
23 // =======================================================================
24 // function : Constructor
26 // =======================================================================
27 DFBrowser_TreeLevelLineDelegate::DFBrowser_TreeLevelLineDelegate (QObject* theParent)
28 : QItemDelegate (theParent)
32 // =======================================================================
35 // =======================================================================
36 void DFBrowser_TreeLevelLineDelegate::paint (QPainter* thePainter, const QStyleOptionViewItem& theOption,
37 const QModelIndex& theIndex) const
40 if (theOption.state & QStyle::State_MouseOver)
41 thePainter->fillRect (theOption.rect, DFBrowserPane_Tools::LightHighlightColor());
43 // action icon for all indices before the last one
44 if (theIndex.column() < theIndex.model()->columnCount()-1)
46 QIcon anIcon (":/icons/level_change.png");
47 QSize anIconSize (10, 20);
48 thePainter->drawPixmap (QRect (theOption.rect.right() - anIconSize.width(), theOption.rect.top(),
49 anIconSize.width(), anIconSize.height()),
50 anIcon.pixmap (anIconSize.width(), anIconSize.height()));
53 QItemDelegate::paint (thePainter, theOption, theIndex);