<div dir="ltr"><div class="gmail_quote"><br><div dir="ltr">I have an external windows standalone python application that uses pyqgis.<div>When I display a QgsRendererPropertiesDialog, python crashes when the user clicks on any color button (screenshot: <a href="http://psr.me/1903oq2">http://psr.me/1903oq2</a>). The problem seems to be in displaying the color dialog. In previous QGis versions I could avoid this problem by using:</div><div><br></div><div>        settings = QgsSettings()<br>        settings.setValue('qgis/native_color_dialogs', True)<br></div><div><br></div><div>QGis then used another color dialog that did not crash my application. However, since I updated to QGis 3.8.3 (OSGEO4W) this option no longer works. Apparently this option has been removed.</div><div><br></div><div>I also noticed that QGis uses a color dialog different from the one that appears in my application. How can I configure my application (from pyqgis) to use the same dialog?</div><div><br></div><div>I wrote a very small PyQt5 application (below, at the end) that reproduces the problem. Any thoughts on how to fix this?</div><div><br></div><div>Operating system: Windows 10 Home</div><div>Python version: 3.7.0 (OSGEO4W)</div><div>QGis version: 3.8.3 (OSGEO4W)</div><div></div><div><br></div><div>Thanks,</div><div>Marcelo Metello</div><div><br></div><div><div><br></div></div><div><br></div><div>from qgis.core import QgsVectorLayer, QgsStyle<br>from qgis.gui import QgsRendererPropertiesDialog<br>from PyQt5 import QtCore, QtWidgets<br><br><br>def editStyle():<br>    layer = QgsVectorLayer('LineString?field=level:integer', 'contour_lines', 'memory')<br>    dialog = QtWidgets.QDialog()<br>    layout = QtWidgets.QVBoxLayout(dialog)<br><br>    # Add symbology panel<br>    symbPanel = QgsRendererPropertiesDialog(layer, QgsStyle.defaultStyle(), True)<br>    layout.addWidget(symbPanel)<br><br>    # Add Ok Cancel button box<br>    buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, dialog)<br>    buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText('Ok')<br>    buttonBox.button(QtWidgets.QDialogButtonBox.Cancel).setText('Cancel')<br>    buttonBox.accepted.connect(dialog.accept)<br>    buttonBox.rejected.connect(dialog.reject)<br>    layout.addWidget(buttonBox)<br><br>    dialog.setLayout(layout)<br>    dialog.adjustSize()<br><br>    if (dialog.exec_() == QtWidgets.QDialog.Accepted):<br>        symbPanel.apply()<br><br><br># Create simple application with only one button<br>app = QtWidgets.QApplication([])<br><br>window = QtWidgets.QWidget()<br>layout = QtWidgets.QVBoxLayout()<br>editBtn = QtWidgets.QPushButton('Edit Style')<br>editBtn.clicked.connect(editStyle)<br>layout.addWidget(editBtn)<br>window.setLayout(layout)<br>window.show()<br>app.exec_()<br><br>app.exit()<br></div></div>
</div></div>