Skip to content

Commit c254e75

Browse files
committed
added qt5 console application
1 parent 37f5513 commit c254e75

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ finally run `./main` to see the ultimate answer:
1717
42
1818

1919
## go programs
20-
## qt programs
20+
## qt program
21+
22+
this example features a qt5 console application `console`:
23+
24+
run `cd qt-program` and `nix-shell` to get a qt5 including environment. afterwards
25+
run `qmake` and `make` to generate the console binary. finally run `./console` to obtain:
26+
27+
hello beautiful world, from #cccamp2015!
28+
2129
## perl
2230
## python
2331
enter environment by typing `nix-shell` in ./python-program

qt-program/console.pro

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
QT += core
2+
QT -= gui
3+
4+
TARGET = console
5+
CONFIG += console
6+
CONFIG -= app_bundle
7+
8+
TEMPLATE = app
9+
10+
SOURCES += main.cpp

qt-program/default.nix

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
with import <nixpkgs> { };
2+
3+
stdenv.mkDerivation rec {
4+
name = "myprogram-${version}";
5+
version = "0.0.1";
6+
7+
buildInputs = [ qt53 ];
8+
}
9+

qt-program/main.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <QDebug>
2+
3+
int main(int argc, char *argv[]) {
4+
qDebug() << "hello beautiful world, from #cccamp2015!" << endl << endl;
5+
return 0;
6+
}

0 commit comments

Comments
 (0)