Skip to content

Instantly share code, notes, and snippets.

View SC-One's full-sized avatar
✌️
GoingOn

Heydar Mahmoodi SC-One

✌️
GoingOn
View GitHub Profile
QFileDialog *f = new QFileDialog();
f->setOption(QFileDialog::DontUseNativeDialog, true); // we need qt layout
QGridLayout *layout = static_cast<QGridLayout *>(f->layout());
QList<QPair<QLayoutItem *, QList<int> > > moved_items;
f->show();
for (int i = 0; i < layout->count(); i++) {
int row, column, rowSpan, columnSpan;
layout->getItemPosition(i, &row, &column, &rowSpan, &columnSpan);
//IconLabel is subclass of QLabel
//Note: if you wanna keep Quality , you should create pixmap for all sizes (so override resizeEvent !)
// this method is working normally
QPixmap IconLabel::FromSvgToPixmap(const QString &SvgFile,
const QSize &ImageSize) {
QSvgRenderer SvgRenderer(SvgFile);
QPixmap Image(ImageSize);
QPainter Painter;
Image.fill(Qt::transparent);
.bglrtl
{
font-size:17px;
margin-right:137px;
margin-left:157px;
}
@SC-One
SC-One / CollapsedWidget.hpp
Created February 5, 2022 17:44
Collapsed widget in qt with animation
#ifndef COLLAPSED_WIDGET_H
#define COLLAPSED_WIDGET_H
#include <QFrame>
#include <QGridLayout>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QScrollArea>
#include <QToolButton>
#include <QWidget>
@SC-One
SC-One / TwoFilesInONe.CMAKE
Created February 14, 2022 16:18
add rapidjson from cmake (direct download rapidjson in CMake)
# Download RapidJSON
ExternalProject_Add(
rapidjson
PREFIX "vendor/rapidjson"
GIT_REPOSITORY "https://github.com/Tencent/rapidjson.git"
GIT_TAG f54b0e47a08782a6131cc3d60f94d038fa6e0a51
TIMEOUT 10
CMAKE_ARGS
-DRAPIDJSON_BUILD_TESTS=OFF
-DRAPIDJSON_BUILD_DOC=OFF
@SC-One
SC-One / config.clang-format
Last active March 4, 2022 14:36
Clang-format config file
# Checkout config tool: https://zed0.co.uk/clang-format-configurator/
# Or http://cf.monofraps.net/
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# https://github.com/01org/parameter-framework/blob/master/.clang-format
# Tested on: clang-format version 6.0.1
# Common settings
BasedOnStyle: WebKit
@SC-One
SC-One / TemplateBaseBenchmark.cpp
Last active April 16, 2022 12:01
Template base benchmark (google)
//https://github.com/google/benchmark/issues/1157
#include <benchmark/benchmark.h>
#include <vector>
#include <future>
#include <numeric>
#include <span>
using NumberType = float;
using ReduceType = double;
@SC-One
SC-One / AutomaticPageRefresher.js
Created August 3, 2022 19:03
Automatic refresh window in js (usecase: browser console)
win1 = window.open("https://www.binance.com/en/price/binance-usd")
var windowObject = win1.document
var counter = 0
timer1 = setInterval(function() {
win1.location.href = "https://www.binance.com/en/price/binance-usd"
counter++
console.log("Counter: ", counter)
// if (windowObject < win1.document || windowObject > win1.document) {
// alert("Hi diffrent page")
// }
@SC-One
SC-One / gist:e55b30df1b85f2ff675bf2e44feae959
Created September 29, 2022 09:11 — forked from royshil/gist:6318407
A CMake Find module for FFMPEG that will tear the HD apart looking for the libs and includes ;)
# - Try to find FFMPEG
# Once done this will define
# FFMPEG_FOUND - System has FFMPEG
# FFMPEG_INCLUDE_DIRS - The FFMPEG include directories
# FFMPEG_LIBRARIES - The libraries needed to use FFMPEG
# FFMPEG_LIBRARY_DIRS - The directory to find FFMPEG libraries
#
# written by Roy Shilkrot 2013 http://www.morethantechnical.com/
#
@SC-One
SC-One / AwesomeStruct.cpp
Created November 16, 2022 15:30 — forked from hanzochang/AwesomeStruct.cpp
[UE4(Unreal Engine 4)] Example for parsing json and creating struct instance from parsed json.
#include "ProcedualSpline.h"
#include "AwesomeStruct.h"
FAwesomeStruct FAwesomeStruct::BuildAwesomeStruct(
FVector AwesomeVector,
bool AwesomeBoolean,
float AwesomeFloat,
int32 AwesomeInteger,
FRotator AwesomeRotator
)