Unsolved QGriddlayout works for grid 80*80 but not for 100*100 or more (SIGSEGV error)
-
@Davay
It probably won't help, but you would need to go back further in the stack trace (bottom window) till you reach somewhere in your own code. -
The debug output looks like you have infinite recursion. With every function call you allocate more stack space. Eventually you will run out of stack space (as it is quite limited compared to the heap) which will in turn result in a segmentation fault.
Like @JonB already said, you need to provide more of the stack trace until you reach your own code. Click on <More> in the stack trace until you see something familiar. You should also figure out if Qt uses more than 1 Thread. If I am not mistaken GUI stuff runs in Thread
#0
and not#1
like you show it. (I might be mistaken about this, though.) Sometimes switching the thread will show your own code in the stack trace. -
@JonB & @SimonSchroeder Thanks a lot for your answers let me start of with the threads, I'll only show those where something new shows up:
Now if I click on more in thread 1 (see the previous reply) it doesn't do anything now if I click on it a couple of times, QT crashes without error or any warning.@SimonSchroeder do you mean with this limited amount of stack space that I can't make more of my clickable labels than lets say than a grid filled with them more than (80 on 80) so about 6400?
-
It probably wont help to solve your problem, but why do you need 10.000 labels or more in a
QGridLayout
at the same time? Maybe there is a workaround or better/different solution for your use case.
->QGraphicsView
+QGraphicsItems
instead of labels in a grid. -
Well, you are probably right that I don't need them but for a beginner like me it seemed a logical choice to use labels or buttons since those are things I know. I'm trying to make a forest fire simulation and each tile can be made of a different material that can be changed throughout the simulation. Hence they need to be clickable. I would be open to any suggestions on how to do this better of course!
-
Hi,
As suggested by @Pl45m4 the Graphics View Framework. You'll be able to build your simulation in an easier way to manage your various tiles on the map.
-
@Davay Is it possible to create a single image for display of your simulation? You can change the colors of its pixels. Your simulation data is generated behind the scene. One tile consists of a matrix of pixels.
-
So your "map" looks like raster graphics with a low resolution where each label in some color represents a tile of a different material?
Yes, you can do this with the GraphicsView framework.
Of course they can be clickable. But there is so much more you can do, when you use the GraphicsView framework (zooming, custom items etc).
It probably takes some time to re-design your interface but 6.400 or over 10k labels on a widget is by far not the best solution :) -
Thank all of you for your good suggestions, I'll look into them!
-
@Davay one more observations..How many threads do your application has?
in stack trace it's shown upto 21. -
@nagesh I do not know, I don't tell something about the threads in my application so it happens automatically I think.