Aer*_*Sun 5 qt qml qt5 qtquick2 qtquickcontrols2
我在 QtCreator 中创建了默认的“空”qml 应用程序。然后我只需添加按钮并运行它:
import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick.Controls 2.4
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Button {
text: "Button1"
}
}
Run Code Online (Sandbox Code Playgroud)
但是按钮看起来非常丑陋:
我应该做什么(打开或添加或 smth)使它看起来更有吸引力?
例如,即使是默认的 Win10 视图也适合我。
答除了:它给我伤心,但没有办法让QtQuick应用看起来比通过自我实现所有comtrols的。下面的答案解释了如何做到这一点。
Controls 2 are a new design, from the ground up optimized for performance and they are in a sense departure away from native look and feel, in a direction of a unified look and feel across different platforms.
您可以为 Controls 2选择一些额外的预定义样式,或者通过多种方式自定义样式,这将轻松让您获得更好的外观,可惜如果本机外观对您很重要,似乎没有捷径对此。我们还努力创建另一个专门针对本机外观和感觉的 GUI 库,但它看起来像是 WIP。
请注意,您仍然可以将旧的 QWidgets 样式与旧的 Controls 一起使用,但这样做似乎需要将模块作为项目依赖项引入widgets
,这并不理想。