summaryrefslogtreecommitdiff
path: root/cad/src/widgets/NE1ToolBar.py
blob: 97b04b157360cc046b8c17bb8e7d40ddd789921c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright 2007 Nanorex, Inc.  See LICENSE file for details.
"""
NE1ToolBar.py - Variant of QToolBar in which the toolbar border is not rendered

@author: Ninad
@version: $Id$
@copyright: 2007 Nanorex, Inc.  All rights reserved.

History:

File created on 20070507. There could be more than one NE1Toolbar classes
(subclasses of QToolBar) in future depending upon the need.

"""

from PyQt4.Qt import QToolBar
from PyQt4.Qt import QPainter
from PyQt4.Qt import QStyleOptionToolBar
from PyQt4.Qt import QPalette
from PyQt4.Qt import QStyle


class NE1ToolBar(QToolBar):
    """
    Variant of QToolBar in which the toolbar border is not rendered.
    """
    def paintEvent(self, event):
        """
        reimplements the paintEvent of QToolBar
        """
        #ninad20070507 : NE1ToolBar is used in Movie Prop mgr.
        # reimplementing paint event makes sure that the
        # unwanted toolbar border for the Movie control buttons
        # is not rendered. No other use at the moment.
        # [bruce 071214 guessed class docstring based on this comment.
        #  I think the class should be renamed to be more descriptive.]
        painter = QPainter(self)
        option = QStyleOptionToolBar()
        option.initFrom(self)
        option.backgroundColor = self.palette().color(QPalette.Background)
        option.positionWithinLine = QStyleOptionToolBar.Middle
        option.positionOfLine = QStyleOptionToolBar.Middle
        self.style().drawPrimitive(QStyle.PE_PanelToolBar, option, painter, self)

    pass