Qt 4.8
Classes | Functions
qplaintextedit.cpp File Reference
#include "qplaintextedit_p.h"
#include <qfont.h>
#include <qpainter.h>
#include <qevent.h>
#include <qdebug.h>
#include <qmime.h>
#include <qdrag.h>
#include <qclipboard.h>
#include <qmenu.h>
#include <qstyle.h>
#include <qtimer.h>
#include "private/qtextdocumentlayout_p.h"
#include "private/qabstracttextdocumentlayout_p.h"
#include "qtextdocument.h"
#include "private/qtextdocument_p.h"
#include "qtextlist.h"
#include "private/qtextcontrol_p.h"
#include "qaccessible.h"
#include <qtextformat.h>
#include <qdatetime.h>
#include <qapplication.h>
#include <limits.h>
#include <qtexttable.h>
#include <qvariant.h>
#include <qinputcontext.h>
#include "moc_qplaintextedit.cpp"
#include "moc_qplaintextedit_p.cpp"

Go to the source code of this file.

Classes

class  QPlainTextDocumentLayoutPrivate
 

Functions

static void fillBackground (QPainter *p, const QRectF &rect, QBrush brush, QRectF gradientRect=QRectF())
 
static bool shouldEnableInputMethod (QPlainTextEdit *plaintextedit)
 

Function Documentation

◆ fillBackground()

static void fillBackground ( QPainter p,
const QRectF rect,
QBrush  brush,
QRectF  gradientRect = QRectF() 
)
static

Definition at line 1833 of file qplaintextedit.cpp.

Referenced by QPlainTextEdit::paintEvent().

1834 {
1835  p->save();
1836  if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) {
1837  if (!gradientRect.isNull()) {
1838  QTransform m = QTransform::fromTranslate(gradientRect.left(), gradientRect.top());
1839  m.scale(gradientRect.width(), gradientRect.height());
1840  brush.setTransform(m);
1841  const_cast<QGradient *>(brush.gradient())->setCoordinateMode(QGradient::LogicalMode);
1842  }
1843  } else {
1844  p->setBrushOrigin(rect.topLeft());
1845  }
1846  p->fillRect(rect, brush);
1847  p->restore();
1848 }
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
void setTransform(const QTransform &)
Sets matrix as an explicit transformation matrix on the current brush.
Definition: qbrush.cpp:968
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
void setBrushOrigin(int x, int y)
Sets the brush&#39;s origin to point (x, y).
Definition: qpainter.h:825
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
static QTransform fromTranslate(qreal dx, qreal dy)
Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis...
Definition: qtransform.cpp:462
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:655
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ shouldEnableInputMethod()

static bool shouldEnableInputMethod ( QPlainTextEdit plaintextedit)
inlinestatic

Definition at line 75 of file qplaintextedit.cpp.

Referenced by QPlainTextEdit::setReadOnly().

76 {
77  return !plaintextedit->isReadOnly();
78 }
bool isReadOnly() const