add module :quick (quick, quickwidgets, qml) plus an example; lots of small revisions;

This commit is contained in:
polos 2017-01-16 12:00:00 +01:00
parent 4822a012c4
commit dfccd7eb17
102 changed files with 11973 additions and 6852 deletions

View file

@ -0,0 +1,31 @@
#include "lib.h"
QT_BEGIN_NAMESPACE
QObject* ini() {
static CPP* cpp = 0;
if(!cpp) {
cpp = new CPP; }
return cpp; }
static void _toGrayscale(QImage* image) {
if(image) {
// stolen from Stack Overflow
for(int y = 0; y < image->height(); y++) {
uchar* scan = image->scanLine(y);
int depth = 4;
for(int x = 0; x < image->width(); x++) {
QRgb* rgbpixel = reinterpret_cast<QRgb*>(scan + x * depth);
int gray = qGray(*rgbpixel);
*rgbpixel = QColor(gray, gray, gray).rgba(); }}}}
QImage CPP::toGrayscale(const QImage& image) {
QImage image2 = image;
image2.detach();
_toGrayscale(&image2);
return image2; }
void CPP::toGrayscaleReplace(QImage* image) {
_toGrayscale(image); }
QT_END_NAMESPACE