What is Phaser 3? It’s a nice game engine for web browsers you can download for free here: https://phaser.io
How do you get VS Code to show Phaser documentation automatically in the editor? Create a text file named jsconfig.json in the root of your project folder that includes the Phaser types and your game code. The root of your project must contain folders that contain the code for Phaser and your game. For example, if your project folder is named “myProjectFolder” and your game code is stored in a folder called “src” and the Phaser 3 code is stored in a folder called “phaser” then here is your directory structure and jsconfig.json file’s contents:
After you create the jsconfig.json file and have saved it, close VS Code. The next time you open VS Code, select File->Open Folder and select your project root (“myProjectFolder” from our example”) and the Phaser information will be available after a short loading process completes.
The only way to override the default shortcuts while the QTextEdit has focus is to intercept the QEvent::ShortcutOverride event. There are 2 ways to intercept this event: 1. write an event filter 2. subclass QTextEdit and then override the virtual event(QEvent* event) method. I prefer this 2nd method (pun intended) because anything that changes the functionality of a widget should probably be its own class.
Here is an example of how I block the QTextEdit from using all shortcuts that start with Ctrl being pressed:
I decided to start gathering some C code that I have written over the years into an easy to use library. The easy to use part is a work in progress but I plan to add lots of simple use cases to and documentation to help anyone who wants to use it.
There are so many times that I have wanted an easy way to show a QPixmap on a form while maintaining the aspect-ratio of the image that I finally sat down and made one. The single header file can be downloaded here: SpworksWidgetImage.zip. Extract the .h file and add it to any Qt project. It provides all of the necessary features to show an image when and where you want it using the SpworksWidgetImage class.
// Don't forget to #include "spworkswidgetimage.h"
// SETUP //
SpworksWidgetImage* scaledImage = new SpworksWidgetImage();
// OPTIONAL SETTINGS //
// fill the widget to 75% of the widget's size
// place the image in the bottom right corner of the widget
scaledImage->SpworksWidgetImage_SetAlignment(Qt::AlignRight | Qt::AlignBottom);
// paint the background of the entire widget white before painting the pixmap
// place a hidden border around the widget to keep the image off the edge
If you get an error like this:
The system cannot find the path specified.
or like this:
error MSB6006: "cmd.exe" exited with code 3.
Then you may need to just change your Qt Version under Qt Project Settings. The trick is that you must change from one valid Qt Version to another valid Qt Version. For example, if your current version is set to $(DefaultQtVersion) then you should change it to the explicit version entry. Make sure you actually apply the changed setting because otherwise nothing will happen. Once you have changed and applied the new setting, you can change it back and it may fix the problem.