2016-12-16 36 views
1

QtクイックテンプレートポップアップとQtQuickコントロールポップアップの違いは何ですか?QtQuickテンプレートポップアップとQtQuickコントロールポップアップ

私がimport QtQuick.Templates 2.0から得たポップアップとimport QtQuick.Controls 2.0の動作には小さな違いがあるようです。

[1] https://doc-snapshots.qt.io/qt5-5.8/qml-qtquick-controls2-popup.html

[2] http://doc.qt.io/qt-5/qtquick-templates2-qmlmodule.html

答えて

2

テンプレートグラフィカル部品なしで実際のコントロールだけ論理的骨格であり、コントロールからポップアップテンプレートからポップアップのわずか飾らバージョンであります:

//Popup.qml 
import QtQuick 2.6 
import QtQuick.Templates 2.0 as T 

T.Popup { 
    id: control 

    implicitWidth: Math.max(background ? background.implicitWidth : 0, 
          contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) 
    implicitHeight: Math.max(background ? background.implicitHeight : 0, 
          contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0) 

    contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) 
    contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) 

    padding: 12 

    contentItem: Item { } 

    background: Rectangle { 
     border.color: "#353637" 
    } 
} 

実際には動作上の違いはありません。

関連する問題