2017-04-27 00:53

使用qt quick designer制作qml


哪位大神用qt quick designer制作过qml文件
我使用qt quick designer感觉不如代码编辑器灵活,好多功能都实现不了

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • u011012932 一去丶二三里 4年前

    Designer 是设计师,满足常规的一些操作,如果要进行更高级的処理,必然是要结合代码编辑器的。


    点赞 1 评论 复制链接分享
  • chengnan5603 chengnan5603 4年前

    看了下面的说明,qt quick designer确实不能实现qml的所有逻辑,只能编辑 declarative form,而且还存在下面所列出的限制。
    但在使用qt quick designer时总是在摸索着使用,一定有某些本来支持的功能没有发掘出来。
    有没有qt quick designer更细的教程或是技巧总结,分享一下

    The classical Widget Designer is built around the distinction between declarative form and imperative logic. The declarative form is designable and stored in .ui files.

    In Qml it is easy to mix declarative code and imperative code. If you add imperative instructions (affecting visual aspects) to your Qml files they are not purely declarative anymore and the visual representation in the visual editor will break. The visual editor needs a way to translate the visual description back into the text description. For imperative code this is not possible in general and the Qt Quick Designer does not even try.

    The documentation for QML Documents says:

    Since Qt 5.4, a document can also have the file extension ".ui.qml". The QML engine handles these files like standard .qml files and ignores the .ui part of the extension. Qt Creator handles those files as UI forms for the Qt Quick Designer. The files can contain only a subset of the QML language that is defined by Qt Creator.

    Qt Quick UI Forms:

    You can use Qt Creator wizards to create UI forms that have the filename extension .ui.qml. The UI forms contain a purely declarative subset of the QML language. It is recommended that you edit the forms in the Design mode. However, exporting items as alias properties is a commercial only feature, and therefore you must use the Edit mode to do it if you are using the open source version of Qt Creator. Qt Creator enforces the use of the supported QML features by displaying error messages.

    The following features are not supported:
    •JavaScript blocks
    •Function definitions
    •Function calls (except qsTr)
    •Other bindings than pure expressions
    •Signal handlers
    •States in other items than the root item
    •Root items that are not derived from QQuickItem or Item

    The following types are not supported:
    •Shader Effect

    点赞 评论 复制链接分享