【问题标题】:How to make the QML controls looks default better?如何使 QML 控件看起来更好?
【发布时间】:2018-10-13 19:19:40
【问题描述】:

我在 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"
    }
}

但是按钮看起来非常难看:

我应该做什么(打开或添加或smth)让它看起来更有吸引力?

例如,即使是默认的 Win10 视图也适合我。

答案加法: 这对我来说很难过,但没有办法让 QtQuick 应用程序看起来比自己实现所有控件更好。下面的答案解释了如何做到这一点。

【问题讨论】:

标签: qt qml qt5 qtquick2 qtquickcontrols2


【解决方案1】:

Controls 2 是一种新设计,从一开始就针对性能进行了优化,从某种意义上说,它们偏离了原生外观,朝着跨不同平台的统一外观方向发展。

您可以为 Controls 2 选择 some of the additional pre-defined stylescustomize a style in several ways,这将很容易让您获得更好的外观,唉,如果原生外观对您很重要,似乎没有捷径可走。还有 this effort to create yet another GUI library 专门用于原生外观,但它看起来像 WIP。

请注意,您仍然可以将旧的 QWidgets 样式与旧的控件一起使用,但这样做似乎需要将 widgets 模块作为项目依赖项引入,这并不理想。

【讨论】:

  • 同样在 Qt 5.12 中,Quick Controls 1 已被弃用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-02
  • 2013-03-15
  • 1970-01-01
  • 2012-06-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多