ddobrev/QtSharp

First app

KeKl opened this issue · 10 comments

KeKl commented

Hi,

after creating the wrapper I tried my first program.

    unsafe static int Main(string[] args)
        {
        int argc = args.Length;

        string[] argv = new string[args.Length + 1];

        var a = System.Reflection.Assembly.GetEntryAssembly();

        if (a == null)
            a = System.Reflection.Assembly.GetExecutingAssembly();

        var attrs = a.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);

        if (attrs.Length > 0)
            argv[0] = ((AssemblyTitleAttribute)attrs[0]).Title;

        args.CopyTo(argv, 1);

        var p = Marshal.StringToHGlobalAuto(argv[0]);
        var charp = (char*)p;
        var k = (char*)p;
        Marshal.FreeHGlobal(p);


        QCoreApplication app = new QCoreApplication(&argc, &k);

        QDate date = new QDate();
        date.AddDays(5);
        date.AddMonths(5);

        var day = date.Day;    

        return QCoreApplication.Exec();
    } 

I have following problems:

  • the children property of app throws System.NullReferenceException
  • the DynamicPropertyNames property of app throws System.AccessViolationException
  • AddDays throw PInvokeStackImbalance Exception

Do I have miss something or is this the field of future work?

Thank you.

1 is a known bug and so is 2. 3 I hadn't encountered, thank you. I'm taking these as bug reports and will let you know as soon as they're fixed.

KeKl commented

Ok.

In the meantime I created a fork. I will write some Unit Tests with NUnit. If you have any suggestions... youre welcome.

KeKl commented

Why is the class QString internal? Will it be available in future, or should the QStringRef/StringBuilder used instead?

It is mapped to System.String. Do you need QString explicitly?

KeKl commented

No I don´t. Is it planned to do this also for QChar or any other type?

In my test project I will add tests from time to time. I have a [Ignore("Bug!")]-Attribute. This means VS will freeze if I run the test, either a binding-bug or a test-bug.
I also have a To-Do list, where I will write some suggestions for improving the bindings.

It's been planned for the following types so far: QChar, QHash, QMap, QList (there's one type map not working yet) and QDate,

Great news about the collection of bugs and the TODO list! This will be very helpful for Qt#, thank you very much for your effort.

It's really nice to hear you've got some documentation done. I'd really love to see it. I am afraid, however, that I am not well familiar with GitHub's interface so I think search engines can help you better than I can.

By the way, your message hasn't appeared on GitHub, it's really strange.

On Friday, September 19, 2014 8:19 AM, Kevin notifications@github.com wrote:

I have written some documentation. Is it possible to get the control for adding some sidebar etc. in the wiki?

Reply to this email directly or view it on GitHub.

KeKl commented

Me too. I did it in Word, so I will try to substantially upload it.

KeKl commented

Can you add me as a contributor? I would like to commit my tests to the main repo.

@KeKl thank you very much for your tests. However, I would rather prefer you sent pull requests for the first few times because I'd like to review them a little. After a few iterations, if your work has been mostly flawless, I'll add you as a contributor. What do you think?