Update screenshot reference in README.md and update build instructions
This commit is contained in:
parent
f43c72906c
commit
8c281ceeb2
70
README.md
70
README.md
@ -1,36 +1,56 @@
|
||||
# QJsonModel
|
||||
QJsonModel is a json tree model class for Qt5/C++11/Python based on QAbstractItemModel.
|
||||
QJsonModel is under MIT License.
|
||||
QJsonModel is a JSON tree model class for Qt6/C++17 based on QAbstractItemModel.
|
||||
|
||||
![QJsonModel](https://raw.githubusercontent.com/dridk/QJsonmodel/master/screen.png)
|
||||
QJsonModel was originally written by Sacha Shutz (https://github.com/dridk).
|
||||
|
||||
## Usage C++
|
||||
This fork is also released under the MIT License.
|
||||
|
||||
Add `qjsonmodel.cpp` and `qjsonmodel.h` into your project.
|
||||
|
||||
![QJsonModel](https://gitea.beniquez.me/sdaveb/QJsonModel/raw/branch/master/screen.png)
|
||||
|
||||
## Build Instructions
|
||||
|
||||
### Build Tools
|
||||
- CMake (version 3.21 or higher)
|
||||
- C++17-compatible compiler
|
||||
|
||||
### Building the Project
|
||||
1. Clone the repository:
|
||||
```
|
||||
git clone <URL>
|
||||
```
|
||||
|
||||
2. Navigate to the project directory:
|
||||
```
|
||||
cd elemental-game
|
||||
```
|
||||
3. Configure your build system:
|
||||
```bash
|
||||
cmake -B debug -G Unix Makefiles
|
||||
# or
|
||||
cmake -B debug -G Ninja # this is faster and more modern
|
||||
```
|
||||
4. Invoke your build system
|
||||
```
|
||||
cmake --build debug
|
||||
```
|
||||
### Usage - CMake
|
||||
|
||||
You can add this library to your CMake projects using FetchContent()
|
||||
or CPM_AddPackage().
|
||||
|
||||
Here's how to do it with CPM_AddPackage:
|
||||
|
||||
```
|
||||
COMING SOON
|
||||
```
|
||||
|
||||
### Usage - C++
|
||||
|
||||
####
|
||||
```cpp
|
||||
QJsonModel * model = new QJsonModel;
|
||||
QTreeView * view = new QTreeView;
|
||||
view->setModel(model);
|
||||
model->load("example.json")
|
||||
```
|
||||
|
||||
## Usage Python
|
||||
|
||||
Add `qjsonmodel.py` to your `PYTHONPATH`.
|
||||
|
||||
```bash
|
||||
$ pip install Qt.py
|
||||
```
|
||||
|
||||
```python
|
||||
import json
|
||||
import qjsonmodel
|
||||
|
||||
model = QJsonModel()
|
||||
view = QTreeView()
|
||||
view.setModel(model)
|
||||
|
||||
with open("example.json") as f:
|
||||
model.load(json.load(f))
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user