3

Below is the relevant code. I am using QgsProjectionSelectionWidget to get the CRS.

    canvas_extent = self.canvas.extent()

    transformer = QgsCoordinateTransform(
        self.canvas.mapSettings().destinationCrs(),
        self.input_projection_cbo.crs(),
        QgsProject.instance()
    )

    transformer.setDestinationCrs(
        self.input_projection_cbo.crs()
    )
    transformed_extent = transformer.transform(canvas_extent)

    self.extent_box.setOriginalExtent(
        transformed_extent,
        QgsCoordinateReferenceSystem(
            self.input_projection_cbo.crs().authid()
        )
    )

    self.extent_box.setOutputCrs(
        QgsCoordinateReferenceSystem(
            self.input_projection_cbo.crs().authid()
        )
    )
    self.extent_box.setOutputExtentFromOriginal()
    self.extent_box.setCurrentExtent(
        transformed_extent,
        QgsCoordinateReferenceSystem(
            self.input_projection_cbo.crs().authid()
        )

    )

Below is the entire report.

h2. User Feedback
h2. Report Details
*Crash ID*: 8e827b9e58264385e7a945fbe0ac6df5b4daf9a5
*Stack Trace*

 QgsExtentGroupBox::setOriginalExtent :
PyInit__gui :
PyCFunction_FastCallDict :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyFunction_FastCallDict :
PyObject_CallFunctionObjArgs :
PyObject_Call :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
QMetaObject::activate :
QGroupBox::childEvent :
QGroupBox::mouseReleaseEvent :
QgsPresetSchemeColorRamp::clone :
QWidget::event :
QGroupBox::event :
QgsPresetSchemeColorRamp::clone :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
CallWindowProcW :
DispatchMessageW :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

*QGIS Info*
QGIS Version: 3.2.1-Bonn
QGIS code revision: commit:1edf372fb8
Compiled against Qt: 5.9.2
Running against Qt: 5.9.2
Compiled against GDAL: 2.2.4
Running against GDAL: 2.2.4

*System Info*
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.17134

5
  • can you share the UI code coming along and the way to reproduce? otherwise a minimal crashing example (a code I could easily run to reproduce the crash)? Sep 10, 2018 at 17:11
  • Quoting the docs: When using the widget, make sure to call setOriginalExtent(), setCurrentExtent() and setOutputCrs() during initialization. qgis.org/pyqgis/master/gui/other/QgsExtentGroupBox.html Have you checked this? Sep 10, 2018 at 18:11
  • @DenisRouzaud The plugin is located here. It is the master. github.com/wondie/batch_gps_importer
    – wondim
    Sep 10, 2018 at 21:04
  • @DenisRouzaud I also called setOriginalExtent(), setCurrentExtent() and setOutputCrs() but the error still happens. The error happens when a checkbox is checked.
    – wondim
    Sep 11, 2018 at 12:19
  • sorry, I don't have time to get into the whole code at the moment. I would suggest one of the 2 things: 1) you paste here a small python code which can be run on itself to reproduce the error. Or 2) you use debug statements (with print) to give precise information where the crash occurs (which method called with which arguments). Sep 11, 2018 at 13:05

1 Answer 1

2

I found out that the problem is not on the above code. The crash is most likely related to me hiding the extent groupbox buttons using Qt methods. I had to delete them because hiding did not work as they still reappeared. The code below used to work on QGIS 2.18 but was not working on QGIS 3.2 and later. Anyways I decided not to hide it due to the crash. Thus, I commented out the code below.

    for button in self.extent_box.findChildren(QPushButton):
        button.setHidden(True)
        button.parent().setHidden(True)
        button.deleteLater()
        button.parent().deleteLater()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.