qmlnet/src/net/Qml.Net/Qt.cs
Max Mommersteeg aea05038d3 # This is a combination of 16 commits.
parent 656bc5668f
author Max Mommersteeg <maxmommersteeg@hotmail.com> 1545596313 +0100
committer Max Mommersteeg <maxmommersteeg@hotmail.com> 1545601051 +0100

# This is a combination of 2 commits.
# This is the 1st commit message:

Updated xunit NuGet packages.

# This is the commit message #1:

Corrected csproj.

# This is the commit message #2:

Corrected csproj.

# This is the commit message #3:

Making any null object types return "null", instead of "undefined".


# This is the commit message #4:

Fixing windows build

# This is the commit message #5:

Added a unit test for a previous commit.


# This is the commit message #6:

Added support for registering static types.


# This is the commit message #7:

Updated appveyor build script to use MSVC2017

# This is the commit message #8:

NetVariant Refactoring
- Added support for long, unsigned long and float
- Code style unifications
- Treat (almost) all types the same
- Use correctly sized ints
- removed dynamic_casts where unnecessary
- reduced warnings
- micro optimizations
- some code modernizations
- improved const correctness

# This is the commit message #9:

Help the compiler help us

# This is the commit message #10:

Ran clang-tidy and fixed some reported issues

# This is the commit message #11:

Removed now obsolete arguments

Note: QGuiApplication.Exec(), Exit() and Quit() should be static, but I am not sure how much code that would break.

# This is the commit message #12:

Use delete[] to avoid undefined behavior

# This is the commit message #13:

Avoid -Wweak-vtables warning

# This is the commit message #14:

Relaxed assertion that was a little too enthusiastic

# This is the commit message #15:

Removed the dependency of ADL.
2018-12-23 22:39:52 +01:00

37 lines
1.1 KiB
C#

using Qml.Net.Internal;
using System;
using System.Runtime.InteropServices;
namespace Qml.Net
{
public class Qt
{
public static bool PutEnv(string name, string value)
{
return Interop.QtInterop.PutEnv(name, value);
}
public static string GetEnv(string name)
{
return Utilities.ContainerToString(Interop.QtInterop.GetEnv(name));
}
public static Version GetQtVersion()
{
return Version.Parse(Utilities.ContainerToString(Interop.QtInterop.QtVersion()));
}
}
internal class QtInterop
{
[NativeSymbol(Entrypoint = "qt_putenv")]
public PutEnvDel PutEnv { get; set; }
public delegate bool PutEnvDel([MarshalAs(UnmanagedType.LPStr)]string name, [MarshalAs(UnmanagedType.LPStr)]string value);
[NativeSymbol(Entrypoint = "qt_getenv")]
public GetEnvDel GetEnv { get; set; }
public delegate IntPtr GetEnvDel(string name);
[NativeSymbol(Entrypoint = "qt_version")]
public QtVersionDel QtVersion { get; set; }
public delegate IntPtr QtVersionDel();
}
}