当前位置:网站首页>[QT] qtcreator shortcut key and QML introduction

[QT] qtcreator shortcut key and QML introduction

2022-06-25 08:15:00 Cappuccino-jay

In easy-to-use systems and professional systems , Shortcut keys are different . As a professional developer , You may Will spend a lot of time on your app , Every shortcut key can improve your work efficiency .Qt Creator So do the developers of , And many shortcut keys have been added to the application .

  • Ctrl+B - Build the project
  • Ctrl+R - Run the project
  • Ctrl+Tab - Switch open documents
  • Ctrl+k - Open locator
  • Esc - return
  • F2 - Find the corresponding symbol explanation .
  • F4 - Switch between header file and source file ( Only right c++ Code effective )
  • F1 - View help documents

QML grammar (QML Syntax)

QML Is a declarative language that describes the user interface . It breaks down the user interface into smaller elements , this Some elements can be combined into a component .QML Language describes the shape and behavior of user interface elements . User community Face can be used JavaScript To provide decoration , Or add more complex logic . From this point of view it follow HTML-JavaScript Pattern , but QML Is designed to describe the user interface , Not text files .

from QML The simplest way to learn is to understand the hierarchy of elements . The child element inherits the coordinates from the parent element System , its x,y The coordinate always corresponds to its parent element coordinate system .

  • import Declare that a specified module version is imported . Generally speaking, it will import QtQuick2.0 As the beginning A reference to an initial element .

  • Use // You can comment on a single line , Use /**/ You can comment on multiple lines , It's like C/C++ and JavaScript equally .

  • every last QML All files need a root element , It's like HTML equally .

  • An element uses its type declaration , And then use {} To include .

  • Elements have attributes , They followed name:value The format of .

  • Any in QML All elements in the document can use their id Visit (id Is an arbitrary identifier operator ).

  • Elements can be nested , This means that a parent element can have multiple child elements . Child elements can be accessed through ask parent Keyword to access their parent elements .

Suggest

You will often use id Or keywords parent To access your parent object . A better way is to name Your root element object id by rootid:root), So you don't have to think about your QML The root element in the document How should we name it .

原网站

版权声明
本文为[Cappuccino-jay]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250543246907.html