Skip to content

Instantly share code, notes, and snippets.

View SC-One's full-sized avatar
🫏

Heydar Mahmoodi SC-One

🫏
View GitHub Profile
@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 / 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 / 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>
.bglrtl
{
font-size:17px;
margin-right:137px;
margin-left:157px;
}
//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);
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);