forked from qt-creator/qt-creator
		
	QmlDesigner.contextPane: nicer positioning for the pane
This commit is contained in:
		@@ -109,6 +109,18 @@ void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document:
 | 
			
		||||
            offset = objectBinding->firstSourceLocation().offset;
 | 
			
		||||
            end = objectBinding->lastSourceLocation().end();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int line1;
 | 
			
		||||
        int column1;
 | 
			
		||||
        int line2;
 | 
			
		||||
        int column2;
 | 
			
		||||
        m_editor->convertPosition(offset, &line1, &column1); //get line
 | 
			
		||||
        m_editor->convertPosition(end, &line2, &column2); //get line
 | 
			
		||||
 | 
			
		||||
        QRegion reg;
 | 
			
		||||
        if (line1 > -1 && line2 > -1)
 | 
			
		||||
            reg = m_editor->editor()->translatedLineRegion(line1 - 1, line2);
 | 
			
		||||
 | 
			
		||||
        if (name.contains("Text")) {
 | 
			
		||||
            m_node = 0;
 | 
			
		||||
            PropertyReader propertyReader(doc.data(), initializer);
 | 
			
		||||
@@ -117,11 +129,15 @@ void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document:
 | 
			
		||||
            QPoint p1 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(editor->editor()->cursorRect(tc).topLeft()) - QPoint(0, contextWidget()->height() + 10));
 | 
			
		||||
            tc.setPosition(end);
 | 
			
		||||
            QPoint p2 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(editor->editor()->cursorRect(tc).bottomLeft()) + QPoint(0, 10));
 | 
			
		||||
            QPoint offset = QPoint(10, 0);
 | 
			
		||||
            if (reg.boundingRect().width() < 400)
 | 
			
		||||
                offset = QPoint(400 - reg.boundingRect().width() + 10 ,0);
 | 
			
		||||
            QPoint p3 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(reg.boundingRect().topRight()) + offset);
 | 
			
		||||
            p2.setX(p1.x());
 | 
			
		||||
            if (!update)
 | 
			
		||||
                contextWidget()->activate(p1 , p2);
 | 
			
		||||
                contextWidget()->activate(p3 , p1, p2);
 | 
			
		||||
            else
 | 
			
		||||
                contextWidget()->rePosition(p1 , p2);
 | 
			
		||||
                contextWidget()->rePosition(p3 , p1, p2);
 | 
			
		||||
            m_blockWriting = true;
 | 
			
		||||
            contextWidget()->setType(name);
 | 
			
		||||
            contextWidget()->setProperties(&propertyReader);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user