Pages

Showing posts with label Qt. Show all posts
Showing posts with label Qt. Show all posts

Tuesday, July 27, 2021

Ubuntu 20.04 LTS에서 Qt Creator의 clang backend가 동작하지 않는 경우

Ubuntu 20.04 LTS에서 APT를 사용해서Qt Creator(4.11.0)를 설치하고 소스파일을 열면 clang backend가 The clangbackend process has finished unexpectedly and was restarted. 라는 오류를 띄우면서 인해 계속 재시작을 하는 기현상을 경험할 수 있습니다. 만일 shell에서 Qt Creator를 실행하면 Error in ClangCodeModelServer::documentsClosed: Document '/path/to/sourcefile.cpp' does not exists! 같은 메시지도 함께 나오더군요.

그동안은 저 에러를 회피하려고 clang code model을 꺼놓고 썼는데, 오늘 간만에 맘잡고 이 문제를 붙잡아본 결과 clangd를 10.0에서 8.0으로 내리면 문제가 해결되더군요.

이걸 몰라서 1년을 넘게 clang code model 없이 삽질께나 했습니다(......).

Sunday, May 2, 2021

When Python Language Server is too slow on Qt Creator(Windows)

Nowadays I'm teaching Python to my son. After teaching stuff I found out that now it's the very timing to teach how to use GUI. And what? For me tkinter is too "weak" and I decided to use Qt, which is one of my favorite "weapon."

So I tried Python on Qt Creator. And guess what? Suddenly LPS became the "black sheep." Ctrl-Space doens't work, and according to messages from LPS it takes a few minutes to follow me up for my 3-second typing...... Frankly speaking I was fully disappointed. Does Qt Creator just ignore Python users, though Qt Company says that it officially supports Python?

However, even it was kind of...... strange. If all the users experience the same symptoms like me, then the forum would have already been highly flamed,  but I couldn't find anything.

Well, and all of sudden, I encountered a solution.

  1. Go to Options and select Language Client
  2. Select Python Language Server
  3. Change Startup behavior from Requires an Open file(default) to Start Server per Project
  4. PROFIT!!!

I have no idea why, but now I'm satisfied with overall performance and result. With default configuration from Qt Creator practically I couldn't do anything so that I seriously considered Visual Stuio Code + Qt Designer, but now with Qt Creator on full throttle, I don't have to go workaround

Hope that this small tip helps those who want to develop in Python with Qt Creator.

Qt Creator(Windows)에서 Python Language Server가 너무 느릴때의 조치방법

그러니까...... 아들녀석에게 Python을 가르치다 보니 GUI를 가르칠 타이밍이 되었는데, tkinter는 (최소한 제 입장에서는) 뭔가 너무 많이 빈약해서 제 장기(?) 중 하나인 Qt를 가르치는게 더 낫겠다는 생각이 들더군요. 그래서 Qt Creator를 사용해서 Qt for Python을 가르치려고 했는데, LPS가 너무 느린겁니다. Ctrl-Space는 동작하지도 않고, LPS에서 뿌리는 메시지를 보면 제가 3초만에 친 타이핑을 쫓아가는데 몇 분 이상이 걸리고...... 하여간 대단히 실망스러웠습니다. Python을 공식적으로 지원한다고 해 놓고 정작 Qt Creator에서는 Python 사용자들을 거의 방치하는 건가 하는 생각까지 들더군요.

하지만 한편으로는 그것도 꽤 이상했습니다. 만일 모든 사용자들이 나와 똑같은 상황이라면 분명히 포럼이 쌩난리였을텐데 왜 이렇게 조용하지?

그런데 의외의 지점에서 해결책이 나오더군요. 제가 찾은 해결책은 이렇습니다.

  1. Options에서 Language Client를 선택합니다.
  2. Python Language Server를 선택합니다.
  3. Startup behavior를 "Requires an Open file"에서 "Start Server per Project"로 변경합니다
  4. 끝!

왜 그런지는 잘 모르겠지만 하여간 이렇게 하니 만족스러운 속도가 나오더군요. 사실 Qt Creator의 기본 설정만으로 작업하려고 했을 때에는 전혀 답이 나오지 않아서 Visual Studio Code + Qt Designer 조합으로 가려고 했는데, Qt Creator가 제대로 성능이 나오기 시작한 이상 굳이 이렇게 갈 필요가 없어졌습니다.

혹시나 Qt Creator로 Python 개발하시려는 분들께 도움이 되었길 바랍니다.

Saturday, March 20, 2021

Would no open source LTS for Qt shrink its user base?

It was last year(2020). Qt announced that it won't provide LTS to its open source editions.
https://www.qt.io/blog/qt-offering-changes-2020

And this year(2021), at March 4th, Qt 5.15.3, the first LTS only for commercial users is released.
https://www.qt.io/blog/commercial-lts-qt-5.15.3-released

Of course the replies for this post are under flame war from open source edition users. They say that Qt user base will shrink, the company has started the first nailing to its coffin, ...... and such. Well, the blog evokes flame war from time to time so I'm just watching it with my popcorn.......

But let's sit down and think. Would the policy of "LTS for commercial clients only" shrink the general user base for Qt? In my thought, it's absolute NO. Let me ask you one question to make it clear.

"OK. Say, let's not use Qt. Then what will we use?"

As far as I know, there's no such library which can fully replace Qt in 1 on 1 way. Some features would be able to be replaced, but Qt-only features are not replicable at all(hey, if you think you can replace Qt Quick with Electron, how would you deal with that RAM consumption?), and if you're joining some other ecosystems, chances are that the difficulty for maintenance will rise exponentially. And say, among those "alternatives," which can provide at least a good match in terms of commercial-level documentation and consistency in API structure? wxWidgets? Hey, I saw so many news to migrate from wxWidgets to Qt but not in the opposite way.

Think of it. When a new language is created, one of the external libraries bound to that language ecosystem at the first time is Qt, which shows what Qt is among developers.

Of course I fully understand the "wrath" from the open source community. I see bugs, report them, and even provide patches for them, and my contributions are applied only to commercial buyers? Yes you have your reasons. Yet...... We also have to admit that we're using commercial grade library without charge in return. And you know what? Before 2011, Qt didn't have LTS at all. (on a side note, if you distinguish open source projects to those with LTS and without one, the former will be only a handful of them).
Well, I don't say that it's great to decide not to provide LTS to open source community. I'd say that it's a typical example of monopoly. The problem is that practically there's no competition. And I don't think that the commercial market is big enough for more than two companies can coexist. Let's admit (the harsh) reality. However hard the open source community works, without good financial support(either by companies or from foundations), you need to pour the money for more than years. Do you think that there would be a company to invest more than years to build a good alternative to Qt? I don't thinks so.

Someone said that he can't upgrade the version of Qt because LTS is not provided. Well, I'd say that how would you use a library which doesn't provide LTS at all, regarding your concerns about stability?

Qt의 오픈소스 버전 LTS 제공 중지는 Qt의 사용자 기반을 줄일 것인가?

작년(2020년)이었죠. Qt가 더이상 오픈소스 버전에 LTS를 제공하지 않기로 선언했습니다.
https://www.qt.io/blog/qt-offering-changes-2020

그리고 올해(2021년) 3월 4일, 상용으로만 제공되는 첫번째 LTS인 Qt 5.15.3이 발표되었습니다.
https://www.qt.io/blog/commercial-lts-qt-5.15.3-released

들어가 보시면 아시겠지만, 댓글창은 오픈소스 사용자들의 분노(?)의 도가니탕입니다. Qt 사용 인구가 줄어들 것이라던가, 관짝에 첫 못질을 시작했다던가 하는 등등의 이야기들로 말 그대로 불타오르고 있습니다. 뭐 저 곳 블로그는 조용할만하면 어떻게든 꼭 한번씩 불타오르는 터라 그냥 그러려니 하고 있습니다만......

그런데 냉정하게 생각해봅시다. LTS를 상용 라이선스 고객에게만 제공한다는 저 정책 때문에 Qt의 사용자 수가 줄어들까요? 솔직히 말해서 전 아니라고 봅니다. 당장 이 질문 하나만 던져보면 확실해지죠.

"그래, Qt를 안 쓴다고 치자. 그럼 뭐 쓸래?"

최소한 제가 알기로는, 여기에 1:1로 매칭되는 대안을 제공할 수 있는 라이브러리같은 것은 없습니다. 일부 기능을 대체할 수는 있겠지만, Qt 고유의 기능들은 대체가 불가능할 뿐더러(혹시 Qt Quick을 Electron으로 완전히 대체할 수 있다고 주장하시는 분들, Electron이 처묵처묵하는 저 엄청난 양의 RAM은 어쩌실 생각이신가요?), 다른 생태계를 끌어들이는 순간 그 프로그램은 유지보수의 난이도가 기하급수적으로 상승하게 될 겁니다. 게다가 그 '대체재'라는 것들 중 Qt가 제공하는 상용 수준의 문서와 일관성있게 잘 다듬어진 API를 쫓아올만한 것이 뭐가 있을까요? wxWidgets? 전 wxWidgets에서 Qt로 마이그레이션한 사례는 봤어도 그 반대사례는 보지 못했습니다.

당장 새로운 언어가 나오면 GUI를 위해 가장 먼저 바인딩되는 C++ 라이브러리 중 하나가 Qt라는 것만 봐도 Qt가 개발자들 사이에서 가지는 위상이 어떤지가 보이죠.

물론 오픈소스 커뮤니티의 분노(?)가 이해가 가지 않는건 아닙니다. 난 버그 발견하고, 보고하고, 심지어는 패치까지 무료로 주는데 그걸 돈주고 파는 사람에게만 모아주겠다는건 어떻게 보면 놀부 심보처럼 보일 수 있을겁니다. 하지만 뭐...... 그 대신에 우린 높은 수준의 완성도를 가진 라이브러리를 무료로 사용하고 있잖아요. 게다가 저 LTS라는 것, 2011년 이전에는 아예 존재하지도 않기도 했고...... (여담이지만, 오픈소스 프로젝트 중 LTS를 제공하는 프로젝트와 그렇지 않은 프로젝트를 구분하면 전자는 거의 손가락으로 꼽을 수준 정도밖에 안 될 겁니다)

뭐, LTS를 오픈소스에 제공하지 않는다는게 잘 하는 짓(?)이라는 이야기는 아닙니다. 해석하기에 따라서는 독점 시장의 폐해라고도 할 수 있지요. 단지 지금으로서는 적절한 대체재가 없다는게 문제입니다. 실제로 이쪽 시장이 생각보다 좁아서 Qt급의 회사가 두 개 이상 존재할만한 크기일 것 같지도 않고요. 인정할 것은 해야죠. 오픈소스가 아무리 열심히 한다고 해도, 제대로 된 자본의 투입이 없다면 그만큼 제대로 된 무언가를 만들기가 쉽지 않습니다. 회사에서 재정 후원을 받든, 아니면 별도로 재단을 설립하든 간에 어쨌든 꾸준히 돈을 쏟아부어야 됩니다. 이미 절대강자가 있는 이 시장에 굳이 최소 몇 년 이상 돈을 꾸준히 쏟아부을 회사들이 있을지...... 솔직히 전 없을 것 같습니다.

누가 그렇게 썼더군요. 자기 오픈소스 프로젝트에 Qt LTS가 제공되지 않아서 불안해서 못쓰겠다고...... 전 거기다 대고 한마디 하고 싶습니다. 거 LTS 제공 안하는 라이브러리들은 불안해서 어떻게 쓰신데요?

Friday, August 7, 2020

Qt Quick Controls: currentIndex won't change if model is statically generated on Tumbler + workaround

After a long time I reported a bug to Qt as I found quite unexpected bug from Qt Quick. On Qt Quick Controls 2, if you set model statically in Tumbler component(e.g. model: [2, 4, 6, 7, 10]), everything is shown properly but currentIndex doesn't change at all. For example, even though the screen shows the fifth item, currentIndex is still 0, and onCurrentIndexChanged event doesn't fire at all.

To work around this bug, you may just set a model "dynamically" like as follows:

Components.onCompleted: {
     // do something
     model=[ 1, 2, 3, 4, 5 ]
     // do something more
}

My check indicates this bug existed since Qt 5.12 or earlier, but nobody seems to have reported this, though I think there must be people using Tumbler like I do...... Well, maybe everyone was too lazy to write a report.

Anyway I reported the bug, and got ticket number QTBUG-85933.
https://bugreports.qt.io/browse/QTBUG-85933

 I hope that the bug can be fixed sooner.

Qt Quick Controls: Tumbler에 model을 정적으로 생성하면 currentIndex가 변경되지 않는 문제+우회방안

오랜만에 Qt 버그리포트를 하나 작성했습니다. Qt Quick에서 황당한 버그가 하나 있더군요. Quick Controls 2의 Tumbler에서 model을 정적으로 미리 설정해 두면(이를테면 model: [2, 4, 6, 8, 10]같은 형태로......) 화면은 제대로 작동하는데 내부에서 자기가 어느 데이터를 가리키고 있는지를 찾지 못하는 문제가 있습니다. currentIndex가 죽었다 깨나도 안 변하더군요. 분명히 화면은 다섯번째 아이템을 가리키고 있는데, currentIndex는 0으로 그대로이고, onCurrentIndexChanged 이벤트도 발생을 하지 않는다거나 하는 문제가 있습니다.

이 문제를 우회하려면, model을 동적으로 넣어주면 됩니다. 이를테면 이런 식으로요:

Components.onCompleted: {
// do something
model=[ 1, 2, 3, 4, 5 ]
// do something more
}

확인해보니 최소한 Qt 5.12부터 있던 버그인데, 아무도 신고하지 않은 것 같더군요. 분명 저처럼 쓸 일이 다들 있을 것 같기도 한데 말이죠...... 아니면, 어쩌면 다들 귀찮아서 말았을지도 모르겠네요. 

하여간 신고했고, 티켓 QTBUG-85933를 받았습니다.
https://bugreports.qt.io/browse/QTBUG-85933

이 버그는 언제쯤 해결될 수 있을지 모르겠네요.

Thursday, June 20, 2019

Qt 5.13.0: Develop in C++, Run in Browser!

At June. 19th, 2019, Qt 5.13.0 is released. Among the new features there was one thing that caught my eyes....... Qt for WebAssembly. It uses Emscripten to buld a Qt application into WebAssembly. Oh yeah. Now you can run your QML or Qt Widgets applications inside your favorite web browser.

It's surely distinguished from yet another fancy feature, Qt WebGL Streaming Plugin. Under WebGL Streaming Plugin the application runs in the program and web browser merely delivers the GUI interfaces, while Qt for WebAssembly downloads the application to the client and run inside the web browser sandbox environment. Since the program runs in client system, the server load is low, and multiple clients can use the app, whereas in WebGL Streaming Plugin only one client can connect to the server(all other connections are queued until 1st user disconnects).

After encountering the news, well, now I wonder whether they're really humans - oh yeah. They're Trolls(:P) but it was their former glory. Now I'm not sure which alien technology they thieved. Well, anyway.......

Now we can develop under your favorite C++ environment and run in the web browser! To all Qt users and enthusiasts, you don't have to learn Angular or React or Vue.js or whatever to provide a web GUI! The market is moving to the web and now Qt is moved too! Now, DEVELOP WITH Qt AND RUN IN YOUR WEB BROWSER!

......but it didn't take much that my burning heart suddenly got calm. I encountered a few drawbacks.

1. WebGL
Sometimes I have to run web browsers in server environment, but there are a lot of servers(even modern ones) which doesn't support OpenGL 2.0 well. For example, HP DL series server used Matrox graphic chipset until 7th generation at least, which supports only OpenGL 1.2. In that case, you'll encounter an error message from the loader page. :P


2. Broken Hangul (I think that's same for CJK)
I'm not sure whether it's because of WebAssembly sandbox environment itself, Qt for WebAssembly doesn't have privilege to access system fonts. To resolve, you have to "internalize" the font to the application, e.g. putting in qrc file.
Well, I tried, and...... I'm not sure whether this is because of my lack of skills, it doesn't work. Hangul is not shown. And what's more, I can't input Hangul inside the app. The only way to input Hangul is copy and paste - type outside the app, copy it, and paste into the app.Update at Jun.21st. 2019: if I embed a font file into .qrc file, load via QFontDatabase::addApplicationFont(), and set the font as default using QGuiApplication::setFont() at least I can read Hangul, but still I can't input Korean(......).

And there are a handful of small annoyances, e.g. QMAKE_WASM_TOTAL_MEMORY option not working, but considering it's only in the initial release, I think I can overlook those small ones...... :P

Anyway, that's that and there are more limits in the WebAssembly environment. To fully make use of web browser interface, I had better learn Vue.js more, whose structure is said to be similiar to QML.

Qt 5.13.0: C++로 개발해서 웹브라우저에서 실행하자!

2019년 6월 19일부로 Qt 5.13.0이 발표되었습니다. Qt 5.13.0의 새로운 기능 중에서 제 눈길을 꽤 끈 신기능이 하나 있었는데요....... Qt for WebAssembly입니다. 그러니까...... Emscripten을 사용해서 Qt를 WebAssembly로 컴파일하는 녀석 되겠습니다. 예. QML이나 Qt Widgets로 만든 프로그램을 그대로 웹브라우저에서 돌릴 수 있게 되었다는 거죠.

기존에 있던 또다른 신기한(......) 기능인 Qt WebGL Streaming Plugin하고는 다른데, WebGL Streaming Plugin은 프로그램이 서버에서 실행되면서 웹브라우저에서는 GUI 화면만 보여주는 형태인 반면 Qt for WebAssembly는 프로그램을 웹브라우저가 다운로드받아 브라우저 내 샌드박스에서 실행시키는 차이가 있습니다. 프로그램이 클라이언트에서 실행되기 때문에 서버 부하가 줄어들 뿐 아니라, WebGL Streaming Plugin마냥 GUI를 한번에 한 사람밖에 못쓰는(......) 문제도 없습니다.

이 기능을 보고나서 제가 느낀건 뭐랄까...... 일단 이것들이 인간이 맞나 싶더군요. 도대체 어디의 외계인을 고문하고 다니는 건지 모르겠습니다. 그리고 그 뒤에는 환희가 몰려왔습니다.
이제 C++로 개발한 뒤에 웹브라우저에서 실행시킬 수 있어요! Qt 개발자 여러분, GUI의 대세가 web이라 울며 겨자먹기로 Angular나 React나 Vue.js같은걸 억지로 학습할 필요가 없습니다! 이제 Qt로 개발하고 웹브라우저에서 실행시키시면 됩니다!

......그런데 그렇게 부푼 가슴이 쪼그라드는데는 몇시간도 안 걸리더군요. 이거 단점들이 꽤 있습니다.

1. WebGL이 지원 안되면 못씀
저같은 경우는 특성상 서버에서 웹브라우저를 돌려야 되는 환경도 고려해야 하는데, 이 경우 서버 하드웨어에서 OpenGL 2.0이 지원되지 않아 화면이 안 나오는(......) 문제가 발생할 수 있습니다. 멀리 갈 것 없이 HP DL시리즈 서버의 경우 최소한 7세대까지는 매트록스 그래픽 칩셋을 사용했습니다(8세대 이후로는 안써봐서 모르겠습니다). OpenGL 지원따위...... 저 하늘 위의 별같은 거죠.

2. 한글 지원 문제(아마 CJK 환경이 다 문제일 것 같습니다만......)
WebAssembly 샌드박스 환경의 특성인지는 모르겠지만, Qt for WebAssembly는 시스템 폰트에 직접 접근할 수 있는 권한이 없답니다. 이걸 해결하려면 별도 폰트를 프로그램에 qrc 등의 형태로 내장시켜야 한다고 하네요.
해봤습니다만, 뭐...... 제가 요령이 없어서 그런지 잘 안 됩니다. 한글 왕창 깨지고요(......). 거기에 한글 입력도 안 됩니다. 혹시 몰라서 클립보드를 활성화시킨 뒤에 이것저것 해봤는데, 외부에서 복사한 후 붙여넣기는 되는 것 같습니다만 프로그램 내부에서 한글을 입력하지는 못하는 것 같습니다.2019.6.21 업데이트: 폰트를 qrc에 내장한 뒤 QFontDatabase::addApplicationFont()로 등록하고 QGuiApplication:setFont()로 기본 폰트를 변경하면 출력은 됩니다. 하지만 입력은 여전히 안되네요(......).

그 외에 위키에 적혀있는 QMAKE_WASM_TOTAL_MEMORY 옵션이 실제로는 적용이 되지 않아서 Makefile을 수동으로 고쳐야 한다던가 하는 문제가 더 있긴 합니다만 이건 뭐 최초 지원이니만큼 그냥 눈감아줄 수 있다고 치고......

하여간 그렇습니다. 웹브라우저 환경을 최대한 활용하려면 당분간은 QML과 구조가 대충 비슷하다고 알려진 Vue.js를 좀 더 공부하는게 더 나을 것 같습니다. -_-;

Tuesday, July 17, 2018

Compile qdoc in Qt 5.11 with MinGW

From Qqt 5.11, qdoc depends on libclang.
https://bugreports.qt.io/browse/QTBUG-66353
Qt Creator is also said to use clang codemodel as their main C++ parser instead of their homemade one, and now qdoc follows.

OK. Good. Understandable..... But, we have a problem - libclang is not build with MinGW 5.3. LLVM buildbot claims that they use GCC 5.3, internally they seem to use MinGW 7.1. It looks like Qt will upgrade their MinGW to 7.3 from Qt 5.12(7.1 looks buggy so they have to use 7.3 instead).
https://bugreports.qt.io/browse/QTBUG-66015?focusedCommentId=402146&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-402146
So, now we have the core reason and solution. But in Qt 5.11, due to lack of time thanks to that target release date, in 5.11 Qt still uses MinGW 5.3 but they blocked building qdoc. And Qt 5.12, which is expected to solve the issue, will be released some time around Nov.29th. Yep. MinGW users should endure the pain of not-accessible-at-all to the documentation, which is one of the selling point for Qt(you can use online docs, but it's still unconvenient).

But, who are we? We're developers. And Qt is open source project. We can itch wherever is itching. So, I built qdoc with MinGW.

Prerequisites are as follows:
  1. Source code of Qt
  2. MinGW-w64: 7.3 or higher
  3. LLVM library prebuilt by Qt: it's a bit hard to find....... But here you go:
    http://download.qt.io/development_releases/prebuilt/libclang/
If you're going to build Qt Creator too, choose libclang-release_50-windows-mingw series(as of current clang codemodel supports only libclang 5.0).

To build qdoc by yourself, unzip Qt source code and libclang, and change the project file of qdoc. The location is as follows:
QtSourceCode/qttools/src/qdoc/qdoc.pro

Put the following two lines into the top of the project file:
  • INCLUDEPATH+=/Qt_prebuilt_clang/unzipped/include
  • LIBS+=-L/Qt_prebuilt_clang/unzipped/lib -llibclang.dll
After that, build Qt as usual using configure and mingw32-make, and manually build qdoc.pro.

It would be great if there's someone who experienced inconveniences due to lack of documentation with MinGW, but is relieved with this.

Qt 5.11에서 MinGW로 qdoc 컴파일하기

Qt 5.11부터 qdoc이 libclang에 의존성을 가지게 되었습니다.
https://bugreports.qt.io/browse/QTBUG-66353

Qt Creator도 4.7부터 자체 C++ parser 대신 clang codemodel을 메인으로 가져가겠다고 했는데, qdoc도 clang에 의존하게 되었네요.

뭐, 다 좋은데...... 문제는 이 libclang이 MinGW 5.3에서는 빌드가 안된다는 겁니다. LLVM buildbot은 GCC 5.3으로 빌드한다고 주장하는 것 같습니다만, 실제로 내부에서 돌아가는 컴파일러는 MinGW 7.1이라고 합니다. 해서, 이런저런 사유로 인해 Qt 5.12에서는 MinGW 버전을 7.3으로 올리겠다고 내부 입장을 정리한 것 같습니다(7.1은 눈에 띄는 버그들이 있어서, 7.3을 써야 한다고 하네요).
https://bugreports.qt.io/browse/QTBUG-66015?focusedCommentId=402146&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-402146

문제의 원인과 해결책은 이미 나온 듯 합니다만, Qt 5.11의 경우 release date가 너무 촉박한 터라, Qt에서는 MinGW의 경우 5.3을 그대로 사용하고, 그 대신에 qdoc의 빌드를 막아버렸습니다. 그리고 이 문제를 해결할 것으로 예상되는 Qt 5.12의 목표 release date는 무려 11월 29일입니다. 옙. MinGW 사용자들은 MinGW를 이용한다는 이유 하나만으로 올해 11월 말까지 Qt의 자랑인 documentation을 쓰기가 어려운 상황이 되어버렸습니다(온라인이라는 방법도 있습니다만, 웹브라우저를 통한 검색은 역시 많이 번거롭죠).

하지만 우리가 누굽니까. 우리는 개발자입니다. 그리고 Qt는 오픈소스로 제공됩니다. 예. 필요하면 소스코드를 뜯어고치면(-_-) 됩니다. 그래서 MinGW로 qdoc을 빌드해봤습니다.

준비물은 다음과 같습니다:
  1. Qt 소스코드
  2. MinGW-w64 7.3 이상(-_-)
  3. Qt에서 제공하는 비공식 LLVM prebuilt library: 이게 좀 찾기가 까다로운데...... 여기서 구하실 수 있습니다:
    http://download.qt.io/development_releases/prebuilt/libclang/
Qt Creator도 함께 빌드하실 생각이시라면 libclang-release_50-windows-mingw 시리즈를 선택하세요(clang codemodel은 현재 libclang 5.0만을 지원합니다)

qdoc을 직접 빌드하시려면, 적절한 곳에 Qt 소스코드와 libclang의 압축을 풀고, qdoc의 프로젝트 파일을 변경합니다. 위치는 아래와 같습니다:
QtSourceCode/qttools/src/qdoc/qdoc.pro

그리고 맨 윗줄에 아래의 두 줄을 추가합니다:
  • INCLUDEPATH+=/Qt_prebuilt_clang/unzipped/include
  • LIBS+=-L/Qt_prebuilt_clang/unzipped/lib -llibclang.dll
이후 configure -> mingw32-make를 실행하여 Qt를 빌드한 후, qdoc.pro를 별도로 빌드해주시면 됩니다.

혹시 MinGW로 Qt를 직접 빌드하시면서 Qt documentation이 없어서 불편을 겪으셨던 분들이 계시다면, 이걸로 고생이 덜해지시길 바랍니다.

Tuesday, October 17, 2017

Caution on Using Qt Speech on Android: single instance

When using Qt Speech on Android, you need to have only one single QTextToSpeech object to have proper locale setup. Otherwise setLanguage() call via JNI fails.

What a day(lol).

안드로이드에서 Qt Speech 사용시 유의점: 단일 인스턴스


QTextToSpeech를 단일 instance로 생성해서 공유 사용해야 로케일 설정이 제대로 됩니다. 이렇게 하지 않으면 JNI를 통해 setLanguage()를 호출할때 locale 설정이 안되는 문제가 생기더군요.



역시 삽질도 하기 나름입니다.

Sunday, October 15, 2017

First impressions on Android programming

During the holidays I could have a chance to dig into Android programming and got some short thought. I share them here, hoping that these would help someone else.
  • The programming environment of Android is literally fantastic. Now I can understand why a lot of companies are seriously considering Android in their embedded environment.
  • Java is...... too slow(OTL). Damn slow. I can't wait for the delay
  • I could, eventually, build Qt for Android in Windows
    • Build environment: Qt 5.9.2 + SDK Level 19 + NDK r15c + BuildTools 26.0.2 + JDK 8 + Windows 10 64bit (find_java.bat in Android SDK can't find JDK 9. -_-)
    • Qt Creator 4.4.0 can't recognize SDK Buildtools 26.X. At least 4.4.1 is needed
    • QTextToSpeech seems to fix the locale to system in Android, and can't be changed(In Java you can). However, considering that I accidentally hear TTS in other locale in the app, we may have some change(or it may be simply and error)

안드로이드 프로그래밍 경험기

그간 연휴도 있고 해서 안드로이드 프로그래밍을 좀 각잡고 파고들었습니다. 몇가지 단상들이 남아서 혹시 도움이 될까 하여 정리해봅니다.
  • Android의 프로그래밍 환경은 정말 기립박수를 치고 싶을 정도로 훌륭함. 왜 많은 회사들이 Android를 임베디드 환경에서 매우 긍정적으로 검토하는지 이해가 됨
  • Java는...... 매우 느림(OTL). 답답함. 못써먹겠음
  • 수많은 삽질 끝에 Windows에서 Qt for Android 빌드 성공
    • Qt 5.9.2 + SDK Level 19 + NDK r15c + BuildTools 26.0.2 + JDK 8 + Windows 10 64bit 기반(JDK 9은 Android SDK의 find_java.bat가 인식을 못하더군요. -_-)
    • Qt Creator 4.4.0은 SDK Buildtools 26.X대를 정상적으로 인식하지 못함. 최소 4.4.1이 필요
  • QTextToSpeech는 locale이 시스템 로케일로 고정되며, 변경할 수 없는 것으로 생각됨(Java에선 가능한디......). 하지만 테스트 앱에서 시스템 로케일을 변경하지 않은 상태에서 다른 로케일의 TTS 출력이 가능했던걸 보면, 어쩌면 방법이 있을지도 모름(아니면 단순 오동작이었을지도......).

Friday, February 17, 2017

wxWidgets: memory of a month(+list of complaints)

Recently, with some motivation, I left Qt and used wxWidgets for a while. I used Code::Blocks, applied Bind<>(), and so on. I enjoyed the coding, but eventually I returned to Qt. During the time, I experienced......:

  • If the application is frozen, task switcher doesn't work at all, whatever it is - Alt-Tab, Windows-Tab, taskbar click..... Nothing works. This is first time I've ever seen something like this
  •  You need some time to be accustomed to properly use wxDateTime. On calculation you use wxDateSpan, and its structure is confusing
  • In wxGrid, if you have too many rows ans set the layout side to 1 or higher, the grid wraps the entire window(......). The widget seems to calculate its size based on the sum of column widths and row heights. It must be a bug
  • Unicode adoption seems not working properly. I converted interface strings to UTF-8 using wxConvUtf8 and tried to put the string via SOCI, and Firebird complained whenever the string has some Chinese characters
  • It seems to be due to Windows control itself, but it's too slow. The fame of GDI is not void.

And above all, Code::Blocks broke down from time to time, and well, just guess what it would feel like if you experience all above.
For your reference, my development environment was as follows:

  • wxWidgets 3.1
  • MinGW-w64 6.3.0 release 1
  • Code::Blocks rev10922(built at Nov. 20th. 2016)

Now I'm back to Qt, and I'm porting all my wxWidgets apps to Qt now. The apps are faster, and it's more convenient. Viola!

wxWidgets: 한 달간의 추억(+투덜투덜 목록)

근저 약간의 계기로 Qt를 버리고 한동안 wxWidgets를 사용했더랬습니다. Code::Blocks를 사용하고, Bind<>()도 좀 쓰고, 뭐 기타등등 그랬습니다. 한동안 꽤 즐겁게 코딩을 했는데, 결국에는 Qt로 돌아오게 되더군요. 그러니까 그동안 무슨 일을 겪었는가 하니......
  • 프로그램이 freezing 상태가 되면 task switcher가 동작하지 않습니다. Alt-Tab이고 Windows-Tab이고 작업표시줄 클릭이고 뭐고간에 하나도 동작하지 않아요. 시스템이 통째로 얼어버리는건 처음 봤습니다
  • wxDateTime은 익숙해지는데 시간이 꽤 오래 걸립니다. 연산에 wxDateSpan이라는 별도의 클래스를 사용하는데, 이게 구조가 좀 그렇더군요.
  • wxGrid의 열의 갯수가 너무 많은 상태에서 layout 크기를 1보다 크게 잡으면 grid가 창 전체를 뒤덮어버립니다(......). 아무래도 widget의 크기를 widget의 기본 크기가 아니라 내부 행/열의 크기의 합계로 계산하는 것 같습니다. 아무리 봐도 버그인데요. -_-
  • 유니코드 제어가 완전하지 않은 것 같습니다. wxConvUtf8으로 인터페이스의 글자를 UTF-8으로 변환한 뒤 SOCI를 통해 UTF-8 DB에 넣으려고 해봤는데, 글자에 한문만 들어가면 Firebird가 잘못된 글자라면서 오류를 뱉어내더군요
  • 이건 Windows 컨트롤의 한계인 것 같은데, 컨트롤이 꽤 느립니다. GDI의 명성은 헛된 것이 아니었어요. -_-
여기에 Code::Blocks의 툭하면 죽는 현상까지 가세하니 대략 난감하더군요(-_-).
참고로 개발환경은 아래와 같습니다.
  • wxWidgets 3.1
  • MinGW-w64 6.3.0 release 1
  • Code::Blocks rev10922(2016년 11월 20일 빌드)
참고로 지금은 Qt로 돌아왔고, wxWidgets로 만들었던 프로그램도 모두 Qt로 porting하고 있습니다. 속도도 빨라지고 위에 이야기했던 불편함도 없고...... 훨씬 쾌적하네요. Viola!

Monday, January 16, 2017

QSqlQuery vs. SOCI: inserting 1000 times

Recently I'm using QtWebApp to develop an application, and I did some performance benchmark to select a database library in the backend.  I selected QSqlQuery and SOCI as candidates, and tried to insert 10,000 rows at once. The result is as follows:

  • Repeating single query
    • QSqlQuery: 10000ms
    • SOCI: 2500ms
  • Prepared statement
    •  QSqlQuery: 7000ms
    • SOCI: 750ms(?!)
In any situation, SOCI takes far less time than QSqlQuery. QSqlQuery seems to be really a bad choice for server applications. I suspect the bottleneck is the loooooong processing time for QString.

QSqlQuery vs. SOCI: 1000회 연속 insert

최근 QtWebApp을 기반으로 프로그램을 개발하고 있는 바, backend에서 사용할 DB 라이브러리를 써보려고 성능 테스트 비슷한걸 해봤습니다. 후보로는 QSqlQuery와 SOCI를 선택했고, 연속으로 10,000회 insert를 시도했습니다. 결과는 아래와 같습니다:
  • 단일 쿼리 반복
    • QSqlQuery: 10000ms
    • SOCI: 2500ms
  • Prepared statement
    • QSqlQuery: 7000ms
    • SOCI: 750ms(?!)
어떤 상황에서든, SOCI가 QSqlQuery를 훨씬 뛰어넘는 처리속력을  보여주고 있습니다. 아무래도 QSqlQuery는 서버 상황에서는 썩 좋은 선택은 아닌 것 같습니다. 아무래도 쿼리를 구성하는데 사용되는 QString 특유의 비대함(?)이 문제가 아닐까 하는 생각이 드네요.

Wednesday, December 21, 2016

Recent trends in inflight entertainment system development

Recently I had some chance to use a lot of airlines, and I found some airlines have inflight entertainment system with quite remarkable user interface/experience. I tried to find out who was behind, and all of them were found to be developed by Panasonic Avionics. And what? The company is one of the protagonists in "customer success stories" from Qt Company.

Man, in the world of C++, Qt becomes the de facto standard.