One more note: This QAbstractItemView *view = qobject_cast<QAbstractItemView *>(parent()); is unsafe as hell. Nothing says the delegate should be a child of the view. in fact you can use the same delegate in multiple views. the correct way to get the model is index.model() without passing from the view
Thanks for signaling the issue. I have fixed my sample code above.
You can use C++/CLI (that is C++ building for CLR) to build a simple wrapper on the unmanaged C++ code that can be exposed directly to C#. If you want an example of exposing a Qt API to .Net you can check here
In that case, defines won't help. You can put that path in variable to reuse in your different calls.
In any case, I would recommend to rather generate a header file using QMAKE_SUBSTITUTE like described in this wiki entry. IIRC, this variable is going to get documented in the next Qt release but is already usable since some time now.
This will simplify your life and avoid having to generate string defines for all the possible shell that you are going to use.
From exactly what you say in your question, I would not have answered it as @sierdzio has. (Unless there is something special about "if you are inside an AppImage package", I don't know about that.)
How/where do you launch your Qt executable from?
I would like the current working directory of my program to be the directory in which I am with my terminal (ie. the result of the pwd command).
If you go into a terminal and type the name of an executable to run, which is then found via a symbolic link in your ~/bin which is on your PATH, that will not change the current directory. It will remain whatever it was in the terminal you launched it from. Which is what you say you want. And what QDir::currentPath() should already be delivering you:
Returns the absolute path of the application's current directory. The current directory is the last directory set with QDir::setCurrent() or, if that was never called, the directory at which this application was started at by the parent process.
In that case I would ask why it is not already correct?
If you instead want something about the directory the executable is actually in, or you run it in a different way, that's a different question?
Hi @Larvae, you might get better answers to questions about internal code and design decisions at the Interest mailing list (subscribe first, then post). Qt engineers are active on that list; this forum is mainly used by Qt users who don't necessarily know any internal details.
Well. I'd never seen that site before - it would be up to the site owenr / someone else to maintain the content on their site.
Regarding learning QML: the documentation and forums here is plenty. Then there are the example applications, the book and also the mailing list and I check the Qt reddit but it's pretty quiet. No need to look further just imo, I'd rather have less places to look but higher quality but sometimes I'll venture online to see what others have gone and done themselves.
I agree, QML is so desirable for it's declarative syntax - it makes for very clean GUI code - just define what you want to see, how it behaves and no syntax fluff - just what you need. And it only gets better as you go on too - discovering you can change this:
Firstly, I don't work in C++ so I don't test the code for the right way to pass the output string to printf(). So your corrections are good. [BTW you'd be better off not using printf() and using Qt/C++ functions, then you wouldn't have all that toUtf8().constData() stuff, but that's another matter.]
As you can see you have 3 rows matching the query, you tell us you have 5, or you had 5 and now you have 3. That's worrying when you're asking for help. Your Username value appears to be 1 from the output. That is a strange username. I don't know what your problem is. The original code should correctly print out whatever is in the Username column of each row encountered (note that since you didn't put a \n in it will all come on one line, which isn't great, I do trust that is not what this is all about.)
In addition to what @VRonin has shown, if your lineusername/linepassword are, say, QLineEdits, you cannot assign via text() = ... as you tried in yours, you'll want to use setText(). [EDIT As @VRonin 's example now shows.]
it's generally a good idea to perform editing in a separate window/dialog.
create this window with new->Qt Designer Form Class; this create everything at once.
use the QDataWidgetMapper in the edit dialog to display the details from the model.
use VRonin's technique of setting the model index for the edit dialog by using the index from the parent window.
I'll edit the summary if anyone informs me of errata. Thanks for all the assistance.
@DanRummble Very interesting questions, thanks for that.
I have a bunch of questions here. For example, can I sell my templates for more than $50?
So, the price could be any you want.
When I sell any of solutions can I hide the code behind?
You can sell compiled Qt/C++ lib, but you can't do the same with qml, so it's always open.
What percentage would be taken by platform?
We plan to take up to 10%. But this topic is still open.