Skip to content

Instantly share code, notes, and snippets.

// generated by quake, do not modify
unbindall
bind TAB "+scores"
bind ENTER "freecam"
bind ESCAPE "togglemenu"
bind SPACE "+moveup"
bind , "rewind 5"
bind - "rewind 0.3"
bind . "fastforward 5"
bind 0 "seeknext"
/*
* Spinlock based on Qt atomic operations. Should be fairly portable.
* To use it, it is recommended to use the SpinLock::Acquire helper
* class to follow RAII patterns, e.g.:
*
* static SpinLock g_myLock;
* // ...
*
* void foo() {
* do_seomething();
@photonlili
photonlili / Qt 5 Dark Fusion Palette
Created January 13, 2017 01:02 — forked from QuantumCD/Qt 5 Dark Fusion Palette
This is a complete (I think) dark color palette for the Qt 5 Fusion theme, as well as a nice style sheet for the tool tips that make them blend better with the rest of the theme. To have immediate effect, be sure to put this in your main function before showing the parent window. Child windows should automatically inherit the palette unless you …
qApp->setStyle(QStyleFactory::create("Fusion"));
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, QColor(25,25,25));
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
make CFG=release CFG_LINK=dynamic SA_DEFINE=SA_NO_TRIAL SA_CLIENT_ORACLE=1
./configure -no-gui -no-dbus -no-accessibility -nomake examples -nomake tests -no-opengl -skip multimedia -skip webkit -no-pkg-config -no-zlib -skip 3d -skip activeqt -skip androidextras -skip canvas3d -skip connectivity -skip declarative -skip doc -skip enginio -skip graphicaleffects -skip location -skip multimedia -skip qtquick1 -skip sensors -skip serialport -skip svg -skip imageformats -skip tools -skip wayland -skip webchannel -skip webengine -skip webkit -skip webkit-examples -skip websockets -skip winextras -skip x11extras -skip xmlpatterns -no-libjpeg -no-libpng -no-zlib -no-largefile -no-nis -no-qml-debug -no-harfbuzz -no-freetype -no-xcb -no-xkbcommon
@photonlili
photonlili / CheckedHeader.cpp
Last active February 15, 2022 08:42
QHeaderView with custom checkbox
#include "checkedheader.h"
#include <QDebug>
CheckedHeader::CheckedHeader(Qt::Orientation orientation, QWidget *parent)
: QHeaderView(orientation, parent)
{
connect(this, &CheckedHeader::sectionResized, [&](int logicalIndex, int oldSize, int newSize){
for( int i = visualIndex(logicalIndex); i < visibleCount(); ++i ){
int index = this->logicalIndex(i);
menuRect[index].moveTo(menuRect[index].x()+ newSize-oldSize, menuRect[index].y());
}
// sigslot.h: Signal/Slot classes
//
// Written by Sarah Thompson ([email protected]) 2002.
//
// License: Public domain. You are free to use this code however you like, with the proviso that
// the author takes on no responsibility or liability for any use.
//
// QUICK DOCUMENTATION
//
// (see also the full documentation at http://sigslot.sourceforge.net/)
#淘宝npm镜像
##搜索地址:http://npm.taobao.org/
##registry地址:http://registry.npm.taobao.org/
#npmjs镜像
##搜索地址:http://cnpmjs.org/
##registry地址:http://r.cnpmjs.org/
@photonlili
photonlili / QScriptEngine example
Created February 11, 2015 13:25
Using QScriptEngine
QScriptEngine engine;
QString func( "(1+2)*(3+(4*5))" );
QScriptValue result = engine.evaluate(func);
qDebug() << result.toNumber();
[].forEach.call($$("*"),function(a){
a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)
})