forked from qt-creator/qt-creator
Fixed cursor positioning.
This commit is contained in:
@@ -63,6 +63,8 @@ void OutputFormatter::setPlainTextEdit(QPlainTextEdit *plainText)
|
|||||||
|
|
||||||
void OutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr)
|
void OutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr)
|
||||||
{
|
{
|
||||||
|
gotoEnd();
|
||||||
|
|
||||||
if (onStdErr)
|
if (onStdErr)
|
||||||
setFormat(StdErrFormat);
|
setFormat(StdErrFormat);
|
||||||
else
|
else
|
||||||
@@ -73,6 +75,8 @@ void OutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr
|
|||||||
|
|
||||||
void OutputFormatter::appendMessage(const QString &text, bool isError)
|
void OutputFormatter::appendMessage(const QString &text, bool isError)
|
||||||
{
|
{
|
||||||
|
gotoEnd();
|
||||||
|
|
||||||
if (isError)
|
if (isError)
|
||||||
setFormat(ErrorMessageFormat);
|
setFormat(ErrorMessageFormat);
|
||||||
else
|
else
|
||||||
@@ -121,3 +125,8 @@ void OutputFormatter::setFormat(Format theFormat) const
|
|||||||
if (m_formats)
|
if (m_formats)
|
||||||
plainTextEdit()->setCurrentCharFormat(m_formats[theFormat]);
|
plainTextEdit()->setCurrentCharFormat(m_formats[theFormat]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputFormatter::gotoEnd() const
|
||||||
|
{
|
||||||
|
plainTextEdit()->moveCursor(QTextCursor::End);
|
||||||
|
}
|
||||||
|
@@ -72,6 +72,8 @@ protected:
|
|||||||
void initFormats();
|
void initFormats();
|
||||||
void setFormat(Format theFormat) const;
|
void setFormat(Format theFormat) const;
|
||||||
|
|
||||||
|
void gotoEnd() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPlainTextEdit *m_plainTextEdit;
|
QPlainTextEdit *m_plainTextEdit;
|
||||||
QTextCharFormat *m_formats;
|
QTextCharFormat *m_formats;
|
||||||
|
@@ -44,7 +44,8 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#define MAX_RECENT_ITEMS 6
|
#define MAX_RECENT_PROJECT_ITEMS 6
|
||||||
|
#define MAX_RECENT_SESSION_ITEMS 10
|
||||||
|
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ void ProjectWelcomePageWidget::updateWelcomePage(const WelcomePageData &welcomeP
|
|||||||
if (welcomePageData.sessionList.count() > 0) {
|
if (welcomePageData.sessionList.count() > 0) {
|
||||||
int items = 0;
|
int items = 0;
|
||||||
foreach (const QString &s, welcomePageData.sessionList) {
|
foreach (const QString &s, welcomePageData.sessionList) {
|
||||||
if (++items > MAX_RECENT_ITEMS)
|
if (++items > MAX_RECENT_SESSION_ITEMS)
|
||||||
break;
|
break;
|
||||||
QString str = s;
|
QString str = s;
|
||||||
if (welcomePageData.activeSession.isEmpty()) {
|
if (welcomePageData.activeSession.isEmpty()) {
|
||||||
@@ -128,7 +129,7 @@ void ProjectWelcomePageWidget::updateWelcomePage(const WelcomePageData &welcomeP
|
|||||||
int items = 0;
|
int items = 0;
|
||||||
QFontMetrics fm = fontMetrics();
|
QFontMetrics fm = fontMetrics();
|
||||||
foreach (const QStringPair &it, welcomePageData.projectList) {
|
foreach (const QStringPair &it, welcomePageData.projectList) {
|
||||||
if (++items > MAX_RECENT_ITEMS)
|
if (++items > MAX_RECENT_PROJECT_ITEMS)
|
||||||
break;
|
break;
|
||||||
const QFileInfo fi(it.first);
|
const QFileInfo fi(it.first);
|
||||||
QString label = "<b>" + it.second +
|
QString label = "<b>" + it.second +
|
||||||
|
@@ -49,7 +49,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Resume Session</string>
|
<string>Recent Sessions</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
@@ -46,6 +46,8 @@ QmlOutputFormatter::QmlOutputFormatter(QObject *parent)
|
|||||||
|
|
||||||
void QmlOutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr)
|
void QmlOutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr)
|
||||||
{
|
{
|
||||||
|
gotoEnd();
|
||||||
|
|
||||||
if (onStdErr)
|
if (onStdErr)
|
||||||
setFormat(StdErrFormat);
|
setFormat(StdErrFormat);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user