Skip to content

Instantly share code, notes, and snippets.

View chilarai's full-sized avatar
♠️
Ace of Spades

Chilarai Mushahary chilarai

♠️
Ace of Spades
View GitHub Profile
@chilarai
chilarai / main.cpp
Last active June 21, 2020 09:49
Qt5 Google OAuth: main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "googleauth.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
@chilarai
chilarai / main.qml
Last active June 21, 2020 09:51
Qt5 Google OAuth: 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 June 22, 2020 06:24
Qt5 Google OAuth : 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");
@chilarai
chilarai / Test.jsx
Created June 28, 2020 15:48
React: Sort table data on clicking table header
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 / mysqlmodel.h
Created July 12, 2020 05:13
mysqlmodel.h
#ifndef MYSQLMODEL_H
#define MYSQLMODEL_H
#include <QObject>
#include <QSqlQueryModel>
#include <QSqlRecord>
#include <QSqlField>
class MysqlModel : public QSqlQueryModel
{
@chilarai
chilarai / mysqlmodel.cpp
Created July 12, 2020 05:16
mysqlmodel.cpp
#include "mysqlmodel.h"
MysqlModel::MysqlModel(QObject *parent) : QSqlQueryModel(parent)
{
}
void MysqlModel::setQuery(const QString &query, const QSqlDatabase &db)
{
QSqlQueryModel::setQuery(query, db);
@chilarai
chilarai / main.cpp
Created July 12, 2020 05:18
Main.cpp for Qt - QSqlQueryModel - TableView
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QDebug>
#include "mysqlmodel.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
@chilarai
chilarai / main.qml
Created July 12, 2020 05:20
Main.qml for Qt - QSqlQueryModel - TableView
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 / csv.csv
Created March 30, 2021 08:52
Sample csv for testing Github API
a b c
1 2 3
@chilarai
chilarai / json.json
Last active March 30, 2021 08:53
Sample json to test github api
[
{
"name":"a",
"surname": "b"
}
]