diff --git a/.gitignore b/.gitignore index 8335ee1..9150b6b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ examples/helloworld/helloworld examples/helloworld/helloworld.exe examples/mdoutliner/mdoutliner examples/mdoutliner/mdoutliner.exe +examples/windowsmanifest/windowsmanifest +examples/windowsmanifest/windowsmanifest.exe \ No newline at end of file diff --git a/README.md b/README.md index 61d68ec..74ed8ad 100644 --- a/README.md +++ b/README.md @@ -89,3 +89,5 @@ For dynamically-linked builds (closed-source or open source application): 3. Copy necessary Qt LGPL libraries. For repeated builds, the compile speed can be improved if you also bind-mount the Docker container's `GOCACHE` directory: `-v $(pwd)/container-build-cache:/root/.cache/go-build` + +To add an icon and other properties to the .exe, you can use [the go-winres tool](https://github.com/tc-hib/go-winres). See the `examples/windowsmanifest` for details. diff --git a/examples/windowsmanifest/app_icon.png b/examples/windowsmanifest/app_icon.png new file mode 100644 index 0000000..d9dd01c Binary files /dev/null and b/examples/windowsmanifest/app_icon.png differ diff --git a/examples/windowsmanifest/main.go b/examples/windowsmanifest/main.go new file mode 100644 index 0000000..1aa7bd2 --- /dev/null +++ b/examples/windowsmanifest/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "os" + + "github.com/mappu/miqt/qt" +) + +func main() { + + qt.NewQApplication(os.Args) + + btn := qt.NewQPushButton2("Hello world!") + btn.SetFixedWidth(320) + + var counter int = 0 + + btn.OnPressed(func() { + counter++ + btn.SetText(fmt.Sprintf("You have clicked the button %d time(s)", counter)) + }) + + btn.Show() + + qt.QApplication_Exec() + + fmt.Println("OK!") +} diff --git a/examples/windowsmanifest/rsrc_windows_amd64.syso b/examples/windowsmanifest/rsrc_windows_amd64.syso new file mode 100644 index 0000000..d5bdf63 Binary files /dev/null and b/examples/windowsmanifest/rsrc_windows_amd64.syso differ diff --git a/examples/windowsmanifest/winres.json b/examples/windowsmanifest/winres.json new file mode 100644 index 0000000..c054c19 --- /dev/null +++ b/examples/windowsmanifest/winres.json @@ -0,0 +1,54 @@ +{ + "RT_GROUP_ICON": { + "APP": { + "0000": "app_icon.png" + } + }, + "RT_VERSION": { + "#1": { + "0000": { + "fixed": { + "file_version": "1.2.3.4", + "product_version": "1.2.3.42" + }, + "info": { + "0409": { + "Comments": "MIQT Sample comment", + "CompanyName": "MIQT Sample company", + "FileDescription": "MIQT Sample description", + "FileVersion": "1.2.3.4", + "LegalCopyright": "MIQT Sample copyright", + "LegalTrademarks": "MIQT Sample trademarks", + "ProductName": "MIQT Sample product", + "ProductVersion": "MIQT Sample product version" + } + } + } + } + }, + "RT_MANIFEST": { + "#1": { + "0409": { + "identity": { + "name": "", + "version": "" + }, + "description": "", + "minimum-os": "win7", + "execution-level": "as invoker", + "ui-access": false, + "auto-elevate": false, + "dpi-awareness": "per monitor v2", + "disable-theming": false, + "disable-window-filtering": false, + "high-resolution-scrolling-aware": false, + "ultra-high-resolution-scrolling-aware": false, + "long-path-aware": false, + "printer-driver-isolation": false, + "gdi-scaling": false, + "segment-heap": false, + "use-common-controls-v6": true + } + } + } +} \ No newline at end of file