Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
15047f88
Commit
15047f88
authored
Jul 06, 2010
by
con
Browse files
Application output always scrolled, and moved the cursor.
Task-number: QTCREATORBUG-1790 Reviewed-by: dt Reviewed-by: mae
parent
dec87b22
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/outputformatter.cpp
View file @
15047f88
...
...
@@ -63,26 +63,24 @@ void OutputFormatter::setPlainTextEdit(QPlainTextEdit *plainText)
void
OutputFormatter
::
appendApplicationOutput
(
const
QString
&
text
,
bool
onStdErr
)
{
gotoEnd
();
if
(
onStdErr
)
setFormat
(
StdErrFormat
);
else
setFormat
(
StdOutFormat
);
plainTextEdit
()
->
insertPlainText
(
text
);
append
(
text
,
onStdErr
?
StdErrFormat
:
StdOutFormat
);
}
void
OutputFormatter
::
appendMessage
(
const
QString
&
text
,
bool
isError
)
{
gotoEnd
();
append
(
text
,
isError
?
ErrorMessageFormat
:
NormalMessageFormat
);
}
if
(
isError
)
setFormat
(
ErrorMessageFormat
);
else
setFormat
(
NormalMessageFormat
);
void
OutputFormatter
::
append
(
const
QString
&
text
,
Format
format
)
{
append
(
text
,
m_formats
[
format
]);
}
plainTextEdit
()
->
insertPlainText
(
text
);
void
OutputFormatter
::
append
(
const
QString
&
text
,
const
QTextCharFormat
&
format
)
{
QTextCursor
cursor
(
m_plainTextEdit
->
document
());
cursor
.
movePosition
(
QTextCursor
::
End
);
cursor
.
insertText
(
text
,
format
);
}
void
OutputFormatter
::
mousePressEvent
(
QMouseEvent
*
/*e*/
)
...
...
@@ -119,14 +117,3 @@ void OutputFormatter::initFormats()
m_formats
[
StdErrFormat
].
setFont
(
font
);
m_formats
[
StdErrFormat
].
setForeground
(
QColor
(
200
,
0
,
0
));
}
void
OutputFormatter
::
setFormat
(
Format
theFormat
)
const
{
if
(
m_formats
)
plainTextEdit
()
->
setCurrentCharFormat
(
m_formats
[
theFormat
]);
}
void
OutputFormatter
::
gotoEnd
()
const
{
plainTextEdit
()
->
moveCursor
(
QTextCursor
::
End
);
}
src/plugins/projectexplorer/outputformatter.h
View file @
15047f88
...
...
@@ -70,9 +70,8 @@ protected:
};
void
initFormats
();
void
setFormat
(
Format
theFormat
)
const
;
void
gotoEnd
()
const
;
void
append
(
const
QString
&
text
,
Format
format
);
void
append
(
const
QString
&
text
,
const
QTextCharFormat
&
format
);
private:
QPlainTextEdit
*
m_plainTextEdit
;
...
...
src/plugins/projectexplorer/outputwindow.cpp
View file @
15047f88
...
...
@@ -496,8 +496,7 @@ void OutputWindow::appendMessage(const QString &out, bool isError)
bool
OutputWindow
::
isScrollbarAtBottom
()
const
{
return
blockBoundingRect
(
document
()
->
lastBlock
()).
bottom
()
+
contentOffset
().
y
()
<=
viewport
()
->
rect
().
bottom
();
return
verticalScrollBar
()
->
value
()
==
verticalScrollBar
()
->
maximum
();
}
void
OutputWindow
::
scrollToBottom
()
...
...
src/plugins/qmlprojectmanager/qmloutputformatter.cpp
View file @
15047f88
...
...
@@ -46,15 +46,7 @@ QmlOutputFormatter::QmlOutputFormatter(QObject *parent)
void
QmlOutputFormatter
::
appendApplicationOutput
(
const
QString
&
text
,
bool
onStdErr
)
{
gotoEnd
();
if
(
onStdErr
)
setFormat
(
StdErrFormat
);
else
setFormat
(
StdOutFormat
);
QTextCharFormat
normalFormat
=
plainTextEdit
()
->
currentCharFormat
();
QTextCharFormat
linkFormat
=
normalFormat
;
QTextCharFormat
linkFormat
;
linkFormat
.
setForeground
(
plainTextEdit
()
->
palette
().
link
().
color
());
linkFormat
.
setUnderlineStyle
(
QTextCharFormat
::
SingleUnderline
);
linkFormat
.
setAnchor
(
true
);
...
...
@@ -64,17 +56,15 @@ void QmlOutputFormatter::appendApplicationOutput(const QString &text, bool onStd
while
(
m_qmlError
.
indexIn
(
text
,
index
)
!=
-
1
)
{
const
int
matchPos
=
m_qmlError
.
pos
(
1
);
const
QString
leader
=
text
.
mid
(
index
,
matchPos
-
index
);
plainTextEdit
()
->
insertPlainText
(
leader
);
append
(
leader
,
onStdErr
?
StdErrFormat
:
StdOutFormat
);
const
QString
matched
=
m_qmlError
.
cap
(
1
);
linkFormat
.
setAnchorHref
(
matched
);
plainTextEdit
()
->
setCurrentCharFormat
(
linkFormat
);
plainTextEdit
()
->
insertPlainText
(
matched
);
plainTextEdit
()
->
setCurrentCharFormat
(
normalFormat
);
append
(
matched
,
linkFormat
);
index
=
matchPos
+
m_qmlError
.
matchedLength
()
-
1
;
}
plainTextEdit
()
->
insertPlainText
(
text
.
mid
(
index
)
);
append
(
text
.
mid
(
index
),
onStdErr
?
StdErrFormat
:
StdOutFormat
);
}
void
QmlOutputFormatter
::
mousePressEvent
(
QMouseEvent
*
/*e*/
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment