QPushButton setIcon make application crash with no error message.
-
Hi,
I need to change icons of pushbuttons in my gui... i'm using this code:ui->NUL->setIcon(QIcon(QPixmap::fromImage(image)));where NUL is my PushButton ande image is a QImage. I've already verified the image is correctly loaded. On Qt 5.12.2 in windows with MinGW 7.3.0 32bits, that instruction SOMETIMES makes the program crash with no error message. Debugging the application says "segmentation fault" on that line, but also, no further error message to help me.
Te same application runs perfectly on Linux compiling it with GCC. IDK what can i do to solve it, as i have no error messages.
Any hints of what can i do to discover what is happening?
-
Hi,
I need to change icons of pushbuttons in my gui... i'm using this code:ui->NUL->setIcon(QIcon(QPixmap::fromImage(image)));where NUL is my PushButton ande image is a QImage. I've already verified the image is correctly loaded. On Qt 5.12.2 in windows with MinGW 7.3.0 32bits, that instruction SOMETIMES makes the program crash with no error message. Debugging the application says "segmentation fault" on that line, but also, no further error message to help me.
Te same application runs perfectly on Linux compiling it with GCC. IDK what can i do to solve it, as i have no error messages.
Any hints of what can i do to discover what is happening?
-
Hi,
I need to change icons of pushbuttons in my gui... i'm using this code:ui->NUL->setIcon(QIcon(QPixmap::fromImage(image)));where NUL is my PushButton ande image is a QImage. I've already verified the image is correctly loaded. On Qt 5.12.2 in windows with MinGW 7.3.0 32bits, that instruction SOMETIMES makes the program crash with no error message. Debugging the application says "segmentation fault" on that line, but also, no further error message to help me.
Te same application runs perfectly on Linux compiling it with GCC. IDK what can i do to solve it, as i have no error messages.
Any hints of what can i do to discover what is happening?
-
@JonB : I've already tryed that, i can see there is content in both images and icon, and it fails anyway.
Thanks for your answers...
IDK why, but using the heap for storing the QImage worked for Windows. In linux it was not necessary.. I'm sure i'm making another mistake, but this works for me now.