forked from qt-creator/qt-creator
TextEditor: Set widthFactor from TextMark ctor
The text marks are added to the document from their ctor. The document then uses the widthFactor to calculate the space needed for them. If the widthFactor is only set afterwards, the calculated space is wrong. Change-Id: Ic7d24f99cc78d1bf084b2b1cfdf6b955496072f3 Task-number: QTCREATORBUG-17833 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -33,10 +33,9 @@ namespace Internal {
|
|||||||
|
|
||||||
QmlProfilerTextMark::QmlProfilerTextMark(QmlProfilerTool *tool, int typeId, const QString &fileName,
|
QmlProfilerTextMark::QmlProfilerTextMark(QmlProfilerTool *tool, int typeId, const QString &fileName,
|
||||||
int lineNumber) :
|
int lineNumber) :
|
||||||
TextMark(fileName, lineNumber, Constants::TEXT_MARK_CATEGORY), m_tool(tool),
|
TextMark(fileName, lineNumber, Constants::TEXT_MARK_CATEGORY, 3.5), m_tool(tool),
|
||||||
m_typeIds(1, typeId)
|
m_typeIds(1, typeId)
|
||||||
{
|
{
|
||||||
setWidthFactor(3.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTextMark::addTypeId(int typeId)
|
void QmlProfilerTextMark::addTypeId(int typeId)
|
||||||
|
@@ -41,14 +41,14 @@ using namespace TextEditor::Internal;
|
|||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
TextMark::TextMark(const QString &fileName, int lineNumber, Id category)
|
TextMark::TextMark(const QString &fileName, int lineNumber, Id category, double widthFactor)
|
||||||
: m_baseTextDocument(0),
|
: m_baseTextDocument(0),
|
||||||
m_fileName(fileName),
|
m_fileName(fileName),
|
||||||
m_lineNumber(lineNumber),
|
m_lineNumber(lineNumber),
|
||||||
m_priority(NormalPriority),
|
m_priority(NormalPriority),
|
||||||
m_visible(true),
|
m_visible(true),
|
||||||
m_category(category),
|
m_category(category),
|
||||||
m_widthFactor(1.0)
|
m_widthFactor(widthFactor)
|
||||||
{
|
{
|
||||||
if (!m_fileName.isEmpty())
|
if (!m_fileName.isEmpty())
|
||||||
TextEditorPlugin::baseTextMarkRegistry()->add(this);
|
TextEditorPlugin::baseTextMarkRegistry()->add(this);
|
||||||
|
@@ -50,7 +50,7 @@ namespace Internal { class TextMarkRegistry; }
|
|||||||
class TEXTEDITOR_EXPORT TextMark
|
class TEXTEDITOR_EXPORT TextMark
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextMark(const QString &fileName, int lineNumber, Core::Id category);
|
TextMark(const QString &fileName, int lineNumber, Core::Id category, double widthFactor = 1.0);
|
||||||
virtual ~TextMark();
|
virtual ~TextMark();
|
||||||
|
|
||||||
// determine order on markers on the same line.
|
// determine order on markers on the same line.
|
||||||
|
@@ -42,11 +42,10 @@ namespace Constants { const char CALLGRIND_TEXT_MARK_CATEGORY[] = "Callgrind.Tex
|
|||||||
|
|
||||||
CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index,
|
CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index,
|
||||||
const QString &fileName, int lineNumber)
|
const QString &fileName, int lineNumber)
|
||||||
: TextEditor::TextMark(fileName, lineNumber, Constants::CALLGRIND_TEXT_MARK_CATEGORY)
|
: TextEditor::TextMark(fileName, lineNumber, Constants::CALLGRIND_TEXT_MARK_CATEGORY, 4.0)
|
||||||
, m_modelIndex(index)
|
, m_modelIndex(index)
|
||||||
{
|
{
|
||||||
setPriority(TextEditor::TextMark::HighPriority);
|
setPriority(TextEditor::TextMark::HighPriority);
|
||||||
setWidthFactor(4.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindTextMark::paint(QPainter *painter, const QRect &paintRect) const
|
void CallgrindTextMark::paint(QPainter *painter, const QRect &paintRect) const
|
||||||
|
Reference in New Issue
Block a user