Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing & Fixing

Chilarai chilarai

🎯
Focusing & Fixing
View GitHub Profile
@chilarai
chilarai / csv.csv
Created Mar 30, 2021
Sample csv for testing Github API
View csv.csv
a b c
1 2 3
@chilarai
chilarai / json.json
Last active Mar 30, 2021
Sample json to test github api
View json.json
[
{
"name":"a",
"surname": "b"
}
]
@chilarai
chilarai / main.qml
Created Jul 12, 2020
Main.qml for Qt - QSqlQueryModel - TableView
View main.qml
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.4
Window {
visible: true
width: 640
height: 480
title: qsTr("QSqlQueryModel - TableView")
@chilarai
chilarai / main.cpp
Created Jul 12, 2020
Main.cpp for Qt - QSqlQueryModel - TableView
View main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QDebug>
#include "mysqlmodel.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
View mysqlmodel.cpp
#include "mysqlmodel.h"
MysqlModel::MysqlModel(QObject *parent) : QSqlQueryModel(parent)
{
}
void MysqlModel::setQuery(const QString &query, const QSqlDatabase &db)
{
QSqlQueryModel::setQuery(query, db);
View mysqlmodel.h
#ifndef MYSQLMODEL_H
#define MYSQLMODEL_H
#include <QObject>
#include <QSqlQueryModel>
#include <QSqlRecord>
#include <QSqlField>
class MysqlModel : public QSqlQueryModel
{
@chilarai
chilarai / Test.jsx
Created Jun 28, 2020
React: Sort table data on clicking table header
View Test.jsx
import React, { Component } from "react";
class Test extends Component {
handleSort = (param) => {
let stateFlag = { ...this.state.flags };
// Reset all flags
stateFlag.Id = false;
stateFlag.FirstName = false;
stateFlag.LastName = false;
@chilarai
chilarai / testing.h
Created Jun 21, 2020
Qt5 Google OAuth: Testing.h
View testing.h
#ifndef TESTING_H
#define TESTING_H
#include <QObject>
#include <QOAuth2AuthorizationCodeFlow>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QUrl>
@chilarai
chilarai / main.qml
Last active Jun 21, 2020
Qt5 Google OAuth: main.qml
View main.qml
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.5
Window {
visible: true
width: 640
height: 480
title: qsTr("Google OAuth Test")
@chilarai
chilarai / testing.cpp
Last active Jun 22, 2020
Qt5 Google OAuth : Testing.cpp
View testing.cpp
//Constructor
Testing::Testing(QObject *parent) : QObject(parent)
{
this->google = new QOAuth2AuthorizationCodeFlow(this);
// Set Scope or Permissions required from Google
// List can be obtained from https://developers.google.com/identity/protocols/oauth2/scopes
this->google->setScope("email https://www.googleapis.com/auth/drive.readonly");