Serial Port Component for Lazarus (windows and linux). - JurassicPork/TLazSerial. Delphi serial port RS232/R485/RS422 communications component library. C++Builder and Lazarus, supporting Windows, Mac OS X, iOS, Android, Linux. And autism spectrum disorders such as Asperger syndrome, pervasive developmental disorders (PDD), and PDD-NOS.
Probably the biggest selling point of Qt from my end, is the signal-slot implementation of the “observer” pattern. You can define an object to emit a signal, connect objects up intended to receive that signal, and the object itself not care what those other objects are or how many of them exist. This is useful in all kinds of applications. That, and the library includes features for what is normally the domain of “managed languages” like C#/Java: smart pointers which will count references to objects, and automatically free the object when the reference count drops to 0. I teach Qt in our User Design Interface class at a community college level Electronics Program. It is a great library and really makes C a joy to work with.
The Qt libs are more than just for GUIs, they include threading, database support, video/audio playback, 2D drawing, openGL integration, OpenCV integration, networking and much more. The QtCreator IDE is a joy to work with. It has built-in Qt documentation, multiple panes, code highlighting, vim mode, built-in debugger, and much more.
It also has a great visual form tool. It is also lightweight and startup-times are fast. I’d use it any day over Visual Studio. For those that are not fans of C,Qt has Python extensions PyQt5 (free for developing open source apps only. Bust purchase license to develop commercial apps) and PySide/PySide2. Another really interesting C library is Wt (pronounced ‘witty’).
It uses the same Qt philosophy/paradigm to build websites as opposed to a GUI running on a PC. It’s quite the piece of workeven if it doesn’t follow the traditional web development paradigm. Qt’s serial port library is the best cross-platform serial port interface I’ve encountered, bar none. Doing it in C/C directly is possible, but complicated and not exactly portable. You’d think Java would have a good cross-platform way to identify a USB serial port, right?
After all these years, the supposedly “write once, run everywhere” language still can only offer a poor, thin wrapper around libusb at best, if you can even find the jar files buried in the Java website. Include qtserialport and qtserialportinfo and go. Okay, I have to confess. This post will be a shameless plug.
But I don’t want to leave this information out of people’s way for those who are interested. There is also an option to use Qt Creator for bare metal microcontroller development. It’s a crazy alternative for Eclipse, but it is out there and it’s completely functional with debugger included.
I wrote a tutorial-like setup guide for using Qt Creator, QBS, ARM GCC, ARM GDB, OpenOCD and STM32 a little while back: I still use this workflow for my embedded STM32 and EFM32 projects, and I’m pretty happy with it. There are however 2 options missing: a soft-reset button in the UI and a “register pane” for MCU registers. The reset issue can be solved with a hardware reset button which works satisfactory on STM32, however on EFM32 (or other targets) YMMV. In my case, my mileage was that it cleared breakpoints on reset. Ahh I’ve done the same.
Love Qt Creator to bits, so easy and nice to use. I wrote two tutorials but for nrf51822 ARM m0 uC. One where you use QBS and the other where you just use good old makefile. And I completely agree with you not having register pane or soft reset is a bit annoying.
The soft-reset I normally solve by using OpenOCD and just typing the command “reset” through telnet. But compared to eclipse I found it much easier to setup an enviroment.
Shamless self-promotion Here is the QBS tutorial Here is for the Makefile. “There is a meta-compiler that preprocesses your C code to get all the signal and slot stuff converted into regular C. Here’s the good news: you don’t really care. In QtCreator you can write code to handle a button push and exactly how that happens isn’t really much of a worry.” And here is the problem with Qt in general.
Their stupid meta-object compiler needs to run through your C files. The entire thing is retarded to no end. No, I do not use a GUI to create my GUIs, thank you very much. I do not let some framework do code generation for me. Dirty sounds about right. As for GUI framework for embedded devices, I make my own when needed.
It really is not that hard to do. It honestly is not hard at all. You provide some drawing functionality which you utilize to render your widgets; you provide a container for your widgets; you provide a way to navigate through them; you provide the means to attach callbacks to those widgets for the events you wish to track (function pointers are a way to accomplish this); and then you handle your input (this is platform specific and it is highly dependent on the available human interface devices). The most code intensive portion is usually the rendering part, which is also platform specific. It can range from writing directly to a framebuffer device to providing a the necessary hooks to whatever piece of hardware you are using. Not that hard?
You must be far better than me at this stuff. A few years ago (2010?) I decided I needed to have a platform-independent development system that could develop applications to run under Windows, Linux, or MacOS X with minimum changes for each version. I looked at all the options I could find already out there, including SDL TCL/TK, GTK+, QT, FLTK, wxWidgets, Python with a GUI library, and a few others. At the time, all of these had serious drawbacks – SDL was nice and simple but couldn’t do multiple windows, and didn’t even have built-in support for rendering text, TK seemed to be stuck in the 1980s, most of the others seemed to work fine one one OS but not another, and so on. So I wrote my own. To me, it WAS that hard. Windows makes repaint calls directly to your window event handlers for each window, bypassing the message loop and making a mess of things.
All OSs used different mechanisms for accessing the sound card. Each OS had a different way of implementing timers. Windows used BGRA pixel format instead of RGBA. Text was done differently in all three. All three have different ways of accessing a video device.
Each had a different way of implementing multi-threading and inter-process communication. It was a mess, and I found that developing software took as much time updating my multi-platform library as it did developing the actual application, and I STILL don’t know why sometimes my event queue gets backed up and won’t process new events until I move the mouse around for a few seconds. This happened when I added timer support, but seems to happen even when I’m not using timers at all, and I was dreading having to work on it again.
When I read this article, I decided to give Qt another try, and improvements since I last looked at it are numerous. This is a double-edged sword, in that Qt now has at least three fundamentally different ways of building a user interface, which means whenever you want to Google how to do something, you have to be careful that you’re not reading articles that use one of the “other” user interface paradigms. But I find that having certain things seamlessly integrated – most of the above mentioned things – is a big help, and lets me focus on the application rather than the operating system. I still don’t use Qt’s automatic layout widgets because I can’t get them to behave in a way I can predict, but that’s no problem because you don’t HAVE to use these.
I can just include a little code in my app that resizes and repositions things when the user resizes a window or drags a bar, which isn’t that difficult and it means I can make it behave like I want. Anyway, TRON, I would suggest that you are a victim of not-invented-here syndrome. You might want to look at how much time you’re spending on parts of your applications that have already been covered, and covered well by others. And you might consider the possibility that generated code will JUST WORK, where human-generated (even TRON-generated) code is prone to errors. Sure, Qt acts as a pre-processor to C’s pre-processor to C, but as with C, it doesn’t monkey with code that you write that has noting to do with its extensions. I personally would rather stay away from C as far as that goes, but I’m willing to use C where necessary to talk to Qt and get the tedious stuff done automatically. Because sometimes those wheels come with years of extra baggage that is not needed, which leads to efforts like the one you linked.
Let it also be on record that there are times where I code directly in assembly, if the situation calls for it (accessing the MSRs of a processor comes to mind right away). Also, by all means, please let me know when Qt runs on an MSP430, or a Cortex M0 core, which are platforms I target. On desktop applications, I use GTK2 (no, not GTK3), if you are curious. I believe it is a much saner alternative to Qt.
QT is an excellent way of generating GUI apps on the raspberry pi. I used to develop win32/mfc apps before C# was popular and then moved on to just using C# for GUIs. I was never satisfied with porting C# code from windows to linux, as there was always something that didnt work properly. I love the way that QT pretty much just works on different platforms, and the way it almost feels like old fashioned windows programming, but on linux. Next stop for me is to investigate QML on the pi I kind of wish Id picked up on QT a long time ago.
Linux still lacks anything that comes close to Microsoft’s visual studio. And it’s a real shame. I’ve been a game dev from over 20 years and have had to work on Linux systems as well as most of the consoles and Windows. And whenever a plugin from VS is developed so that we can move away from the Linux tools, that plugin becomes indispensable. Last night I was wrestling with codeblocks on my RPi 3. F10 is bolted to bring up the menu and although it is not because of codeblocks but because of GTK (so I am told on the forums) the dev refuses to implement the workaround.
And as I have 20+ years of muscle memory of using F10 for step to next line it’s game over for me. I will check out QT again, have used it in the past but there were issues, time has allowed me to forget them so I may be presently surprised. The best alternative to VS, and I use ‘best’ loosely, is eclipse.
And this brings me back to my original point, even the first Visual Studio, which I brought for Windows 3.1 is better than anything on offer for Linux today. Linux also seems to be wedded to make files. I want to bail on Windows as Linux is so much easier to do stuff with, the user space libusb is fantastic. (it sucks on windows) but I am just always left feeling disappointed with what the Linux world has created for development. It really is constraining the advancement of the all the Linux distros.
And just don’t get me started on GDB. I had better debugging on the Amiga with DEVPACK!!!! I used Visual Studio for a long time. I am more a fan of lean development with emacs.
However, you might look at KDevelop or NetBeans (I’d mention Eclipse, but you did). As for the debugger. There is help there too. For one thing, try gdb -w (but your gdb has to be built for this or you may find it as insight). Or try gdb -tui. However, there are tons of integrated front ends including for Eclipse and most of the other IDEs. I personally like ddd.
See There used to be a ppa for insight but it isn’t up to date. You might try this post if you are curious.
I always am astonished when HAD has an article on something I thought I missed. I started using Qt three weeks ago, and find its support, samples, online forum references clear and concise. Howevermany answers you may seek out on how to do things seem to be from people who either had typos in their source or didn’t include something their function requiresstart with small projects and don’t become too ambitious at first and you will feel like a cross platform developer fast. Also remember to cast those keys you thought were integers when parsing xml sources to double.