def _setButtonIcon(self, show): style = qt.QApplication.instance().style() # return a QIcon icon = style.standardIcon(self._BUTTON_ICON) if show is False: pixmap = icon.pixmap(32, 32).transformed(qt.QTransform().scale(-1, 1)) icon = qt.QIcon(pixmap) self._toggleButton.setIcon(icon)
coords = { 't': [(0.5, 0.), (.1, .8), (.9, .8)], 'd': [(0.1, 0.5), (0.5, 0.), (0.9, 0.5), (0.5, 1.)], '+': [(0.0, 0.40), (0.40, 0.40), (0.40, 0.), (0.60, 0.), (0.60, 0.40), (1., 0.40), (1., 0.60), (0.60, 0.60), (0.60, 1.), (0.40, 1.), (0.40, 0.60), (0., 0.60)], 'x': [(0.0, 0.40), (0.40, 0.40), (0.40, 0.), (0.60, 0.), (0.60, 0.40), (1., 0.40), (1., 0.60), (0.60, 0.60), (0.60, 1.), (0.40, 1.), (0.40, 0.60), (0., 0.60)] } for s, c in coords.items(): lineSymbols[s].moveTo(*c[0]) for x, y in c[1:]: lineSymbols[s].lineTo(x, y) lineSymbols[s].closeSubpath() tr = qt.QTransform() tr.rotate(45) lineSymbols['x'].translate(qt.QPointF(-0.5, -0.5)) lineSymbols['x'] = tr.map(lineSymbols['x']) lineSymbols['x'].translate(qt.QPointF(0.5, 0.5)) noSymbols = ('None', 'none', '', ' ') lineSymbolsText = OrderedDict([('no symbol', 'None'), ('circle', 'o'), ('point', '.'), ('pixel', ','), ('cross', '+'), ('x-cross', 'x'), ('diamond', 'd'), ('square', 's'), ('', '')]) class LineStyleDelegate(qt.QItemDelegate): def paint(self, painter, option, index):