Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kernald on github.
  • I am kernald (https://keybase.io/kernald) on keybase.
  • I have a public key ASC6Q8bo2ALO7YbZz6FX1BwE4AzF8gr3K9C0PB2FGZHyQQo

To claim this, I am signing this object:

@Kernald
Kernald / settings.cpp
Created September 23, 2013 09:45
Qt settings handler, invokable from QML
#include "settings.hpp"
#include <QtCore/QSettings>
QVariant Settings::getValueFor(const QString &objectName, const QVariant &defaultValue) {
QSettings settings;
// If no value has been saved, return the default value
if (settings.value(objectName).isNull()) {
return defaultValue;
ScrollView {
scrollViewProperties.pinchToZoomEnabled: true
scrollViewProperties.initialScalingMethod: ScalingMethod.AspectFit
scrollViewProperties.minContentScale: 1
scrollViewProperties.maxContentScale: 10
scrollViewProperties.scrollMode: ScrollMode.Both
onContentScaleChanged: {
webView.settings.viewport = {
"initial-scale": scale
@Kernald
Kernald / convert.hpp
Created July 11, 2012 16:29
Conversions from T to std::string and from std::string to T
#ifndef __CONVERT_HPP__
#define __CONVERT_HPP__
#include <iostream>
#include <sstream>
#include <string>
#include <stdexcept>
/**
* \brief Conversion error exception