当前位置:网站首页>QT creator create button

QT creator create button

2022-07-06 11:04:00 it_ xiangqiang



Qt Creator Create button


Create button

To create a button type :

Select File > Create a new file or project > Qt > QML file (Qt Quick 2) > Select to create a named Button.qml Of QML file ( for example ).

Be careful : Only if the file name begins with a capital letter , Types will be listed in the Library .

single click “ Design ” In the “ form editor ” Edit file .

stay “ Navigator ” in , choice “ project ”, And then in “ attribute ” Set the width of the button in the view (W) And height (H).

take “ rectangular ” from “ library ” Drag and drop Navigator Projects in China . This will create a nested project , Where the item is the parent of the rectangle . Items are placed relative to their parents .

stay “ attribute ” In the view , Modify the appearance of the rectangle :

In the color field , Select button color .

stay “ radius ” Field , Set the radius of the rectangle to fillet the button .

choice Layout, And then choose (Fill to Parent) The button anchors the rectangle to the item .

Drag and drop the text type to Navigator Projects in China .

stay “ attribute ” In the view , edit “ Text ” Properties of type .

In the text field , Input Button.

You can go to “ text color ” Select the text color in the field , And in “ typeface ” Select the font in the section , Size and style .

stay “ alignment ” Field , Select the center button to align the text with the center of the button .

choice “ Layout ” >“ Fill as parent ” To anchor the text to the entire button area .

Press Ctrl + S Save button .

Qt Creator Create button _ Field

To be useful , You must create a button type in the project . When you deal with others in the project QML Document thought UI When creating screens or other components , The button type will be displayed in the “ library ” View's “ my QML Components ” Tab . for example , You can use it to create button instances and modify their properties to assign useful ID, Change its appearance and set the button text for each button instance .

To create graphic buttons that scale beautifully without using vector graphics , Please use “ Border image ” type .



原网站

版权声明
本文为[it_ xiangqiang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131645145400.html