Skip to content

Instantly share code, notes, and snippets.

@cckwes
cckwes / main.cpp
Last active December 14, 2015 07:49
Tweak on the sailfishapplication to get rootContext working
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(Sailfish::createApplication(argc, argv));
//initialize the milk classes
MilkTask *mt = new MilkTask(qApp);
QScopedPointer<QDeclarativeView> view(Sailfish::createView());
//create the root context and set the context properties
@cckwes
cckwes / qjson_qt5.cpp
Last active December 22, 2015 07:08
QJson Qt5
#include <QApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonParseError>
#include <QFile>
#include <QDebug>
struct DeskWallpaper {
int width;
@cckwes
cckwes / cl_sample
Created May 22, 2015 09:03
OpenCL example C++
#include <iostream>
#include <CL/cl.hpp>
#include <QVector>
int main()
{
std::vector<cl::Platform> all_platforms;
cl::Platform::get(&all_platforms);
if (all_platforms.empty())
@cckwes
cckwes / dotpatternimage.py
Created May 24, 2015 01:18
Create dot pattern image using Python3 and PIL
from PIL import Image, ImageDraw
img = Image.open("beach.jpg")
pixels = img.load()
# Choose the pixelization length
pixelization_length = 6
# Define the pixelize and mask image
pixelize_image = Image.new('RGBA', img.size)
@cckwes
cckwes / lsqlrelationaltablemodel.cpp
Created May 24, 2015 09:52
QSqlRelationalTableModel expose to QML
#include <QSqlRecord>
#include "lqsqlrelationaltablemodel.h"
LQSqlRelationalTableModel::LQSqlRelationalTableModel(QObject *parent, QSqlDatabase db)
: QSqlRelationalTableModel(parent, db)
{
}
LQSqlRelationalTableModel::~LQSqlRelationalTableModel()
{
@cckwes
cckwes / build_opencv3.txt
Last active August 29, 2015 14:22
Guide to build opencv 3.0 in ubuntu 15.04
1.) Prepare by installing compiler and required library (optional is also installed for this tutorial)
sudo apt-get install build-essential cmake cmake-gui git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python3-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
2.) Clone the git repo
git clone https://github.com/Itseez/opencv.git
3.) Switch to the 3.0.0 tag
cd opencv/
git checkout 3.0.0