auto complete for Qt in emacs - qt

I have become addicted to emacs and have been using it for everything. Now, I have started Qt4 . I am forced to move to the Qt Creator because of its auto complete feature which is required when writing programs in Qt because of the heavy use of pr edefined functions in it.
But the problem is that I don't want to leave emacs. Is there any way to get a auto-complete feature close to that of Qt Creator in emacs.
I have installed the CEDET-1.1 where I discovered the text file for c++ which contains all the commonly used c++ keywords. One way could be to add Qt class and function names in that file which gives me a pretty basic auto complete for Qt. But can I get a better auto complete?

Do not use cedet anymore, it is big, and slow.
I recommand you use https://github.com/brianjcj/auto-complete-clang, which is lightweight, and much easy to use. All you need to do is to learn and configure of auto-complete and yasnippet.

Related

How to support multiple language in Qt Based Application

I am trying to develop a Qml based QT application which will support multiple languages.In the application there will be drop down list from where on select of language whole language family of the application will be changed.Can anyone help me on that giving idea how to proceed?
Is there any example? and is QTranslator() is the convenient way to do this?
The localization system of Qt is well documented: Internationalization with Qt
Simply you put your text directly in the C++ code, using the tr() method of QObject (or qsTr() in QML). Than there are some tools (lupdate and lrelease) to generate the translation files. I suggest to read the documentation, it's very easy.
Some useful links:
Hello tr: and example
Qt Linguist manual
QTranslator works well with Qt UI as you can use languageChanged() signal to update the UI. This isn't possible with QML.
See this QML WiKi, it is the recommended workaround (for now!).

R statistics console in QT

I am planning to link a Qt project against R to provide some statistical funcionality. I thought it might be quite cute to add some generality to the project by having an R console as a Qt widget within the tab to allow me to do analyses that I haven't thought of in the design stage later on. I was wondering whether it is something that might be accomplished fairly easily?
In particular I'm stuck on how I would access the RTerm from QT? Has anyone else attempted something similar or can give some hints on where to start?
One of the examples for RInside does something pretty close---in around 200 lines most of which deal with the other GUI aspects, it wraps R functionality inside a Qt application.
The example implements a GUI density slider, and the edit box allows you to write an almost arbitrary R expression, or rather the parts that are then passed into an evaluation to generate random number: rnorm(50), or for a mixture c(rnorm(50), rt(50)) etc. You could possibly build on top of that.
See this blog post for more.
Check out Carson Farmer's work on manageR:
http://www.ftools.ca/manageR/
this is a plugin for Quantum GIS (mapping package) that interfaces it to R, giving you exactly what you want - an R console wrapped in a Qt4 body - as well as data transfer between Qgis and R. It handles plots as well.
I've tried to encourage Carson to produce a standalone R Gui project from this code, but he's a busy guy. Aren't we all?
RStudio is largely written using QT, you should be able to have a look at their code and build something similar into your Qt based application:
https://github.com/rstudio/rstudio

Is there something like .NET Reflector for Qt?

Once I've seen a nice tool called .NET Reflector. It can show the entire object hierarchy of .Net binaries/apps (sorry if the term is wrong).
Is there something like this for Qt? As Qt has very good QMetaObject abilities, it should be possible to traverse object-trees, call methods(slots), change properties, etc.
I am currently re-factoring a Qt project. The naming of variables is very domain specific and I am not the expert in this domain. So, it is difficult for me to map a widget-variable to the widget on the screen. Such tool would be a great help for me to understand the code.
Thank you very much in advance!
For simple uses you might want to take a look at QObject::dumpObjectTree()
If you need something more advanced there's kspy
kspy: examines the internal state of a
Qt/KDE app KSpy is a tiny library
which can be used to graphically
display the QObjects in use by a
Qt/KDE app. In addition to the object
tree, you can also view the
properties, signals and slots of any
QObject. Basically it provides much
the same info as
QObject::dumpObjectTree() and
QObject::dumpObjectInfo(), but in a
much more convenient form. KSpy has
minimal overhead for the application,
because the kspy library is loaded
dynamically using KLibLoader. See /usr
/share/doc/kspy/README for usage
instructions. This package is part of
the KDE Software Development Kit.
It depends on KDE's klibloader so if you are not under KDE you have to modify it but it should be rather easy. Sources are here.
There's QSpy project. It inspects all QWidgets of running application. I'm not sure how well it works, because I couldn't use it on Mac OS X. Maybe on Windows it works better. https://github.com/sashao/martlet
http://qt-apps.org/content/show.php/QSpy?content=102287

Binding Qt to LLVM

What is the best way to create a Qt binding to a language that sits on top of LLVM?
Try to parse the Qt header files and generate an interface to C from that, call the C interface from LLVM? Or maybe try to get SWIG to interface Qt? Or is there a better way?
Have you looked at the smoke libraries from KDE? They wrap Qt as well.

SQLite with MFC

I want to use SQLite within my MFC application.
for that, i'll create an object whose job is to interact directly with the DB(SQLite) to insulate the rest of the app from the DB code.
can anyone point me to a good tutorial ?
i'll need operations such as (create,delete,insert,update,createdb,dropdb and so on...)
Thanks.
There's a page in the SQLite site that lists many available wrappers - here. The C++ wrapper Daniel mentions in his answer is probably the most common one, though it does not support Unicode and the SQLite dll that comes with it is quite dated. There's a Unicode version of that wrapper here, but it's a bit buggy and requires some more work. It could, however, save you the trouble of writing the whole thing from scratch.
Have a look at this. This was really easy to port to MFC classes, but it will get you started.
http://www.codeproject.com/KB/database/CppSQLite.aspx
Or you can just do #include "sqlite3.h", add sqlite3.lib to your linker and use sqlite3.dll directly with the C api. That's what I did in my MFC app.
And you can even statically link sqlite3 into your app. Download the amalgamation and include it! It adds about 400 k.
Please define your problem more clearly.
sqlite can be coding with c, and you can read the sample in their site.

Resources