Skip to content

Commit bc6122e

Browse files
committed
update README: document optional features
1 parent 8aa15d1 commit bc6122e

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,33 @@ Window {
5959

6060
Requires Qt >= 5.8
6161

62+
## Cargo features
63+
64+
Cargo provides a way to enable (or disable default) optional [features](https://doc.rust-lang.org/cargo/reference/features.html).
65+
66+
### `log`
67+
68+
By default, Qt's logging system is not initialized, and messages from e.g. QML's `console.log` don't go anywhere.
69+
The "log" feature enables integration with [`log`](https://crates.io/crates/log) crate, the Rust logging facade.
70+
71+
The feature is enabled by default. To activate it, execute the following code as early as possible in `main()`:
72+
73+
```rust
74+
fn main() {
75+
qmetaobject::log::init_qt_to_rust();
76+
// don't forget to set up env_logger or any other logging backend.
77+
}
78+
```
79+
80+
### `chrono_qdatetime`
81+
82+
Enables interoperability of `QDate` and `QTime` with Rust [`chrono`](https://crates.io/crates/chrono) package.
83+
84+
This feature is disabled by default.
85+
6286
## What if a binding for the Qt C++ API you want to use is missing?
6387

64-
It is quite likely that you would like to call a particular Qt function wich is not wrapped by
88+
It is quite likely that you would like to call a particular Qt function which is not wrapped by
6589
this crate.
6690

6791
In this case, it is always possible to access C++ directly from your rust code using the cpp! macro.

0 commit comments

Comments
 (0)