Skip to content

Instantly share code, notes, and snippets.

@ameerkahiri
ameerkahiri / style_Generic.css
Created August 2, 2021 08:56
ToDoApps : StyleSheet
* {
font: 10pt black "Verdana";
}
#ToDoAppsClass {
background-color: #003049;
}
#ToDoAppsClass #TitleBarFrame {
background-color: #9ed9f8;
@ameerkahiri
ameerkahiri / ToDoApps.cpp
Created August 2, 2021 07:43
ToDoApps : SlotDeleteTask
void ToDoApps::SlotDeleteTask() {
// Get the sender widget
QPushButton* fromButton = (QPushButton*)sender();
// Get the widget referenced in the property
QVariant var;
var = fromButton->property("CurrentTask");
QFrame* taskHBox = qvariant_cast<QFrame*>(var);
@ameerkahiri
ameerkahiri / ToDoApps.cpp
Created August 2, 2021 07:43
ToDoApps : createNewTask
// This is the part where widget created using code / the reference is in .ui file
void ToDoApps::createNewTask(QString taskName, QString date) {
{
// The hierarchy of this widget will be like this
/*
+ Hframe (Frame)
+ Vframe (Frame)
+ titlelabel (Label)
+ tasklabel (Label)
@ameerkahiri
ameerkahiri / ToDoApps.cpp
Created August 2, 2021 07:42
ToDoApps : SlotAddNewTask
void ToDoApps::SlotAddNewTask() {
// Get the line edit text
QString taskName = ui.NewTaskLineEdit->text();
// Get current date
QString date = QDate::currentDate().toString();
createNewTask(taskName, date);
// This is how to trigger signal
@ameerkahiri
ameerkahiri / ToDoApps.cpp
Created August 2, 2021 07:41
ToDoApps : initStysheet
void ToDoApps::initStylesheet() {
// You have to create the css file first in the main project directory
// Get the css file
QFile style("style_Generic.css");
bool ok = style.open(QFile::ReadOnly);
QString s = QString::fromLatin1(style.readAll());
setStyleSheet(s);
@ameerkahiri
ameerkahiri / ToDoApps.cpp
Last active August 2, 2021 07:45
ToDoApp : Constuctor
ToDoApps::ToDoApps(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
// Set stylesheet
initStylesheet();
// Connect the add new task button
connect(ui.AddNewBtn, SIGNAL(clicked()), this, SLOT(SlotAddNewTask()));
@ameerkahiri
ameerkahiri / ToDoApps.h
Last active August 2, 2021 07:28
ToDoApps header file
#pragma once
#include <QtWidgets/QWidget>
#include "ui_ToDoApps.h"
#include <QDate>
#include <QDir>
class ToDoApps : public QWidget
{
Q_OBJECT
@ameerkahiri
ameerkahiri / MyQuaternion.cs
Created February 18, 2021 09:46 — forked from JakubNei/MyQuaternion.cs
A custom completely managed implementation of UnityEngine.Quaternion. Base is decompiled UnityEngine.Quaternion. Doesn't implement methods marked Obsolete. Does implicit coversions to and from UnityEngine.Quaternion
using System;
using UnityEngine.Internal;
using UnityEngine;
using System.Runtime.Serialization;
using System.Xml.Serialization;
/// <summary>
/// Quaternions are used to represent rotations.
/// A custom completely managed implementation of UnityEngine.Quaternion
/// Base is decompiled UnityEngine.Quaternion