2014-02-14 3 views
1

Я не нашел никакого хорошего ресурса, как использовать этот компонент, и он все еще не выполняет макет моего приложения (проверьте, что правый инспектор свойств). Что я сделал не так?Qt быстрые элементы управления ScrollView

без ScrollView

without ScrollView

с ScrollView with ScrollView

прокрутки этого кода вниз, пожалуйста, то Scrollview определяется последним

import QtQuick 2.1 
import QtQuick.Controls 1.0 
import QtQuick.Layouts 1.1 

ApplicationWindow { 
    title: qsTr("Hello World") 
    width: 1400 
    height: 800 
    color: "#414141" 

    menuBar: MenuBar { 
     Menu { 
      title: qsTr("File") 
      MenuItem { 
       text: qsTr("Exit") 
       onTriggered: Qt.quit(); 
      } 
     } 
    } 

    ColumnLayout { 

     anchors.fill: parent 

     Rectangle { 
      color: "#414141" 
      Layout.fillWidth: true 
      Layout.preferredHeight: 50 
      MyLabel { 
       text: "Toolbar" 
      } 
     } 

     SplitView { 

      Layout.fillHeight: true 
      Layout.fillWidth: true 
      orientation: Qt.Horizontal 
      handleDelegate: MyVSlider {} 

      SplitView { 

       Layout.fillHeight: true 
       Layout.fillWidth: true 
       orientation: Qt.Vertical 
       handleDelegate: MyHSlider {} 

       SplitView { 
        handleDelegate: MyVSlider {} 
        Layout.fillHeight: true 
        Layout.fillWidth: true 
        orientation: Qt.Horizontal 

        Rectangle { 
         color: "#565656" 
         Layout.fillHeight: true 
         Layout.preferredWidth: 200 
         Layout.minimumWidth: 200 
         MyLabel { 
          text: "Tree view" 
         } 
        } 

        Rectangle { 
         color: "#565656" 
         Layout.fillHeight: true 
         Layout.fillWidth: true 
         Layout.minimumWidth: 500 
         Layout.preferredHeight: 300 
         MyLabel { 
          text: "Scene view" 
         } 
        } 
       } 

       Rectangle { 
        color: "#565656" 
        Layout.fillWidth: true 
        Layout.preferredHeight: 200 
        Layout.minimumHeight: 200 
        MyLabel { 
         text: "Console output" 
        } 
       } 
      } 

      Rectangle { 
       id: inspector 
       color: "#565656" 
       Layout.fillHeight: true 
       Layout.preferredWidth: 200 
       Layout.minimumWidth: 200 
       MyLabel { 
        text: "Properties inspector" 
       } 
      } 


      ScrollView { 
       contentItem: inspector 
      } 

     } 
    } 

} 

ответ

0

Вы пытаетесь проксировать свой элемент inspector? Вы хотите, чтобы элемент был прокручен в пределах ScrollView.

т.е.

ScrollView { 
    Rectangle { 
      id: inspector 
      color: "#565656" 
      Layout.fillHeight: true 
      Layout.preferredWidth: 200 
      Layout.minimumWidth: 200 
      MyLabel { 
       text: "Properties inspector" 
      } 

      // Make the thing really big. 
      width: 1000 
      height: 1000 
    } 
} 

Это заставит ваш inspector, чтобы показать с полосой прокрутки, если вы установите width и height, как я сделал выше.

Смежные вопросы