Skip to content

Instantly share code, notes, and snippets.

@trots
trots / app.log
Created October 22, 2023 07:28
Using Qt Logging system to log into a file
2023-10-22 10:26:29,064 [info] default: First Info message
2023-10-22 10:26:29,064 [warning] default: First Warning message
2023-10-22 10:26:29,064 [critical] default: First Critical message
2023-10-22 10:26:29,064 [fatal] default: First Fatal message
2023-10-22 10:26:30,402 [info] app: Info message with category
2023-10-22 10:26:30,407 [warning] app: Warning message with category
2023-10-22 10:26:30,407 [critical] app: Critical message with category
2023-10-22 10:26:30,407 [debug] test: Debug message with category
2023-10-22 10:26:30,407 [info] test: Info message with category
2023-10-22 10:26:30,407 [warning] test: Warning message with category
@trots
trots / boost_phrase_parser_bool_flag.cpp
Created October 13, 2023 09:24
Problem of interpreting bool values in boost::spirit::qi::phrase_parse
#include <boost/spirit/include/qi.hpp>
using namespace boost::spirit::qi;
// Wrapping strings with the `qi::string()` leads to the problem of bool attributes interpreting by `qi::phrase_parse()`.
// Don't use the `string()` wrapper when you tries to interpret bool attributes.
int main()
{
std::string entries[] = {"log on", "log off", "log bad"}; // test cases
@trots
trots / qjsengine_in_pyside_example.py
Last active September 9, 2023 22:44
Working with QJSEngine in PySide6
from PySide6.QtCore import QCoreApplication, QObject, Slot
from PySide6.QtQml import QJSEngine
# Define class with invokable methods
class MyObject(QObject):
def __init__(self, parent = None):
super().__init__(parent)
@Slot()