def getColorPolygonAndBrushStyle( initial_color: Union[QColor, Qt.GlobalColor, QGradient] = QColor(), initial_polygon: NodePolygon = NodePolygon.Circle, initial_brushstyle: Qt.BrushStyle = Qt.NoBrush, parent: Optional[QWidget] = None, title: str = '', options: Union[QColorDialog.ColorDialogOptions, QColorDialog.ColorDialogOption] = QColorDialog.ColorDialogOptions()) \ -> (QColor, NodePolygon): dlg = QColorDialog(parent) # Add buttons to select polygon polygons_group = QButtonGroup(parent) polygons_layout = QHBoxLayout(parent) for p in NodePolygon: if p == NodePolygon.Custom: continue button = QToolButton(parent) button.setCheckable(True) button.setText(p.name) button.setIcon(QIcon(nodePolygonToPixmap(p, button.iconSize()))) if p == initial_polygon: button.setChecked(True) polygons_group.addButton(button) polygons_group.setId(button, p.value) polygons_layout.addWidget(button) dlg.layout().insertLayout(dlg.layout().count()-1, polygons_layout) # Add buttons to select brush style brushstyle_group = QButtonGroup(parent) brushstyle_layout = QHBoxLayout(parent) for p in NODE_BRUSH_STYLES: button = QToolButton(parent) button.setCheckable(True) button.setIcon(QIcon(nodeBrushStyleToPixmap(p, button.iconSize()))) if p == initial_brushstyle: button.setChecked(True) brushstyle_group.addButton(button) brushstyle_group.setId(button, p) brushstyle_layout.addWidget(button) dlg.layout().insertLayout(dlg.layout().count()-1, brushstyle_layout) if title: dlg.setWindowTitle(title) dlg.setOptions(options) dlg.setCurrentColor(initial_color) dlg.exec_() return (dlg.selectedColor(), NodePolygon(polygons_group.checkedId()), brushstyle_group.checkedId(), )