Cross-platform software libraries and APIs
Qt Creator IDE and productivity tools
UI Design tool for UI composition
for Qt projects
Digital advertising for UI apps
Usage intelligence for embedded devices
GUI test automation
Code coverage analysis
Test results management and analysis
Software static code analysis
Software architecture verification
The latest version of Qt.
Make the most of Qt tools, with options for commercial licensing, subscriptions, or open-source.
Explore Qt features, the Framework essentials, modules, tools & add-ons.
The project offers PySide6 - the official Python bindings that enhance Python applications.
Qt empowers productivity across the entire product development lifecycle, from UI design and software development to quality assurance and deployment. Find the solution that best suits your needs.
Insight into the evolution and importance of user-centric trends and strategies.
Learn how to shorten development times, improve user experience, and deploy anywhere.
Get the latest resources, check out upcoming events, and see who’s innovating with Qt.
Stay informed about our live events and webinars, whether they're online, in person, or face-to-face.
Deep dive into the details, tech specs, and everything else you wish to know about Qt tools.
A wealth of Qt knowledge at your fingertips—discover your ideal learning resource or engage with the community.
Whether you're a beginner or a seasoned Qt pro, we have all the help and support you need to succeed.
5月 02, 2023 by Qt Group 日本オフィス | Comments
本稿は「Compiling QML to C++: Annotating JavaScript functions」の抄訳です。
今回は、QMLアプリケーションを調整してqmlscを最大限に活用する方法についての第2回目です。第1回目では、環境のセットアップと初期測定を行いました。最初にそれを読むことを強くお勧めします。測定したのは、ButtonsBar.qmlのupdateLockButton()関数を最適化する前にかかる時間です。8回の呼び出しで61.4μs、1回の呼び出しで平均7.67μsでした(統計的に有意ではありませんが、実証の目的には十分です)。
さて、先ほどの警告に戻りましょう。qmlscは何を訴えているのでしょうか?「updateLockButton」関数の型アノテーションが見つからないのです。つまり、関数の「locked」パラメータの型が分からないので、関数をC++にコンパイルできないのです。まあ、これは簡単に直せますね。「locked」は明らかにbooleanであり、以下のように宣言すればよい:
function updateLockButton(locked: bool) {
lockButton.checked = !locked;
}
この変更を行い、再コンパイルと再プロファイルをしてみましょう。コンパイラの警告が消えていることに注目してください。違いはあっただろうか?私のマシンでは、統計によると累積時間は30.1μsで、各呼び出しに平均3.76μsかかっています。
繰り返しますが、これは統計的に有意な測定値ではありませんが、変更の影響をどのように感じ取ることができるかを示しています。
logButtonChecked()関数についても、同様の警告が表示されます:
Warning: ButtonsBar.qml:46:27: Could not compile function lockButtonChecked: function without type annotation returns bool of QQuickAbstractButton::checked with type bool
return lockButton.checked;
これは、コンパイラが戻り値の型注釈(type annotation)を求めていることを意味します。この関数は明らかにブーリアンを返すので、これも簡単に直せます:
function lockButtonChecked(): bool {
return lockButton.checked;
}
型注釈として使用できる型はQML型です。JavaScriptの型とは異なります。特に、値型(value type)とオブジェクト型(object type)が使用可能です。また、引数や戻り値のない関数を型付きとするために、戻り値の型としてvoidを明示的に指定することができます。値型に関するドキュメントは、最近更新されました。最新版については、ドキュメントのスナップショットを確認する必要があるかもしれません。
例えば、int、real、vector2d、Rectangleは型注釈として持つことができますが、object、numberは持つことができません。stringはQMLの型であると同時にJavaScriptの型でもあります。
C++から関数を呼び出す観点からの型注釈の説明もドキュメントに掲載されています。
型注釈の基本概念は、Qt 5.14以降、言語の一部となっています。void は Qt 6.2.3 以降、QML の組み込み型となっています。
Download the latest release here: www.qt.io/download.
Qt 6.6. is a feature release with focus on improving UX capabilities including responsive UI technology and the Qt Graph module.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
12 1, 2023
Qt for MCUs 2.5.2 LTS(長期サポート)がリリースされ、現在ダウンロードが可能です。このパッチリリースでは、Qt for MCUs..
11 26, 2023
Qt Creator 12のリリースをお知らせいたします。 新機能 統合Compiler Explorer ツール > Compiler..
Qt Group includes The Qt Company Oy and its global subsidiaries and affiliates.