1

I'm trying to do simple thing as running plugin that load layers and show loading bar at the same time as the loading process takes awhile. I'm trying to use QGIS task manager with no success..

This is what I did:

    if result:
        task1 = QgsTask.fromFunction(
            'waste cpu 1', self.getting_layers,self.completed)
        task2 = QgsTask.fromFunction(
            'waste cpu 1', self.run_status_bar,self.completed)
        task1.addSubTask(task2)
        QgsApplication.taskManager().addTask(task1)

I try it in two different tasks as well. When I write the function call as "self.getting_layers()" I get "Assert error". When without it does nothing.

What am I doing wrong?

1
  • @MrXsquared i copy pasted.. fixed now. Have any idea?
    – Micha
    Dec 30 '21 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.