forked from qt-creator/qt-creator
Clang: Add placeholder text to Clang Query
Task-number: QTCREATORBUG-18815 Change-Id: Ie5d53f0b3f2464408bb09022483a3a6258e8173d Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -36,6 +36,7 @@ ClangQueryExampleTextEditorWidget::ClangQueryExampleTextEditorWidget(QWidget *pa
|
|||||||
{
|
{
|
||||||
m_syntaxHighlighter = new ClangQueryExampleHighlighter;
|
m_syntaxHighlighter = new ClangQueryExampleHighlighter;
|
||||||
textDocument()->setSyntaxHighlighter(m_syntaxHighlighter);
|
textDocument()->setSyntaxHighlighter(m_syntaxHighlighter);
|
||||||
|
textDocument()->setPlainText("class Foo {\n void function() { int local; }\n int field;\n};");
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangQueryExampleHighlighter *ClangQueryExampleTextEditorWidget::syntaxHighlighter() const
|
ClangQueryExampleHighlighter *ClangQueryExampleTextEditorWidget::syntaxHighlighter() const
|
||||||
|
@@ -6,14 +6,29 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1241</width>
|
<width>512</width>
|
||||||
<height>471</height>
|
<height>390</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>512</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -30,20 +45,32 @@
|
|||||||
<widget class="ClangRefactoring::ClangQueryExampleTextEditorWidget" name="exampleSourceTextEdit">
|
<widget class="ClangRefactoring::ClangQueryExampleTextEditorWidget" name="exampleSourceTextEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>1</horstretch>
|
||||||
<verstretch>3</verstretch>
|
<verstretch>3</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string notr="true">class Foo { void function() { int x; } };</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ClangRefactoring::ClangQueryTextEditorWidget" name="queryTextEdit">
|
<widget class="ClangRefactoring::ClangQueryTextEditorWidget" name="queryTextEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>1</horstretch>
|
||||||
<verstretch>1</verstretch>
|
<verstretch>1</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>700</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string notr="true">functionDecl()</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@@ -38,6 +38,7 @@ ClangQueryTextEditorWidget::ClangQueryTextEditorWidget(QWidget *parent)
|
|||||||
m_hoverHandler(std::make_unique<ClangQueryHoverHandler>(m_syntaxHighlighter))
|
m_hoverHandler(std::make_unique<ClangQueryHoverHandler>(m_syntaxHighlighter))
|
||||||
{
|
{
|
||||||
textDocument()->setSyntaxHighlighter(m_syntaxHighlighter);
|
textDocument()->setSyntaxHighlighter(m_syntaxHighlighter);
|
||||||
|
textDocument()->setPlainText("functionDecl()");
|
||||||
|
|
||||||
addHoverHandler(m_hoverHandler.get());
|
addHoverHandler(m_hoverHandler.get());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user