diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 40333e9fb3d3bd0b5d8ac77576aa42826100cd24..6118237a8c862f79470bcf7af1be0ce02b65f91f 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -157,8 +157,10 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia if (parentObjectValue) objectValue->setProperty(QLatin1String("parent"), parentObjectValue); - else + else { _rootObjectValue = objectValue; + _rootObjectValue->setClassName(_doc->componentName()); + } accept(initializer); diff --git a/src/plugins/qmldesigner/components/resources/outputpane-style.css b/src/plugins/qmldesigner/components/resources/outputpane-style.css new file mode 100644 index 0000000000000000000000000000000000000000..c8a4b256a475d4b17a465e61c2df0aaece0578f0 --- /dev/null +++ b/src/plugins/qmldesigner/components/resources/outputpane-style.css @@ -0,0 +1,149 @@ +QFrame { + border: 2px; + background-color: #4f4f4f; +} + +QLabel { + border: none; + border-image: none; + padding: 0; + background: none; + color: #E1E1E1; +} + +QScrollArea { + border: 0px; + background-color: #4f4f4f; +} + +QStackedWidget { + border: 0px; + background-color: #4f4f4f; +} + + +QGraphicsView { + border: 0px; + background-color: #4f4f4f; +} + +QTabWidget { + border: 0px; + background-color: #4f4f4f; +} + +QTabWidget::pane { /* The tab widget frame */ + border: 0px; + background-color: #4f4f4f; +} + +QLineEdit +{ + border: 2px solid #8F8F8F; + border-radius: 4px; + padding: 0 8px; + background-color: white; + selection-background-color: darkgray; +} + +QLineEdit#itemLibrarySearchInput { + color: black; + border: 2px solid #0F0F0F; + border-radius: 6px; + border-width: 1; + max-height: 20px; + min-height: 20px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #e0e0e0, stop: 1 #f0f0f0); +} + + + QTreeView { + color: white; + selection-color: white + } + + QTreeView::item:selected { + color: white; + } + +QTreeView::branch:has-siblings:!adjoins-item { + border-image: none; + image:none; + } + + QTreeView::branch:has-siblings:adjoins-item { + border-image: none; + image:none; + } + + QTreeView::branch:!has-children:!has-siblings:adjoins-item { + border-image: none; + image:none; + } + + QTreeView::branch:has-children:!has-siblings:closed, + QTreeView::branch:closed:has-children:has-siblings { + border-image: none; + image: url(:/qmldesigner/images/triangle_horz.png); + } + + QTreeView::branch:open:has-children:!has-siblings, + QTreeView::branch:open:has-children:has-siblings { + border-image: none; + image: url(:/qmldesigner/images/triangle_vert.png); + } + + QListView { + color: white; + selection-color: white + } + + QListView::item:selected { + color: white; + } + + QComboBox QAbstractItemView { + show-decoration-selected: 1; /* make the selection span the entire width of the view */ + background-color: #494949; /* sets background of the menu */ + border: 1px solid black; + margin: 0px; /* some spacing around the menu */ + color: #cacaca; + selection-background-color: #d2d2d2; + selection-color: #404040; + } + +QTabBar::tab { + border-image: none; + + width: 80px; + + height: 22px; + margin-top: 0x; + margin-bottom: 0px; + margin-left: 0px; + margin-right: 0px; + font: bold; + font-size: 11px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #3c3c3c, stop: 1 #444444); + + color: #EEEEEE; +} + +QTabBar::tab:hover { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #3c3c3c, stop: 1 #666666); +} + +QTabBar::tab:selected { + border: none; /* no border for a flat push button */ + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #EFEFEF, stop: 1 #EEEEEE); + color: #3c3c3c; +} + +QWidget#itemLibrarySearchInputFrame { + background-color: #eeeeee; +} + diff --git a/src/plugins/qmlinspector/components/objectpropertiesview.cpp b/src/plugins/qmlinspector/components/objectpropertiesview.cpp index 677330f078b23a4aa0c3f8eecac55ffe4889060f..17a98d2aec9ebd29f5c0309047fdf2a2d27ae7b8 100644 --- a/src/plugins/qmlinspector/components/objectpropertiesview.cpp +++ b/src/plugins/qmlinspector/components/objectpropertiesview.cpp @@ -250,6 +250,14 @@ QString ObjectPropertiesView::propertyBaseClass(const QDeclarativeDebugObjectRef PropertyTypeFinder find(document, snapshot, modelManager->importPaths()); QString baseClassName = find(object.source().lineNumber(), object.source().columnNumber(), property.name()); + + if (baseClassName.isEmpty()) { + if (!object.idString().isEmpty()) + baseClassName = object.idString(); + else + baseClassName = QString("<%1>").arg(object.className()); + } + depth = find.depth(); return baseClassName; diff --git a/src/plugins/qmlinspector/components/propertytypefinder.cpp b/src/plugins/qmlinspector/components/propertytypefinder.cpp index 58e48969a6f81d67ada251af673ca3b4302f5227..dd4e0249dca98a229198034a56a0551191cdfa14 100644 --- a/src/plugins/qmlinspector/components/propertytypefinder.cpp +++ b/src/plugins/qmlinspector/components/propertytypefinder.cpp @@ -14,7 +14,9 @@ PropertyTypeFinder::PropertyTypeFinder(QmlJS::Document::Ptr doc, QmlJS::Snapshot , m_snapshot(snapshot) , m_engine() , m_context(&m_engine) - , m_link(&m_context, doc, snapshot, importPaths), m_depth(0) + , m_link(&m_context, doc, snapshot, importPaths) + , m_scopeBuilder(doc, &m_context) + , m_depth(0) { } @@ -22,20 +24,11 @@ QString PropertyTypeFinder::operator()(int objectLine, int objectColumn, const Q { m_objectLine = objectLine; m_objectColumn = objectColumn; - m_typeNameId = 0; + m_propertyName = propertyName; + m_definingClass.clear(); Node::accept(m_doc->ast(), this); - if (m_typeNameId) { - for (const ObjectValue *iter = m_context.lookupType(m_doc.data(), m_typeNameId); iter; iter = iter->prototype(&m_context)) { - if (iter->lookupMember(propertyName, &m_context, false)) { - // gotcha! - return iter->className(); - } - ++m_depth; - } - } - //### Eep: we didn't find it... - return QString(); + return m_definingClass; } int PropertyTypeFinder::depth() const @@ -45,14 +38,28 @@ int PropertyTypeFinder::depth() const bool PropertyTypeFinder::visit(QmlJS::AST::UiObjectBinding *ast) { + m_scopeBuilder.push(ast); + return check(ast->qualifiedTypeNameId); } bool PropertyTypeFinder::visit(QmlJS::AST::UiObjectDefinition *ast) { + m_scopeBuilder.push(ast); + return check(ast->qualifiedTypeNameId); } +void PropertyTypeFinder::endVisit(QmlJS::AST::UiObjectBinding * /*ast*/) +{ + m_scopeBuilder.pop(); +} + +void PropertyTypeFinder::endVisit(QmlJS::AST::UiObjectDefinition * /*ast*/) +{ + m_scopeBuilder.pop(); +} + bool PropertyTypeFinder::check(QmlJS::AST::UiQualifiedId *qId) { if (!qId) @@ -61,7 +68,14 @@ bool PropertyTypeFinder::check(QmlJS::AST::UiQualifiedId *qId) if (qId->identifierToken.startLine == m_objectLine && qId->identifierToken.startColumn == m_objectColumn) { // got it! - m_typeNameId = qId; + for (const ObjectValue *iter = m_context.scopeChain().qmlScopeObjects.last(); iter; iter = iter->prototype(&m_context)) { + + if (iter->lookupMember(m_propertyName, &m_context, false)) { + m_definingClass = iter->className(); + return true; + } + ++m_depth; + } return false; } diff --git a/src/plugins/qmlinspector/components/propertytypefinder.h b/src/plugins/qmlinspector/components/propertytypefinder.h index 69bc6a272b32a7b32511d6b8357c99119b8cd7ad..bb039306220adc963aff8e8a2afc16dda539841d 100644 --- a/src/plugins/qmlinspector/components/propertytypefinder.h +++ b/src/plugins/qmlinspector/components/propertytypefinder.h @@ -5,6 +5,7 @@ #include <qmljs/parser/qmljsastvisitor_p.h> #include <qmljs/qmljsinterpreter.h> #include <qmljs/qmljslink.h> +#include <qmljs/qmljsscopebuilder.h> namespace Qml { namespace Internal { @@ -18,10 +19,13 @@ public: int depth() const; protected: using QmlJS::AST::Visitor::visit; + using QmlJS::AST::Visitor::endVisit; virtual bool visit(QmlJS::AST::UiObjectBinding *ast); virtual bool visit(QmlJS::AST::UiObjectDefinition *ast); + virtual void endVisit(QmlJS::AST::UiObjectBinding *ast); + virtual void endVisit(QmlJS::AST::UiObjectDefinition *ast); private: bool check(QmlJS::AST::UiQualifiedId *qId); @@ -32,10 +36,12 @@ private: QmlJS::Interpreter::Engine m_engine; QmlJS::Interpreter::Context m_context; QmlJS::Link m_link; + QmlJS::ScopeBuilder m_scopeBuilder; quint32 m_objectLine; quint32 m_objectColumn; - QmlJS::AST::UiQualifiedId *m_typeNameId; + QString m_definingClass; + QString m_propertyName; quint8 m_depth; };