Skip to content

Instantly share code, notes, and snippets.

View HamedMasafi's full-sized avatar
😀
Ready to talk

Hamed Masafi HamedMasafi

😀
Ready to talk
View GitHub Profile
@HamedMasafi
HamedMasafi / ShapeSample.qml
Created December 31, 2017 07:38
Shape in canvas sample
import QtQuick 2.0
Item {
Canvas {
id: mycanvas
contextType: "2d"
anchors.fill: parent
Path{
id: path
// Example program
#include <iostream>
#include <string>
float n;
float p;
float f0;
float f(int k) {
if ( k == 0 )
@HamedMasafi
HamedMasafi / IranFlag.asm
Created March 31, 2018 19:59
Iran's flag assembly sample code
;----------------------------------
;
; Iran flag
; Hamed Masafi
; Hamed.Masafi@GMail.com
;
;----------------------------------
stacksg segment stack
db 32 dup("stack---")
import QtQml 2.2
import QtQuick 2.12
import QtQuick.Shapes 1.0
import QtQuick.Window 2.2
Item {
width: 300
height: 300
Shape {
import QtQuick 2.12
import QtQuick.Window 2.12
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Text {
#pragma once
#define CONCAT_DETAIL(l, r) l##r
#define CONCAT(l, r) CONCAT_DETAIL(l, r)
#define COUNT_N(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
#define COUNT_M(...) EXPAND(COUNT_N( __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
#define VA_NARGS(...) CALL(COUNT_M,(, __VA_ARGS__))
#define CALL(X,Y) X Y
#define EXPAND(...) __VA_ARGS__
#define CALL_N(N, X, V) CALL(CONCAT(N,X),(V))
@HamedMasafi
HamedMasafi / main.cpp
Created December 11, 2019 09:24
read snss
#include "mainwindow.h"
#include <QtWidgets/QApplication>
#include <QFile>
#include <QDebug>
struct FileHeader {
qint32 signature;
qint32 version;
};
@HamedMasafi
HamedMasafi / main.cpp
Created January 7, 2020 08:32
QCalendar and jalali calendar in Qt 5.14
#include <QCoreApplication>
#include <QCalendar>
#include <QDate>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QCalendar cal(QLatin1String("jalali"));
@HamedMasafi
HamedMasafi / Input.qml
Last active January 13, 2020 08:58
Dynamic form
import QtQuick 2.0
import QtQuick.Controls 2.12
Item {
id: input
property string type: ""
property string text: ""
property string name: ""
property alias radio: radio
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.3
Popup {
id: globalPopUpDialog
property var title : "Unknown title"