The screenshot you posted says your window manager crashed, so either its not the message you get, or, as I said, your windows managers is crashing.Only crash MyProgramInQT.exe not a Windows.
The screenshot you posted says your window manager crashed, so either its not the message you get, or, as I said, your windows managers is crashing.Only crash MyProgramInQT.exe not a Windows.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
What is the point of not giving the exact information? do you want help or not?I mean message box only looking like this one. My message says that MyProgramInQT.exe stops working not a system Windows
Sending people on the wrong track will not help you!
Are you sure your project is in debug mode?
It sounds like you are starting a release mode project.
Make sure you are in debug mode, and start the debugger, it will then stop on the line that is crashing.
Post that line here, and then we can start seeing where the problem is.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Sorry for misleading.
When i click Start Debugging (F5) debug stops at this
The code from Compile Output:
Running build steps for project Mysz...
Configuration unchanged, skipping qmake step.
Starting: "E:\Programy\QtSDK\mingw\bin\mingw32-make.exe"
E:/Programy/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/Lukasz/Desktop/Mysz-build-desktop'
mingw32-make[1]: Nothing to be done for `first'.
mingw32-make[1]: Leaving directory `C:/Users/Lukasz/Desktop/Mysz-build-desktop'
The process "E:\Programy\QtSDK\mingw\bin\mingw32-make.exe" exited normally.
please stop post external links with screenshots.
Attach the screenshots to the post, since after some time the external links stop being valid, and the post loses information, which might be important for people reading this in later time.
Also, for posting a section of code you can simple cope the code and paste it here with [code] tags.
Where is 'pushButton' defined, and where do you initialize it?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
It's a screenshot window.jpg.
I didn't have a defined pushButton so i added it:
Now the program stops crashing.Qt Code:
ui(new Ui::MainWindow) { ui->setupUi(this); pushButton->installEventFilter(this); }To copy to clipboard, switch view to plain text mode
I'm wondering why the event filter don't working.When the cursor is on button he should change a type to cross but he don't change.Qt Code:
{ { return true; } { return true; } else return false; }To copy to clipboard, switch view to plain text mode
Thats is not true.I didn't have a defined pushButton so i added it:
If there was not a defined 'pushButton' you would have gotten a compile error.
Which is also the reason your event handler "is not working".
You have a defined a local 'pushButton' in your constructor, which is being initialized, but the 'pushButton' in your evnetFilter is declared somewhere else, probably in your header in class scope, but it is not initialized, hence it never matcher your if() statements.
It seems you have no idea how classes in C++ work, and what are members.
Hence, this is becoming off topic for this forum.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
I solved my problem.
.h and .cpphigh_flyer anyway thanks for help.Qt Code:
ui(new Ui::MainWindow) { ui->setupUi(this); pushButton->setGeometry(50,45,60,25); pushButton->installEventFilter(this); }To copy to clipboard, switch view to plain text mode
Bookmarks