Qt 4.8
Classes | Functions
qtextedit.cpp File Reference
#include "qtextedit_p.h"
#include "qlineedit.h"
#include "qtextbrowser.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 "qtextdocument.h"
#include "private/qtextdocument_p.h"
#include "qtextlist.h"
#include "private/qtextcontrol_p.h"
#include <qtextformat.h>
#include <qdatetime.h>
#include <qapplication.h>
#include <limits.h>
#include <qtexttable.h>
#include <qvariant.h>
#include <qinputcontext.h>
#include "moc_qtextedit.cpp"

Go to the source code of this file.

Classes

class  QTextEditControl
 

Functions

static QSize documentSize (QTextControl *control)
 
static bool shouldEnableInputMethod (QTextEdit *textedit)
 

Function Documentation

◆ documentSize()

static QSize documentSize ( QTextControl control)
static

Definition at line 238 of file qtextedit.cpp.

Referenced by QTextEditPrivate::_q_adjustScrollbars(), and QPlainTextEditPrivate::_q_adjustScrollbars().

239 {
240  QTextDocument *doc = control->document();
242 
243  QSize docSize;
244 
245  if (QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout)) {
246  docSize = tlayout->dynamicDocumentSize().toSize();
247  int percentageDone = tlayout->layoutStatus();
248  // extrapolate height
249  if (percentageDone > 0)
250  docSize.setHeight(docSize.height() * 100 / percentageDone);
251  } else {
252  docSize = layout->documentSize().toSize();
253  }
254 
255  return docSize;
256 }
QSize toSize() const
Returns an integer based copy of this size.
Definition: qsize.h:355
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
virtual QSizeF documentSize() const =0
Returns the total size of the document&#39;s layout.
const char * layout
QTextDocument * document() const
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
int height() const
Returns the height.
Definition: qsize.h:129
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for ...

◆ shouldEnableInputMethod()

static bool shouldEnableInputMethod ( QTextEdit textedit)
inlinestatic

Definition at line 77 of file qtextedit.cpp.

Referenced by QTextEdit::setReadOnly().

78 {
79  return !textedit->isReadOnly();
80 }
bool isReadOnly() const
Definition: qtextedit.cpp:2127