Documentation
dsoronda opened this issue · 21 comments
This project really needs some documentation. I don't even know where to start first.
Where is QtCoreSharp.dll ? How to build it ? Does it requires CppSharp ? Should we first build CppSharp (and LLVM) ? What is build command for QtCoreSharp?
Please, I want to help, but I need some starting tips.
Hi,
garlicbready did some documentation on his fork:
https://github.com/garlicbready/QtSharp/wiki
@dsoronda Thank you for your feedback. I would agree with you, a little more documentation will help a lot. I'll try finding some time to either write some or merge some of @garlicbready 's work.
for info I've moved the documentation here and updated it a bit
https://github.com/garlicbready/QtSharp/tree/master/docs
https://github.com/garlicbready/QtSharp/blob/master/docs/ReadMe.Gbd.md
To get something that just builds I'd stick with the CppSharp dll's from ddobrev initially, then move onto trying to build your own from the latest CppSharp code
Hi! I am interested in this project. But just like @dsoronda I am having trouble to start. Every link given above is broken.
I found https://github.com/manikk/QtSharpExamples (and latest commit was 9 months ago) and https://github.com/grbd/QtSharp.TestApps (latest commit was 6 months ago) and that's all.
Are there any resources/links that I can study to start? Please, some basic documentation for newbies would be very welcome.
Thanks a lot.
@oscarvarto documentation is indeed lacking but what time I can spare all goes to coding. Nevertheless, there's a way to start if you work on Windows. First, please download the latest release from https://github.com/ddobrev/QtSharp/releases and then you can use the projects you linked to see some code. Please note that in addition to the bindings you need to obtain and deploy Qt itself. You need to download Qt for MinGW from its web site at https://www.qt.io/download-open-source/#section-2 and then deploy it with your application according to https://doc.qt.io/qt-5/windows-deployment.html#application-dependencies .
@ddobrev I completely understand your point. However, how if you had more contributors? Wouldn't some docs help people get interested more easily? The time you invest may multiple the number of people helping to code.
@oscarvarto You are correct, of course, but, you see, it's a little of a chicken-or-egg problem. To get it to work, I need contributors, and to get contributors, I need it to work at least a little. Besides, my goal is not to force users to generate and compile Qt# themselves but rather just use the binary downloads to get to programming straight away. Anyway, Qt# can definitely be generated on Windows so I think I'll have some time to create a small manual for it by the end of the day.
This is good news but I have question for @ddobrev
If you can build binaries for Qt for Windows for MinGW why don't you post them somewhere so we could stat to use them for testing like Dropbox share or something?
Also for @ddobrev , documentation is pretty old and references VS 2013 and link to Qt libraries in documentation points to invalid address in Documentation - 1. Building - QtSharp.md.
I would like to help so lets break chicken-egg problem by fixing documentation so more people will come.
I'm installing latest Qt and will try do document all steps and failures i found in process.
@dsoronda I post binaries here at GitHub, you can find them as official releases https://github.com/ddobrev/QtSharp/releases .
@dsoronda about generating Qt# yourself, it should be pretty simple:
- Install Qt for MinGW after downloading it from https://www.qt.io/download-open-source/#section-2 ;
- Check out the source code on Windows 64-bit and build it (CppSharp is now a NuGet dependency so it will be automatically downloaded);
- Run QtSharp.CLI (the command-line client) by passing the paths to make (named mingw32-make in Qt for MinGW) and qmake from your Qt installation.
I'll copy the steps above to the documentation when I have some time.
Hi guys,
I'm trying to build basic Qt gui app and it throws error that Qt5Widgets.dll is missing.
This is error:
An unhandled exception of type 'System.DllNotFoundException' occurred in QtWidgetsSharp.dll
Additional information: Unable to load DLL 'Qt5Widgets': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
What is basic DLL requirement list to run Qt app ?
this is source:
namespace QtTest
{
using QtCore;
using QtWidgets;
class Program
{
static void Main(string[] args)
{
//new QApplication(args);
var w = new QtFormDemo();
//return QApplication.Exec();
Console.WriteLine("All done");
Console.ReadKey();
}
}
class QtFormDemo : QtWidgets.QWidget
{
public QtFormDemo()
{
WindowTitle = "TEST";
ToolTip = "This is QT Qwidget";
Show();
}
}
}
@dsoronda since you are using QtWidgets;
QtSharp depends on the Qt5Widgets.dll. If it cannot find where that is (perhaps it is not in your binary search path?) then it will raise an exception similar to the one you are getting. If you locate the DLL and add that path to your binary search path, you should no longer receive that error.
Also, if you want to paste code, I suggest that you indent it 4 spaces so that it is formatted nicely. I use this tool to do it for me.
@dsoronda @ethanhs is right. You need Qt5Widgets and its dependencies in your path or next to your executable. For more details please see https://doc.qt.io/qt-5/windows-deployment.html#application-dependencies .
I'm sorry that I wasn't more specific but i did manually copy Qt5Widgets.dll from Qt installation directory : d:\Qt\Qt5.7.0\5.7\mingw53_32\bin and i added it to my user PATH. Problem was I added it AFTER I started VS so VS didn't see Qt in path.
I also copied this files : CppSharp.Runtime.dll , Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll, QtCoreSharp.dll, QtGui-inlines.dll, QtGuiSharp.dll, QtWidgets-inlines.dll , QtWidgetsSharp.dll into my bin\debug folder.
Just to note: I'm trying to reuse code from this tutorial :
Introduction to Qyoto
So I managed to get my first Qt app to run and now i have question :
Can we get something like :
public QApplication(string[] args)
in wrapper ?
Can we get rid of unsafe part ?
this is my code :
` using System;
using QtCore;
using QtWidgets;
namespace QtTest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
int count = 0;
unsafe
{
var qtApp = new QApplication(ref count, null);
}
var w = new QtFormDemo2();
QApplication.Exec();
Console.WriteLine("All done");
Console.ReadKey();
}
}
class QtFormDemo2 : QtWidgets.QWidget
{
public QtFormDemo2()
{
WindowTitle = "TEST";
ToolTip = "This is QT Qwidget";
Resize(250, 150);
Show();
}
}
}
`
So, my plan is to go thru examples from link above and post some screenshots and write simple step by step documentation.
Any suggestions how we can continue with this issue ?
PS. Nuget package is very old and QtWidgets.QWidget namespace is messed up. Can you update nuget package please.
- Yes, we can have something better than IntPtr, if not string[], StringBuilder[]. However, it requires a C++# feature which has not been completed yet. As soon as it is, I'll regenerate Qt# and update the release;
- "unsafe" will no longer be necessary once 1. is done;
- The current NuGet package is really old and most probably has unacceptable bugs. I am going to update it as soon as I have the time. Meanwhile the GitHub release is the best available binary version;
- The one particular idea about documentation I find most useful is examples. They help both users to get started and developers (me) find bugs and inconvenient API-s. So I welcome your suggestion about browsing and possibly porting the samples used for Qyoto back then.
Hi,
I created QtSharpDemos project. I'm planning to add as many code snippets as possible but I'll need help since I don't have much experience with Qt.
I'll appreciate any suggestion, code example, etc.
So, who knows, maybe it will became official QtSharp Example/Tutorial project ;)
Also I have first isuse so any help is appreciated.
@dsoronda My personal dream has been for the official Qt examples (.../Qt/Qt/Examples/Qt-) to be ported to Qt#. However, if you have too little time to read and translate C++, updating the Qyoto examples from http://zetcode.com/gui/csharpqyoto/introduction/ would be an excellent start too.
By the way, what do you think about the idea of adding the examples to the Qt# repo? It would be easier for people to find them.
@ddobrev
I'm using Quyoto examples for now. My plan is to make them all work properly and then we may join projects. Currently, I think it's better to keep separate repos so I won't bloat you with pull requests.
Also we can keen separate wikis ( QtSharp Wiki for builds etc., and Demos for tutorials), but I leave that decision to you.
I'll change license from LGPL to Apache.
My long term plan was to generate demo app like this one : Eto forms demo app.
This is a really nice example. :)
About merging the repositories, we can indeed do it later so if you feel it's more convenient to you to work in a separate one for now, it's fine by me. About the wikis, I assume you mean separate ".md" files which I fully agree with.
Hi guys, i created some demos in QtSharpDemos project and started writing Wiki documentation.
Is anyone willing to take a look and give some constructive comments? Thanks.
The examples look fine to me. We'll just have to change the code formatting before merging to the Qt# repo but it's not urgent. I assume they all work which is great, they are quite a few. There are a few missing compared to the originals, are all of these blocked by the bug with QPainter or are there some which have not been ported yet?