Skip to content

Instantly share code, notes, and snippets.

View jniemann66's full-sized avatar

Judd Niemann jniemann66

  • Melbourne
View GitHub Profile
@jniemann66
jniemann66 / QtBlockOnSignal.cpp
Last active June 21, 2017 22:41
Qt: Blocking wait for signal
// QMake: QT += testlib
#include <QSignalSpy>
QSignalSpy spy(someObject*, &someClass::someSignal);
spy.wait(2000 /* Timeout ms */);
@jniemann66
jniemann66 / Qt-productivity.md
Last active January 29, 2019 23:21
Qt Creator Productivity tips

Ctrl-K - open the locator

F4 - switch header / source

F2 - follow symbol under cursor

Shift-F2 - switch between function definition/declaration

Ctrl-Shift-U - find usages

@jniemann66
jniemann66 / windeployqt.md
Created July 28, 2017 05:19
Qt resolving dll dependencies for Windows

Qt for Windows Deployment Tool

example:

C:\Qt\5.8\msvc2015_64\bin\windeployqt.exe C:\Development\qt\build-SomeApp-Binaries\SomeApp.exe

if you have qml, use --qmldir to point to where your .qml files are:

@jniemann66
jniemann66 / KDE-Windows-shortcuts.md
Last active January 15, 2019 02:02
KDE windows shortcuts

some of the keyboard shortcuts on Windows are actually very good.

This is an ettempt to emulate some of them on KDE

use system settings (aka configure desktop)

global keyboard shortcuts

kwin

@jniemann66
jniemann66 / factorize.cpp
Created August 12, 2017 08:53
The way I factorize an integer into prime factors ...
// factorize() - factorize an integer into prime factors
std::vector<int> factorize(int n) {
std::vector<int> factors;
int maxFactor = std::sqrt(n);
for (int factor = 2; factor <= maxFactor; factor++) {
while (n % factor == 0) {
factors.push_back(factor);
n /= factor;
}
@jniemann66
jniemann66 / QtSignalFromObjC.md
Last active October 23, 2017 04:50
emitting Qt Signal from inside Obj-C++

in someheader.h (to be #included on the Qt/C++ side):


#include <QObject>

namespace SomeNamespace {

struct SomeViewControllerImpl;
@jniemann66
jniemann66 / cpp_singleton.h
Last active January 5, 2022 03:53
Singletons: (1) canonical GoF Singleton Pattern for C++ (2) Scott Meyer's (C++11) singleton
// http://www.gofpatterns.com/design-patterns/module3/cplus-plus-singleton.php
class Singleton {
private:
static Singleton* theInstance;
protected:
Singleton();
public:
static Singleton* getInstance(){
if (theInstance == 0 ) {
@jniemann66
jniemann66 / IOSLocationServiceSingleton.h
Last active November 5, 2017 22:45
C++ wrapper for iOS location service
#ifndef IOSLocationServiceSingleton_H
#define IOSLocationServiceSingleton_H 1
// locationservice.h : defines a CLLocationManager Singleton to share location services
@import Foundation;
@import CoreLocation;
@interface IOSLocationServiceSingleton : NSObject <CLLocationManagerDelegate>
+(IOSLocationServiceSingleton *) sharedInstance;