Skip to content

Instantly share code, notes, and snippets.

#include <QApplication>
#include <QFileDialog>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QFileDialog dialog(0, "Test Dialog");
dialog.setConfirmOverwrite(true);
dialog.setAcceptMode(QFileDialog::AcceptSave);
int someParam = 1;
auto future = QtConcurrent::run(doHeavyStuff);
auto watcher = new QFutureWatcher<ResultType>(this);
connect(watcher, &QFutureWatcher<ResultType>::finished, [future, someParam]() {
// Do stuff here, you have the return value of doHeavyStuff in future.result()...
});
connect(watcher, &QFutureWatcher<ResultType>::finished,
auto future = QtConcurrent::run(doHeavyStuff);
auto watcher = new QFutureWatcher<ResultType>(this);
connect(watcher, &QFutureWatcher<ResultType>::finished, [future]() {
// Do stuff here, you have the return value of doHeavyStuff in future.result()...
});
connect(watcher, &QFutureWatcher<ResultType>::finished,
watcher, &QFutureWatcher<ResultType>::deleteLater);
@estan
estan / Plugin.h
Last active October 29, 2017 11:15
#pragma once
#include "pluginsystem_export.h"
#include <QObject>
#include <QtPlugin>
namespace PluginSystem {
class PluginData;
@estan
estan / bug.out.txt
Created October 24, 2017 08:52
renameat2 bug
[estan@newton renameat2tc]$ ls
totalt 24
-rw-rw-r-- 1 estan estan 6 okt 24 10:51 foo
-rw-rw-r-- 1 estan estan 317 okt 24 10:49 renameat2.c
[estan@newton renameat2tc]$ cat foo
hello
[estan@newton renameat2tc]$ cat renameat2.c
#include <string.h>
#include <errno.h>
#include <stdio.h>
@estan
estan / logcat.pro
Last active October 22, 2017 14:49
######################################################################
# Automatically generated by qmake (3.0) s�n okt. 22 16:45:15 2017
######################################################################
TEMPLATE = app
TARGET = logcat
INCLUDEPATH += .
# Input
SOURCES += main.cpp
@estan
estan / Reverse.h
Created October 22, 2017 08:20
reverse(..) helper for range-based for
#pragma once
#include <iterator>
// Reversed iterator
template <typename T>
struct reversion_wrapper {
T& iterable;
};
gitlab:
image: 'gitlab/gitlab-ce:10.0.3-ce.0'
container_name: 'gitlab'
restart: always
hostname: 'git.ourdomain.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://git.ourdomain.com'
gitlab_rails['smtp_enable'] = true
#
# PluginDataTest
#
add_executable(PluginDataTest
PluginLoaderMock.h
PluginDataTest.cpp
)
target_link_libraries(PluginDataTest PRIVATE
pluginsystem
@estan
estan / note.md
Created September 30, 2017 09:22
note for GitLab commit comments API

Code format violations were found. Corrections shown below.

Please fix these with clang-format -i src/main.cpp src/libs/pluginsystem/tests/PluginLoaderMock.h src/model/Expiration.h

--- src/main.cpp        2017-09-29 17:30:13.268120302 +0200
+++ -   2017-09-30 11:20:33.636533822 +0200
@@ -24,7 +24,7 @@
 
 static QtMessageHandler defaultMessageHandler = qInstallMessageHandler(nullptr);