kdevelop/kdevplatform/language/duchain
useswidget.cpp
Go to the documentation of this file.
68 if (range.start().column() < 0 || range.end().column() > line.length() || cutOff > leftCutRoom + rightCutRoom)
108 + QLatin1String("<span style=\"background-color:") + backgroundColor(false) + QLatin1String(";color:") +
110 + line.mid(range.start().column(), range.end().column() - range.start().column()).toHtmlEscaped()
112 line.mid(range.end().column(), line.length() - range.end().column()).toHtmlEscaped() + QLatin1String(
120 OneUseWidget::OneUseWidget(IndexedDeclaration declaration, const IndexedString& document, KTextEditor::Range range,
125 //Make the sizing of this widget independent of the content, because we will adapt the content to the size
141 QString text = QLatin1String("<a>") + i18nc("refers to a line in source code", "Line <b>%1</b>:",
144 text += QLatin1String(" ") + highlightAndEscapeUseText(m_sourceLine, 0, m_range->range());
178 m_label->setText(m_label->text().replace(QLatin1String("background-color:") + backgroundColor(false),
182 m_label->setText(m_label->text().replace(QLatin1String("background-color:") + backgroundColor(true),
195 ICore::self()->documentController()->openDocument(m_document.toUrl(), m_range->range().start());
252 NavigatableWidgetList::NavigatableWidgetList(bool allowScrolling, uint maxHeight, bool vertical)
382 QList<OneUseWidget*> createUseWidgets(const CodeRepresentation& code, int usedDeclarationIndex, IndexedDeclaration decl,
403 ContextUsesWidget::ContextUsesWidget(const CodeRepresentation& code, const QList<IndexedDeclaration>& usedDeclarations,
419 if (ctx->type() == DUContext::Function || (ctx->owner() && ctx->owner()->isFunctionDeclaration()))
426 int usedDeclarationIndex = ctx->topContext()->indexForUsedDeclaration(usedDeclaration.data(), false);
441 QLabel* headerLabel = new QLabel(i18nc("%1: source file", "In %1", QLatin1String("<a href='navigateToFunction'>")
464 DeclarationWidget::DeclarationWidget(const CodeRepresentation& code, const IndexedDeclaration& decl)
471 QLabel* headerLabel = new QLabel(dec->isDefinition() ? i18n("Definition") : i18n("Declaration"));
509 QString labelText = i18ncp("%1: number of uses, %2: filename with uses", "%2: 1 use", "%2: %1 uses",
618 m_collector = QSharedPointer<UsesWidgetCollector>(new UsesWidget::UsesWidgetCollector(declaration));
676 UsesWidget::UsesWidgetCollector::UsesWidgetCollector(IndexedDeclaration decl) : UsesCollector(decl)
733 TopContextUsesWidget* widget = new TopContextUsesWidget(declaration(), declarations(), topContext.data());
Represents a single declaration in a definition-use chain.
Definition: declaration.h:51
RangeInRevision range() const
Returns the range assigned to this object, in the document revision when this document was last parse...
Definition: duchainbase.cpp:149
void setHeight(int height)
void setWidget(QWidget *widget)
bool isNewGroup(DUContext *parent, DUContext *child)
Returns whether the uses in the child should be a new uses-group.
Definition: useswidget.cpp:357
void setContentsMargins(int left, int top, int right, int bottom)
int width() const
void setCursor(const QCursor &)
Definition: useswidget.h:98
QString name() const
OneUseWidget(IndexedDeclaration declaration, const IndexedString &document, KTextEditor::Range range, const CodeRepresentation &code)
Note: the links in the HTML here are only used for styling the navigation is implemented in the mouse...
Definition: useswidget.cpp:120
void progress(uint processed, uint total) override
Called whenever progress has been made. max equals the value given initially by maximumProgress.
Definition: useswidget.cpp:701
void setFrameShape(Shape)
QWidget * widget() const
QVector< DUContext * > childContexts() const
Returns the list of immediate child contexts for this context.
Definition: ducontext.cpp:472
void setSizeConstraint(SizeConstraint)
Declaration * owner() const
If this context was opened by a declaration or definition, this returns that item.
Definition: ducontext.cpp:479
void setPixmap(const QPixmap &)
Represents executable code, like for example within a compound-statement.
Definition: ducontext.h:113
void insertLayout(int index, QLayout *layout, int stretch)
void setAllExpanded(bool expanded)
Definition: useswidget.cpp:657
const Use * uses() const
Uses: A "Use" represents any position in a document where a Declaration is used literally.
Definition: ducontext.cpp:1314
virtual int count() const
QString join(const QString &separator) const
const_iterator insert(const T &value)
QString & remove(int position, int n)
void addSpacing(int size)
void chop(int n)
typedef Alignment
The top context in a definition-use chain for one source file.
Definition: topducontext.h:113
Represents a declaration only by its global indices.
Definition: indexeddeclaration.h:33
QualifiedIdentifier scopeIdentifier(bool includeClasses=false) const
Calculate the fully qualified scope identifier.
Definition: ducontext.cpp:1075
QSize size() const
QList< OneUseWidget * > createUseWidgets(const CodeRepresentation &code, int usedDeclarationIndex, IndexedDeclaration decl, DUContext *context)
Definition: useswidget.cpp:382
QString toString(IdentifierStringFormattingOptions options=NoOptions) const
Definition: identifier.cpp:798
Customized read locker for the definition-use chain.
Definition: duchainlock.h:114
int usesCount() const
Returns the count of uses that can be accessed through uses()
Definition: ducontext.cpp:1326
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
void processUses(KDevelop::ReferencedTopDUContext topContext) override
Called with every top-context that can contain uses of the declaration, or if setProcessDeclarations(...
Definition: useswidget.cpp:724
void append(const T &value)
A context that declares function-arguments.
Definition: ducontext.h:106
void setLayout(QLayout *layout)
A widget that allows browsing through all the uses of a declaration, and also through all declaration...
Definition: useswidget.h:154
void setHighlighted(bool highlight)
Definition: useswidget.cpp:171
void setUpdatesEnabled(bool enable)
Qt::MouseButton button() const
void headerLinkActivated(const QString &linkName)
Definition: useswidget.cpp:667
Definition: useswidget.h:116
bool isEmpty() const
QString trimmed() const
DUContext * parentContext() const
Returns the immediate parent context of this context.
Definition: ducontext.cpp:505
virtual QLayoutItem * itemAt(int index) const
void linkActivated(const QString &link)
Qt::Alignment alignment() const
void setText(const QString &)
ContextUsesWidget(const CodeRepresentation &code, const QList< IndexedDeclaration > &usedDeclaration, IndexedDUContext context)
Definition: useswidget.cpp:403
void setMargin(int margin)
void setSizePolicy(QSizePolicy)
void setParent(QObject *parent)
void setWidgetResizable(bool resizable)
virtual QSize sizeHint() const
QString highlightAndEscapeUseText(QString line, int cutOff, KTextEditor::Range range)
The returned text is fully escaped.
Definition: useswidget.cpp:63
bool contains(const T &value) const
QList< ContextUsesWidget * > buildContextUses(const CodeRepresentation &code, const QList< IndexedDeclaration > &declarations, DUContext *context)
Definition: useswidget.cpp:527
UsesWidget(const IndexedDeclaration &declaration, const QSharedPointer< UsesWidgetCollector > &customCollector={})
Definition: useswidget.cpp:599
A widget representing one use of a Declaration in a specific context.
Definition: useswidget.h:43
virtual bool isFunctionDeclaration() const
Determine whether this declaration is a function declaration.
Definition: declaration.cpp:658
bool setAlignment(QWidget *w, QFlags< Qt::AlignmentFlag > alignment)
QString mid(int position, int n) const
void setWidget(UsesWidget *widget)
Definition: useswidget.cpp:681
void maximumProgress(uint max) override
Indicates the maximum progress this collector can make.
Definition: useswidget.cpp:686
KDevelop can unload unused top-context at any time.
Definition: topducontext.h:59
void setMaximumHeight(int maxh)
bool isLoaded() const
Returns whether the top-context is currently loaded.
Definition: indexedtopducontext.cpp:33
QWidget(QWidget *parent, QFlags< Qt::WindowType > f)
int height() const
Represents a context only by its global indices.
Definition: indexedducontext.h:35
static DUChainLock * lock()
Retrieve the read write lock for the entire definition-use chain.
Definition: duchain.cpp:1272
int length() const
QString left(int n) const
int indexForUsedDeclaration(Declaration *declaration, bool create=true)
Retrieves or creates a local index that is to be used for referencing the given.
Definition: topducontext.cpp:1151
QIcon fromTheme(const QString &name, const QIcon &fallback)
UsesWidgetCollector(IndexedDeclaration decl)
Definition: useswidget.cpp:676
void insertWidget(int index, QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
A single context in source code, represented as a node in a directed acyclic graph.
Definition: ducontext.h:72
TopContextUsesWidget(IndexedDeclaration declaration, const QList< IndexedDeclaration > &localDeclarations, IndexedTopDUContext topContext)
Definition: useswidget.cpp:479
void setToolTip(const QString &)
A helper base-class for collecting the top-contexts that contain all uses of a declaration The most i...
Definition: usescollector.h:33
virtual void resizeEvent(QResizeEvent *event)
void setBackgroundRole(QPalette::ColorRole role)
Allows simple indirect access to top-contexts with on-demand loading.
Definition: indexedtopducontext.h:35
KTextEditor::Cursor transformFromLocalRevision(const CursorInRevision &cursor) const
Represents the uses of a declaration within one top-context.
Definition: useswidget.h:128
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
KDEVPLATFORMLANGUAGE_EXPORT uint contextCountUses(DUContext *context, Declaration *declaration)
Returns the total count of uses of the given declaration under the given context. ...
Definition: duchainutils.cpp:583
void setSpacing(int spacing)
DeclarationWidget(const KDevelop::CodeRepresentation &code, const KDevelop::IndexedDeclaration &declaration)
Definition: useswidget.cpp:464
This class can be overridden to do additional processing while the uses-widget shows the uses...
Definition: useswidget.h:161
void addLayout(QLayout *layout, int stretch)
TopDUContext * data() const
Returns the top-context represented by this indexed top-context.
Definition: indexedtopducontext.cpp:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Sun Dec 8 2019 04:31:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2019 The KDE developers.
Generated on Sun Dec 8 2019 04:31:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.