Gluon/Creator: Difference between revisions

From KDE Community Wiki
(Created page with "== Overlay-based semi-interactive introductory tour == Inspired by the N9's tour. Provide an interactive tour of all the important elements of Creator. Code for a transparent QM...")
 
No edit summary
Line 1: Line 1:
== Overlay-based semi-interactive introductory tour ==
== Overlay-based semi-interactive introductory tour ==
Inspired by the N9's tour. Provide an interactive tour of all the important elements of Creator.
<strike>Inspired by the N9's tour. Provide an interactive tour of all the important elements of Creator.</strike>
Implemented as part of GSoC in branch creator-qmlintro-shreya.


Code for a transparent QML overlay (added to main.cpp line 58)
==Ignore prefixed dynamic properties==
For static properties we have an easy way to hide them - use the DESIGNABLE attribute. This is however not usable for dynamic properties. It would be useful to have some way to mark internal properties. For example, the material system is heavily based on dynamic properties, yet things like the model/view/projection matrices really shouldn't be exposed in Creator.


<syntaxhighlight lang="cpp-qt">
Current thinking is to filter out all properties with some kind of prefix - _property or _gluon_property or _gluon_internal_property or similar. This should be standardised and used in all places.
QDeclarativeView* view = new QDeclarativeView( QUrl::fromLocalFile( KGlobal::dirs()->locate( "appdata", "introduction.qml" ) ), window );
view->setStyleSheet("background: transparent");
view->setResizeMode( QDeclarativeView::SizeRootObjectToView );
view->setGeometry( window->rect() );
view->rootContext()->setContextProperty( "targetRect", window->findChild<QWidget*>( "ComponentsDock" )->frameGeometry() );
view->show();
</syntaxhighlight>
 
Contents of introduction.qml:
 
<syntaxhighlight lang="javascript">
import QtQuick 1.0
 
Item {
    Rectangle {
        id: topOverlay;
       
        anchors.top: parent.top;
        anchors.left: parent.left;
        anchors.right: parent.right;
        anchors.bottom: viewport.top;
       
        opacity: 0.5;
        color: "black";
    }
 
    Rectangle {
        id: leftOverlay;
       
        anchors.top: topOverlay.bottom;
        anchors.left: parent.left;
        anchors.right: viewport.left;
        anchors.bottom: bottomOverlay.top;
       
        opacity: 0.5;
        color: "black";
    }
    Rectangle {
        id: rightOverlay;
       
        anchors.top: topOverlay.bottom;
        anchors.left: viewport.right;
        anchors.right: parent.right;
        anchors.bottom: bottomOverlay.top;
       
        opacity: 0.5;
        color: "black";
    }
    Rectangle {
        id: bottomOverlay;
       
        anchors.top: viewport.bottom;
        anchors.left: parent.left;
        anchors.right: parent.right;
        anchors.bottom: parent.bottom;
       
        opacity: 0.5;
        color: "black";
    }
   
    Item {
        id: viewport;
       
        width: parent.width / 2;
        height: parent.height / 2;
        x: parent.width / 4;
        y: parent.height / 4;
       
        Behavior on width { NumberAnimation { duration: 500; } }
        Behavior on height { NumberAnimation { duration: 500; } }
        Behavior on x { NumberAnimation { duration: 500; } }
        Behavior on y { NumberAnimation { duration: 500; } }
    }
   
    MouseArea {
        anchors.fill: parent;
       
        //drag.target: viewport;
       
        onClicked: {
            viewport.x = targetRect.x;
            viewport.y = targetRect.y;
            viewport.width = targetRect.width;
            viewport.height = targetRect.height;
        }
    }
}
</syntaxhighlight>

Revision as of 15:06, 16 November 2012

Overlay-based semi-interactive introductory tour

Inspired by the N9's tour. Provide an interactive tour of all the important elements of Creator. Implemented as part of GSoC in branch creator-qmlintro-shreya.

Ignore prefixed dynamic properties

For static properties we have an easy way to hide them - use the DESIGNABLE attribute. This is however not usable for dynamic properties. It would be useful to have some way to mark internal properties. For example, the material system is heavily based on dynamic properties, yet things like the model/view/projection matrices really shouldn't be exposed in Creator.

Current thinking is to filter out all properties with some kind of prefix - _property or _gluon_property or _gluon_internal_property or similar. This should be standardised and used in all places.