-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
name: Qt | ||
doc_link: https://docs.sentry.io/platforms/native/guides/qt/ | ||
support_level: production | ||
type: framework | ||
--- | ||
|
||
Install the SDK by downloading the [latest release](https://github.com/getsentry/sentry-native/releases). Next, follow the | ||
instructions in the [_Native SDK Documentation_](/platforms/native/guides/qt/) to build the SDK library. | ||
|
||
Import and initialize the Sentry SDK early in your application setup: | ||
|
||
```cpp | ||
#include <QtWidgets> | ||
#include <sentry.h> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
sentry_options_t *options = sentry_options_new(); | ||
sentry_options_set_dsn(options, "___PUBLIC_DSN___"); | ||
sentry_init(options); | ||
|
||
// Make sure everything flushes | ||
auto sentryShutdown = qScopeGuard([] { sentry_shutdown(); }); | ||
|
||
QApplication app(argc, argv); | ||
/* ... */ | ||
return app.exec(); | ||
} | ||
``` | ||
Alternatively, the DSN can be passed as `SENTRY_DSN` environment variable during | ||
runtime. This can be especially useful for server applications. | ||
The quickest way to verify Sentry in your Qt application is by capturing a message: | ||
```c | ||
sentry_capture_event(sentry_value_new_message_event( | ||
/* level */ SENTRY_LEVEL_INFO, | ||
/* logger */ "custom", | ||
/* message */ "It works!" | ||
)); | ||
``` | ||
|
||
If you're new to Sentry, use the email alert to access your account and complete a product tour. | ||
|
||
If you're an existing user and have disabled alerts, you won't receive this email. |