Trouble in Qt Paradise
I've spent more than a decade making professional commercial programs in Windows and MFC. Before that, I was working in now extinct Borland C++ Builder and VCL (I miss you old friend).
Way back when, around year 2000, I had Linux as my primary OS installed (Mandrake - I don't miss you) and was testing different APIs to get a feel of programming GUI for Linux.
At the time I had access to KDE and Qt. KDE was OK, but when I tested Qt, something clicked. Their entire programming paradigm just resonated with my programming style. And while KDE had more of the Win32 API approach, Qt was entirely different. And while KDE and Win32 at the time made me code message loops, in Qt, all was provided on more or less few lines of code. I think I made Tetris clone in Qt before ditching Mandrake for Windows.
Fast forward a few years and I got my first job as a C++ programmer. Me being a self taught programmer I walked to work every morning with an ear to ear wide grin every day. After my trial period ended, I was offered a position in a team as a GUI programmer. In MFC.
Now, I barely new MFC, but was comfortable enough to make simple programs. Such as put a Cbutton on a Window and add OnClick code. Simple enough.
Microsoft calls Visual Studio - RAD (Rapid Application Environment), but let me tell you, the only rapid thing about MFC is the time that made me hate it. I found my self spending more time programming the bare bones called MFC controls than I spent doing my actual work. Want to get the selected item in the CListBox? Fuck you, program it yourself. What about CTreeList - the same. And heavens help you trying to find a string in a tree control. You better paid attention when learning about recursions.
But MFC is not all bad. The extensibility and the amount of direct control over every CObject enables you to do pretty much anything you want with it. From repainting controls to completely rewrite their purpose. And there were people who worked miracles with these options. Just look at the stuff people made with it on https://www.codeproject.com/ or a commercial application with https://codejock.com/
Which brings us to a few months ago. I was not longer working for the Company I was looking to finally start making games. So I remembered the good times I had in Qt and decided to see whats up with it now. I downloaded and installed it and this whole new world opened up for me.
I'm not a shamed, but I think I dropped a tear when I saw how easy thing that I spent days coding in MFC are in Qt.
So for practice, I decided to quickly make a little App for Android that used the tech I made for my ex company. I stayed in good relations with them and they allowed me to use the API I made for them called BACapi (BACnet protocol Implementation)
https://www.ashrae.org/technical-resources/bookstore/bacnet
and port it to Android with Qt.
It took a month.
You can see the app here:
https://play.google.com/store/apps/details?id=org.kaleidoscope.bacnetscope
Which finally brings us to yesterday.
Few months ago I finally upgraded my OS to Win10 and started working on games. Everything was fine until I finally decided to port my old apps to VS2019 and Win10. One of them being BACnetOscope.
I installed a new version of Qt, installed extensions for VS2019 and loaded my BACnetOScope project. And something was wrong. VS's intellisense didn't recognize any of the Qt code. That was weird. Even more so because I had an older version of Qt installed when setting up Win10 and the example project I made with it worked fine. But when trying to make a new Qt project in VS, not only intellisense didn't recognize QTDIR def, but when trying to compile a weird error jumped up.
QMAKE_CXX.COMPILER_MACROS is not defined and msvc-version.conf loaded but QMAKE_MSC_VER isn't set.
Searching about it revealed only a 2 years old bug report on the Qt bug list that had nothing to do with it.
At this time, I was bashing my head around this for more that 10 hours. I installed and reinstalled Qt and VS multiple times in different order but nothing helped. Finally I fired an old trusty CMD,exe to check the paths as they appear in ECHO and.... It closes? That was weird. Running the PowerShell and checking the paths works fine, but CMD won't open? Hmmm...
Was this connected with Qt? Some searching later and it seems that Qt issues non visible CMD shell command. So I made a simple .BAT script and ran it. And what do you know! It doesn't work. Command Prompt just closes without running the shell.
So WTF is happening here? Opening a registry and checking the Command Prompt key values revealed a cause of all my misery. An anomalous AutoRun key trying to run a SoundMixer.exe file and hiding it behind CMD.exe and explorer.exe on Windows Logon.
And what do you know. It's bitcoin miner.
Removing the offending key and restoring the Winlogon key to explorer.exe fixed the issue.
The sense of pride and accomplishment at that time could could only be compared for me, with beating the Nameless King in Dark souls .3
In the end, Qt helped me find a virus.
And the Paradise Lost was finally restored.
Way back when, around year 2000, I had Linux as my primary OS installed (Mandrake - I don't miss you) and was testing different APIs to get a feel of programming GUI for Linux.
At the time I had access to KDE and Qt. KDE was OK, but when I tested Qt, something clicked. Their entire programming paradigm just resonated with my programming style. And while KDE had more of the Win32 API approach, Qt was entirely different. And while KDE and Win32 at the time made me code message loops, in Qt, all was provided on more or less few lines of code. I think I made Tetris clone in Qt before ditching Mandrake for Windows.
Fast forward a few years and I got my first job as a C++ programmer. Me being a self taught programmer I walked to work every morning with an ear to ear wide grin every day. After my trial period ended, I was offered a position in a team as a GUI programmer. In MFC.
Now, I barely new MFC, but was comfortable enough to make simple programs. Such as put a Cbutton on a Window and add OnClick code. Simple enough.
Microsoft calls Visual Studio - RAD (Rapid Application Environment), but let me tell you, the only rapid thing about MFC is the time that made me hate it. I found my self spending more time programming the bare bones called MFC controls than I spent doing my actual work. Want to get the selected item in the CListBox? Fuck you, program it yourself. What about CTreeList - the same. And heavens help you trying to find a string in a tree control. You better paid attention when learning about recursions.
But MFC is not all bad. The extensibility and the amount of direct control over every CObject enables you to do pretty much anything you want with it. From repainting controls to completely rewrite their purpose. And there were people who worked miracles with these options. Just look at the stuff people made with it on https://www.codeproject.com/ or a commercial application with https://codejock.com/
Which brings us to a few months ago. I was not longer working for the Company I was looking to finally start making games. So I remembered the good times I had in Qt and decided to see whats up with it now. I downloaded and installed it and this whole new world opened up for me.
I'm not a shamed, but I think I dropped a tear when I saw how easy thing that I spent days coding in MFC are in Qt.
So for practice, I decided to quickly make a little App for Android that used the tech I made for my ex company. I stayed in good relations with them and they allowed me to use the API I made for them called BACapi (BACnet protocol Implementation)
https://www.ashrae.org/technical-resources/bookstore/bacnet
and port it to Android with Qt.
It took a month.
You can see the app here:
https://play.google.com/store/apps/details?id=org.kaleidoscope.bacnetscope
Which finally brings us to yesterday.
Few months ago I finally upgraded my OS to Win10 and started working on games. Everything was fine until I finally decided to port my old apps to VS2019 and Win10. One of them being BACnetOscope.
I installed a new version of Qt, installed extensions for VS2019 and loaded my BACnetOScope project. And something was wrong. VS's intellisense didn't recognize any of the Qt code. That was weird. Even more so because I had an older version of Qt installed when setting up Win10 and the example project I made with it worked fine. But when trying to make a new Qt project in VS, not only intellisense didn't recognize QTDIR def, but when trying to compile a weird error jumped up.
QMAKE_CXX.COMPILER_MACROS is not defined and msvc-version.conf loaded but QMAKE_MSC_VER isn't set.
Searching about it revealed only a 2 years old bug report on the Qt bug list that had nothing to do with it.
At this time, I was bashing my head around this for more that 10 hours. I installed and reinstalled Qt and VS multiple times in different order but nothing helped. Finally I fired an old trusty CMD,exe to check the paths as they appear in ECHO and.... It closes? That was weird. Running the PowerShell and checking the paths works fine, but CMD won't open? Hmmm...
Was this connected with Qt? Some searching later and it seems that Qt issues non visible CMD shell command. So I made a simple .BAT script and ran it. And what do you know! It doesn't work. Command Prompt just closes without running the shell.
So WTF is happening here? Opening a registry and checking the Command Prompt key values revealed a cause of all my misery. An anomalous AutoRun key trying to run a SoundMixer.exe file and hiding it behind CMD.exe and explorer.exe on Windows Logon.
And what do you know. It's bitcoin miner.
Removing the offending key and restoring the Winlogon key to explorer.exe fixed the issue.
Victory! |
The sense of pride and accomplishment at that time could could only be compared for me, with beating the Nameless King in Dark souls .3
In the end, Qt helped me find a virus.
And the Paradise Lost was finally restored.
Comments
Post a Comment