Renamed QLine/TextControl to QWidgetLine/TextControl

Renamed them to free up the QTextControl and QLineControl
class names for a new API in QtGui.

Reviewed-by: Jørgen Lind
This commit is contained in:
Lars Knoll 2011-06-27 09:21:59 +02:00
parent 48b1322df3
commit 371d398f70
24 changed files with 366 additions and 367 deletions

View File

@ -122,7 +122,7 @@ protected:
QTextCharFormat format(int pos);
private:
friend class QTextControl;
friend class QWidgetTextControl;
friend class QTextDocument;
friend class QTextDocumentPrivate;
friend class QTextEngine;

View File

@ -230,7 +230,7 @@ private:
QSharedDataPointer<QTextCursorPrivate> d;
friend class QTextDocumentFragmentPrivate;
friend class QTextCopyHelper;
friend class QTextControlPrivate;
friend class QWidgetTextControlPrivate;
};
QT_END_NAMESPACE

View File

@ -1978,7 +1978,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
}
#endif
#ifndef QT_NO_TEXTCONTROL
else if (QTextControl *control = qobject_cast<QTextControl *>(parent())) {
else if (QWidgetTextControl *control = qobject_cast<QWidgetTextControl *>(parent())) {
r = control->loadResource(type, name);
}
#endif

View File

@ -341,7 +341,7 @@ void QMessageBoxPrivate::updateSize()
if (width > hardLimit) {
label->d_func()->ensureTextControl();
if (QTextControl *control = label->d_func()->control) {
if (QWidgetTextControl *control = label->d_func()->control) {
QTextOption opt = control->document()->defaultTextOption();
opt.setWrapMode(QTextOption::WrapAnywhere);
control->document()->setDefaultTextOption(opt);
@ -367,7 +367,7 @@ void QMessageBoxPrivate::updateSize()
width = qMax(width, layoutMinimumWidth());
if (width > hardLimit) { // longest word is really big, so wrap anywhere
informativeLabel->d_func()->ensureTextControl();
if (QTextControl *control = informativeLabel->d_func()->control) {
if (QWidgetTextControl *control = informativeLabel->d_func()->control) {
QTextOption opt = control->document()->defaultTextOption();
opt.setWrapMode(QTextOption::WrapAnywhere);
control->document()->setDefaultTextOption(opt);

View File

@ -750,7 +750,7 @@
#include <private/qgraphicsitem_p.h>
#include <private/qgraphicswidget_p.h>
#include <private/qtextcontrol_p.h>
#include <private/qwidgettextcontrol_p.h>
#include <private/qtextdocumentlayout_p.h>
#include <private/qtextengine_p.h>
#include <private/qwidget_p.h>
@ -9854,8 +9854,8 @@ public:
: control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0)
{ }
mutable QTextControl *control;
QTextControl *textControl() const;
mutable QWidgetTextControl *control;
QWidgetTextControl *textControl() const;
inline QPointF controlOffset() const
{ return QPointF(0., pageNumber * control->document()->pageSize().height()); }
@ -10005,7 +10005,7 @@ void QGraphicsTextItem::setFont(const QFont &font)
*/
void QGraphicsTextItem::setDefaultTextColor(const QColor &col)
{
QTextControl *c = dd->textControl();
QWidgetTextControl *c = dd->textControl();
QPalette pal = c->palette();
QColor old = pal.color(QPalette::Text);
pal.setColor(QPalette::Text, col);
@ -10502,11 +10502,11 @@ void QGraphicsTextItemPrivate::_q_ensureVisible(QRectF rect)
}
}
QTextControl *QGraphicsTextItemPrivate::textControl() const
QWidgetTextControl *QGraphicsTextItemPrivate::textControl() const
{
if (!control) {
QGraphicsTextItem *that = const_cast<QGraphicsTextItem *>(qq);
control = new QTextControl(that);
control = new QWidgetTextControl(that);
control->setTextInteractionFlags(Qt::NoTextInteraction);
QObject::connect(control, SIGNAL(updateRequest(QRectF)),

View File

@ -390,7 +390,7 @@ private:
#ifndef QT_NO_SHORTCUT
friend class QShortcut;
friend class QLineEdit;
friend class QTextControl;
friend class QWidgetTextControl;
#endif
friend class QAction;

View File

@ -1,12 +1,7 @@
HEADERS += \
to_be_moved/qlinecontrol_p.h \
to_be_moved/qtextcontrol_p.h \
to_be_moved/qtextcontrol_p_p.h \
to_be_moved/qshortcut.h \
to_be_moved/qshortcutmap_p.h \
SOURCES += \
to_be_moved/qlinecontrol.cpp \
to_be_moved/qtextcontrol.cpp \
to_be_moved/qshortcut.cpp \
to_be_moved/qshortcutmap.cpp \

View File

@ -474,7 +474,7 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title
msgLabel->setWordWrap(true);
if (msgLabel->sizeHint().width() > limit) {
msgLabel->d_func()->ensureTextControl();
if (QTextControl *control = msgLabel->d_func()->control) {
if (QWidgetTextControl *control = msgLabel->d_func()->control) {
QTextOption opt = control->document()->defaultTextOption();
opt.setWrapMode(QTextOption::WrapAnywhere);
control->document()->setDefaultTextOption(opt);

View File

@ -339,7 +339,7 @@ void QLabel::setText(const QString &text)
if (d->text == text)
return;
QTextControl *oldControl = d->control;
QWidgetTextControl *oldControl = d->control;
d->control = 0;
d->clearContents();
@ -1599,7 +1599,7 @@ void QLabelPrivate::ensureTextControl() const
if (!isTextLabel)
return;
if (!control) {
control = new QTextControl(const_cast<QLabel *>(q));
control = new QWidgetTextControl(const_cast<QLabel *>(q));
control->document()->setUndoRedoEnabled(false);
control->document()->setDefaultFont(q->font());
control->setTextInteractionFlags(textInteractionFlags);

View File

@ -56,7 +56,7 @@
#include "qlabel.h"
#include "private/qtextdocumentlayout_p.h"
#include "private/qtextcontrol_p.h"
#include "private/qwidgettextcontrol_p.h"
#include "qtextdocumentfragment.h"
#include "qframe_p.h"
#include "qtextdocument.h"
@ -112,7 +112,7 @@ public:
mutable uint isTextLabel : 1;
mutable uint hasShortcut : 1;
Qt::TextFormat textformat;
mutable QTextControl *control;
mutable QWidgetTextControl *control;
mutable QTextCursor shortcutCursor;
Qt::TextInteractionFlags textInteractionFlags;

View File

@ -1979,13 +1979,13 @@ void QLineEdit::paintEvent(QPaintEvent *)
#endif
p.setPen(pal.text().color());
int flags = QLineControl::DrawText;
int flags = QWidgetLineControl::DrawText;
#ifdef QT_KEYPAD_NAVIGATION
if (!QApplication::keypadNavigationEnabled() || hasEditFocus())
#endif
if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){
flags |= QLineControl::DrawSelections;
flags |= QWidgetLineControl::DrawSelections;
// Palette only used for selections/mask and may not be in sync
if (d->control->palette() != pal
|| d->control->palette().currentColorGroup() != pal.currentColorGroup())
@ -1996,7 +1996,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
// selection phase of input method, so the ordinary cursor should be
// invisible if we have a preedit string.
if (d->cursorVisible && !d->control->isReadOnly())
flags |= QLineControl::DrawCursor;
flags |= QWidgetLineControl::DrawCursor;
d->control->setCursorWidth(style()->pixelMetric(QStyle::PM_TextCursorWidth));
d->control->draw(&p, topLeft, r, flags);

View File

@ -153,7 +153,7 @@ void QLineEditPrivate::_q_updateNeeded(const QRect &rect)
void QLineEditPrivate::init(const QString& txt)
{
Q_Q(QLineEdit);
control = new QLineControl(txt);
control = new QWidgetLineControl(txt);
control->setParent(q);
control->setFont(q->font());
QObject::connect(control, SIGNAL(textChanged(QString)),

View File

@ -65,7 +65,7 @@
#include "QtCore/qpointer.h"
#include "QtWidgets/qlineedit.h"
#include "private/qlinecontrol_p.h"
#include "private/qwidgetlinecontrol_p.h"
QT_BEGIN_NAMESPACE
@ -86,7 +86,7 @@ public:
{
}
QLineControl *control;
QWidgetLineControl *control;
#ifndef QT_NO_CONTEXTMENU
QPointer<QAction> selectAllAction;

View File

@ -57,7 +57,6 @@
#include "qtextdocument.h"
#include "private/qtextdocument_p.h"
#include "qtextlist.h"
#include "private/qtextcontrol_p.h"
#include <qtextformat.h>
#include <qdatetime.h>
@ -434,7 +433,7 @@ qreal QPlainTextDocumentLayout::blockWidth(const QTextBlock &block)
QPlainTextEditControl::QPlainTextEditControl(QPlainTextEdit *parent)
: QTextControl(parent), textEdit(parent),
: QWidgetTextControl(parent), textEdit(parent),
topBlock(0)
{
setAcceptRichText(false);
@ -456,19 +455,19 @@ void QPlainTextEditPrivate::_q_verticalScrollbarActionTriggered(int action) {
QMimeData *QPlainTextEditControl::createMimeDataFromSelection() const {
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent());
if (!ed)
return QTextControl::createMimeDataFromSelection();
return QWidgetTextControl::createMimeDataFromSelection();
return ed->createMimeDataFromSelection();
}
bool QPlainTextEditControl::canInsertFromMimeData(const QMimeData *source) const {
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent());
if (!ed)
return QTextControl::canInsertFromMimeData(source);
return QWidgetTextControl::canInsertFromMimeData(source);
return ed->canInsertFromMimeData(source);
}
void QPlainTextEditControl::insertFromMimeData(const QMimeData *source) {
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent());
if (!ed)
QTextControl::insertFromMimeData(source);
QWidgetTextControl::insertFromMimeData(source);
else
ed->insertFromMimeData(source);
}
@ -2356,7 +2355,7 @@ QList<QTextEdit::ExtraSelection> QPlainTextEdit::extraSelections() const
QMimeData *QPlainTextEdit::createMimeDataFromSelection() const
{
Q_D(const QPlainTextEdit);
return d->control->QTextControl::createMimeDataFromSelection();
return d->control->QWidgetTextControl::createMimeDataFromSelection();
}
/*!
@ -2368,7 +2367,7 @@ QMimeData *QPlainTextEdit::createMimeDataFromSelection() const
bool QPlainTextEdit::canInsertFromMimeData(const QMimeData *source) const
{
Q_D(const QPlainTextEdit);
return d->control->QTextControl::canInsertFromMimeData(source);
return d->control->QWidgetTextControl::canInsertFromMimeData(source);
}
/*!
@ -2381,7 +2380,7 @@ bool QPlainTextEdit::canInsertFromMimeData(const QMimeData *source) const
void QPlainTextEdit::insertFromMimeData(const QMimeData *source)
{
Q_D(QPlainTextEdit);
d->control->QTextControl::insertFromMimeData(source);
d->control->QWidgetTextControl::insertFromMimeData(source);
}
/*!

View File

@ -61,7 +61,7 @@
#include "QtWidgets/qmenu.h"
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
#include "private/qtextcontrol_p.h"
#include "private/qwidgettextcontrol_p.h"
#include "qplaintextedit.h"
#ifndef QT_NO_TEXTEDIT
@ -73,7 +73,7 @@ class QMimeData;
class QPlainTextEdit;
class ExtraArea;
class QPlainTextEditControl : public QTextControl
class QPlainTextEditControl : public QWidgetTextControl
{
Q_OBJECT
public:
@ -86,7 +86,7 @@ public:
int hitTest(const QPointF &point, Qt::HitTestAccuracy = Qt::FuzzyHit) const;
QRectF blockBoundingRect(const QTextBlock &block) const;
inline QRectF cursorRect(const QTextCursor &cursor) const {
QRectF r = QTextControl::cursorRect(cursor);
QRectF r = QWidgetTextControl::cursorRect(cursor);
r.setLeft(qMax(r.left(), (qreal) 0.));
return r;
}

View File

@ -58,7 +58,7 @@
#include "qtextdocument.h"
#include "private/qtextdocument_p.h"
#include "qtextlist.h"
#include "private/qtextcontrol_p.h"
#include "private/qwidgettextcontrol_p.h"
#include <qtextformat.h>
#include <qdatetime.h>
@ -79,27 +79,27 @@ static inline bool shouldEnableInputMethod(QTextEdit *textedit)
return !textedit->isReadOnly();
}
class QTextEditControl : public QTextControl
class QTextEditControl : public QWidgetTextControl
{
public:
inline QTextEditControl(QObject *parent) : QTextControl(parent) {}
inline QTextEditControl(QObject *parent) : QWidgetTextControl(parent) {}
virtual QMimeData *createMimeDataFromSelection() const {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
return QTextControl::createMimeDataFromSelection();
return QWidgetTextControl::createMimeDataFromSelection();
return ed->createMimeDataFromSelection();
}
virtual bool canInsertFromMimeData(const QMimeData *source) const {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
return QTextControl::canInsertFromMimeData(source);
return QWidgetTextControl::canInsertFromMimeData(source);
return ed->canInsertFromMimeData(source);
}
virtual void insertFromMimeData(const QMimeData *source) {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
QTextControl::insertFromMimeData(source);
QWidgetTextControl::insertFromMimeData(source);
else
ed->insertFromMimeData(source);
}
@ -235,7 +235,7 @@ void QTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::Mo
}
#ifndef QT_NO_SCROLLBAR
static QSize documentSize(QTextControl *control)
static QSize documentSize(QWidgetTextControl *control)
{
QTextDocument *doc = control->document();
QAbstractTextDocumentLayout *layout = doc->documentLayout();
@ -2019,7 +2019,7 @@ QList<QTextEdit::ExtraSelection> QTextEdit::extraSelections() const
QMimeData *QTextEdit::createMimeDataFromSelection() const
{
Q_D(const QTextEdit);
return d->control->QTextControl::createMimeDataFromSelection();
return d->control->QWidgetTextControl::createMimeDataFromSelection();
}
/*!
@ -2034,7 +2034,7 @@ QMimeData *QTextEdit::createMimeDataFromSelection() const
bool QTextEdit::canInsertFromMimeData(const QMimeData *source) const
{
Q_D(const QTextEdit);
return d->control->QTextControl::canInsertFromMimeData(source);
return d->control->QWidgetTextControl::canInsertFromMimeData(source);
}
/*!
@ -2049,7 +2049,7 @@ bool QTextEdit::canInsertFromMimeData(const QMimeData *source) const
void QTextEdit::insertFromMimeData(const QMimeData *source)
{
Q_D(QTextEdit);
d->control->QTextControl::insertFromMimeData(source);
d->control->QWidgetTextControl::insertFromMimeData(source);
}
/*!

View File

@ -417,7 +417,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &))
friend class QTextEditControl;
friend class QTextDocument;
friend class QTextControl;
friend class QWidgetTextControl;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEdit::AutoFormatting)

View File

@ -62,7 +62,7 @@
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
#include "QtCore/qurl.h"
#include "private/qtextcontrol_p.h"
#include "private/qwidgettextcontrol_p.h"
#include "qtextedit.h"
QT_BEGIN_NAMESPACE
@ -106,7 +106,7 @@ public:
virtual QUrl resolveUrl(const QUrl &url) const
{ return url; }
QTextControl *control;
QWidgetTextControl *control;
QTextEdit::AutoFormatting autoFormatting;
bool tabChangesFocus;

View File

@ -39,7 +39,7 @@
**
****************************************************************************/
#include "qlinecontrol_p.h"
#include "qwidgetlinecontrol_p.h"
#ifndef QT_NO_LINEEDIT
@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
Updates the display text based of the current edit text
If the text has changed will emit displayTextChanged()
*/
void QLineControl::updateDisplayText(bool forceUpdate)
void QWidgetLineControl::updateDisplayText(bool forceUpdate)
{
QString orig = m_textLayout.text();
QString str;
@ -117,7 +117,7 @@ void QLineControl::updateDisplayText(bool forceUpdate)
will not work. This is to prevent using copy as a method of bypassing
password features of the line control.
*/
void QLineControl::copy(QClipboard::Mode mode) const
void QWidgetLineControl::copy(QClipboard::Mode mode) const
{
QString t = selectedText();
if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) {
@ -136,7 +136,7 @@ void QLineControl::copy(QClipboard::Mode mode) const
\sa insert()
*/
void QLineControl::paste(QClipboard::Mode clipboardMode)
void QWidgetLineControl::paste(QClipboard::Mode clipboardMode)
{
QString clip = QApplication::clipboard()->text(clipboardMode);
if (!clip.isEmpty() || hasSelectedText()) {
@ -157,7 +157,7 @@ void QLineControl::paste(QClipboard::Mode clipboardMode)
\sa del()
*/
void QLineControl::backspace()
void QWidgetLineControl::backspace()
{
int priorState = m_undoState;
if (hasSelectedText()) {
@ -190,7 +190,7 @@ void QLineControl::backspace()
\sa del()
*/
void QLineControl::del()
void QWidgetLineControl::del()
{
int priorState = m_undoState;
if (hasSelectedText()) {
@ -210,7 +210,7 @@ void QLineControl::del()
If there is any selected text it is removed prior to insertion of
the new text.
*/
void QLineControl::insert(const QString &newText)
void QWidgetLineControl::insert(const QString &newText)
{
int priorState = m_undoState;
removeSelectedText();
@ -223,7 +223,7 @@ void QLineControl::insert(const QString &newText)
Clears the line control text.
*/
void QLineControl::clear()
void QWidgetLineControl::clear()
{
int priorState = m_undoState;
m_selstart = 0;
@ -241,10 +241,10 @@ void QLineControl::clear()
the line control. If \a length characters cannot be selected, then
the selection will extend to the end of the current text.
*/
void QLineControl::setSelection(int start, int length)
void QWidgetLineControl::setSelection(int start, int length)
{
if(start < 0 || start > (int)m_text.length()){
qWarning("QLineControl::setSelection: Invalid start position");
qWarning("QWidgetLineControl::setSelection: Invalid start position");
return;
}
@ -273,11 +273,11 @@ void QLineControl::setSelection(int start, int length)
emitCursorPositionChanged();
}
void QLineControl::_q_clipboardChanged()
void QWidgetLineControl::_q_clipboardChanged()
{
}
void QLineControl::_q_deleteSelected()
void QWidgetLineControl::_q_deleteSelected()
{
if (!hasSelectedText())
return;
@ -294,7 +294,7 @@ void QLineControl::_q_deleteSelected()
Initializes the line control with a starting text value of \a txt.
*/
void QLineControl::init(const QString &txt)
void QWidgetLineControl::init(const QString &txt)
{
m_text = txt;
updateDisplayText();
@ -309,7 +309,7 @@ void QLineControl::init(const QString &txt)
mode is set to QLineEdit::PasswordEchoOnEdit. Password echoing editing
does not affect other echo modes.
*/
void QLineControl::updatePasswordEchoEditing(bool editing)
void QWidgetLineControl::updatePasswordEchoEditing(bool editing)
{
m_passwordEchoEditing = editing;
updateDisplayText();
@ -322,7 +322,7 @@ void QLineControl::updatePasswordEchoEditing(bool editing)
to the displayed text. The given \a betweenOrOn specified what kind
of cursor position is requested.
*/
int QLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const
int QWidgetLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const
{
return m_textLayout.lineAt(0).xToCursor(x, betweenOrOn);
}
@ -333,7 +333,7 @@ int QLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const
Returns the bounds of the current cursor, as defined as a
between characters cursor.
*/
QRect QLineControl::cursorRect() const
QRect QWidgetLineControl::cursorRect() const
{
QTextLine l = m_textLayout.lineAt(0);
int c = m_cursor;
@ -353,7 +353,7 @@ QRect QLineControl::cursorRect() const
Returns true if the text was changed. Otherwise returns false.
*/
bool QLineControl::fixup() // this function assumes that validate currently returns != Acceptable
bool QWidgetLineControl::fixup() // this function assumes that validate currently returns != Acceptable
{
#ifndef QT_NO_VALIDATOR
if (m_validator) {
@ -376,7 +376,7 @@ bool QLineControl::fixup() // this function assumes that validate currently retu
Moves the cursor to the given position \a pos. If \a mark is true will
adjust the currently selected text.
*/
void QLineControl::moveCursor(int pos, bool mark)
void QWidgetLineControl::moveCursor(int pos, bool mark)
{
if (pos != m_cursor) {
separate();
@ -411,7 +411,7 @@ void QLineControl::moveCursor(int pos, bool mark)
Applies the given input method event \a event to the text of the line
control
*/
void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event)
{
int priorState = 0;
bool isGettingInput = !event->commitString().isEmpty()
@ -515,7 +515,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
The display text will only be drawn if the flags contain DrawText
*/
void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &clip, int flags)
void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &clip, int flags)
{
QVector<QTextLayout::FormatRange> selections;
if (flags & DrawSelections) {
@ -556,7 +556,7 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl
The word boundaries are defined by the behavior of QTextLayout::SkipWords
cursor mode.
*/
void QLineControl::selectWordAtPos(int cursor)
void QWidgetLineControl::selectWordAtPos(int cursor)
{
int next = cursor + 1;
if(next > end())
@ -582,7 +582,7 @@ void QLineControl::selectWordAtPos(int cursor)
The \a update value is currently unused.
*/
bool QLineControl::finishChange(int validateFromState, bool update, bool edited)
bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool edited)
{
Q_UNUSED(update)
bool lineDirty = m_selDirty;
@ -638,7 +638,7 @@ bool QLineControl::finishChange(int validateFromState, bool update, bool edited)
An internal function for setting the text of the line control.
*/
void QLineControl::internalSetText(const QString &txt, int pos, bool edited)
void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edited)
{
internalDeselect();
emit resetInputContext();
@ -668,7 +668,7 @@ void QLineControl::internalSetText(const QString &txt, int pos, bool edited)
Adds the given \a command to the undo history
of the line control. Does not apply the command.
*/
void QLineControl::addCommand(const Command &cmd)
void QWidgetLineControl::addCommand(const Command &cmd)
{
if (m_separator && m_undoState && m_history[m_undoState - 1].type != Separator) {
m_history.resize(m_undoState + 2);
@ -690,7 +690,7 @@ void QLineControl::addCommand(const Command &cmd)
This function does not call finishChange(), and may leave the text
in an invalid state.
*/
void QLineControl::internalInsert(const QString &s)
void QWidgetLineControl::internalInsert(const QString &s)
{
if (hasSelectedText())
addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
@ -726,7 +726,7 @@ void QLineControl::internalInsert(const QString &s)
This function does not call finishChange(), and may leave the text
in an invalid state.
*/
void QLineControl::internalDelete(bool wasBackspace)
void QWidgetLineControl::internalDelete(bool wasBackspace)
{
if (m_cursor < (int) m_text.length()) {
if (hasSelectedText())
@ -752,7 +752,7 @@ void QLineControl::internalDelete(bool wasBackspace)
This function does not call finishChange(), and may leave the text
in an invalid state.
*/
void QLineControl::removeSelectedText()
void QWidgetLineControl::removeSelectedText()
{
if (m_selstart < m_selend && m_selend <= (int) m_text.length()) {
separate();
@ -789,7 +789,7 @@ void QLineControl::removeSelectedText()
Parses the input mask specified by \a maskFields to generate
the mask data used to handle input masks.
*/
void QLineControl::parseInputMask(const QString &maskFields)
void QWidgetLineControl::parseInputMask(const QString &maskFields)
{
int delimiter = maskFields.indexOf(QLatin1Char(';'));
if (maskFields.isEmpty() || delimiter == 0) {
@ -892,7 +892,7 @@ void QLineControl::parseInputMask(const QString &maskFields)
checks if the key is valid compared to the inputMask
*/
bool QLineControl::isValidInput(QChar key, QChar mask) const
bool QWidgetLineControl::isValidInput(QChar key, QChar mask) const
{
switch (mask.unicode()) {
case 'A':
@ -969,7 +969,7 @@ bool QLineControl::isValidInput(QChar key, QChar mask) const
Otherwise returns false
*/
bool QLineControl::hasAcceptableInput(const QString &str) const
bool QWidgetLineControl::hasAcceptableInput(const QString &str) const
{
#ifndef QT_NO_VALIDATOR
QString textCopy = str;
@ -1005,7 +1005,7 @@ bool QLineControl::hasAcceptableInput(const QString &str) const
that blanks will be used, false that previous input is used.
Calling this when no inputMask is set is undefined.
*/
QString QLineControl::maskString(uint pos, const QString &str, bool clear) const
QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear) const
{
if (pos >= (uint)m_maxLength)
return QString::fromLatin1("");
@ -1080,7 +1080,7 @@ QString QLineControl::maskString(uint pos, const QString &str, bool clear) const
Returns a "cleared" string with only separators and blank chars.
Calling this when no inputMask is set is undefined.
*/
QString QLineControl::clearString(uint pos, uint len) const
QString QWidgetLineControl::clearString(uint pos, uint len) const
{
if (pos >= (uint)m_maxLength)
return QString();
@ -1099,10 +1099,10 @@ QString QLineControl::clearString(uint pos, uint len) const
/*!
\internal
Strips blank parts of the input in a QLineControl when an inputMask is set,
Strips blank parts of the input in a QWidgetLineControl when an inputMask is set,
separators are still included. Typically "127.0__.0__.1__" becomes "127.0.0.1".
*/
QString QLineControl::stripString(const QString &str) const
QString QWidgetLineControl::stripString(const QString &str) const
{
if (!m_maskData)
return str;
@ -1123,7 +1123,7 @@ QString QLineControl::stripString(const QString &str) const
\internal
searches forward/backward in m_maskData for either a separator or a m_blank
*/
int QLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const
int QWidgetLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const
{
if (pos >= m_maxLength || pos < 0)
return -1;
@ -1149,7 +1149,7 @@ int QLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar se
return -1;
}
void QLineControl::internalUndo(int until)
void QWidgetLineControl::internalUndo(int until)
{
if (!isUndoAvailable())
return;
@ -1190,7 +1190,7 @@ void QLineControl::internalUndo(int until)
emitCursorPositionChanged();
}
void QLineControl::internalRedo()
void QWidgetLineControl::internalRedo()
{
if (!isRedoAvailable())
return;
@ -1239,7 +1239,7 @@ void QLineControl::internalRedo()
If the current cursor position differs from the last emitted cursor
position, emits cursorPositionChanged().
*/
void QLineControl::emitCursorPositionChanged()
void QWidgetLineControl::emitCursorPositionChanged()
{
if (m_cursor != m_lastCursorPos) {
const int oldLast = m_lastCursorPos;
@ -1254,7 +1254,7 @@ void QLineControl::emitCursorPositionChanged()
#ifndef QT_NO_COMPLETER
// iterating forward(dir=1)/backward(dir=-1) from the
// current row based. dir=0 indicates a new completion prefix was set.
bool QLineControl::advanceToEnabledItem(int dir)
bool QWidgetLineControl::advanceToEnabledItem(int dir)
{
int start = m_completer->currentRow();
if (start == -1)
@ -1278,7 +1278,7 @@ bool QLineControl::advanceToEnabledItem(int dir)
return false;
}
void QLineControl::complete(int key)
void QWidgetLineControl::complete(int key)
{
if (!m_completer || isReadOnly() || echoMode() != QLineEdit::Normal)
return;
@ -1318,7 +1318,7 @@ void QLineControl::complete(int key)
}
#endif
void QLineControl::setCursorBlinkPeriod(int msec)
void QWidgetLineControl::setCursorBlinkPeriod(int msec)
{
if (msec == m_blinkPeriod)
return;
@ -1336,7 +1336,7 @@ void QLineControl::setCursorBlinkPeriod(int msec)
m_blinkPeriod = msec;
}
void QLineControl::resetCursorBlinkTimer()
void QWidgetLineControl::resetCursorBlinkTimer()
{
if (m_blinkPeriod == 0 || m_blinkTimer == 0)
return;
@ -1345,7 +1345,7 @@ void QLineControl::resetCursorBlinkTimer()
m_blinkStatus = 1;
}
void QLineControl::timerEvent(QTimerEvent *event)
void QWidgetLineControl::timerEvent(QTimerEvent *event)
{
if (event->timerId() == m_blinkTimer) {
m_blinkStatus = !m_blinkStatus;
@ -1360,7 +1360,7 @@ void QLineControl::timerEvent(QTimerEvent *event)
}
}
bool QLineControl::processEvent(QEvent* ev)
bool QWidgetLineControl::processEvent(QEvent* ev)
{
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled()) {
@ -1457,7 +1457,7 @@ bool QLineControl::processEvent(QEvent* ev)
return true;
}
void QLineControl::processMouseEvent(QMouseEvent* ev)
void QWidgetLineControl::processMouseEvent(QMouseEvent* ev)
{
switch (ev->type()) {
@ -1511,7 +1511,7 @@ void QLineControl::processMouseEvent(QMouseEvent* ev)
}
}
void QLineControl::processKeyEvent(QKeyEvent* event)
void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
{
bool inlineCompletionAccepted = false;

View File

@ -39,8 +39,8 @@
**
****************************************************************************/
#ifndef QLINECONTROL_P_H
#define QLINECONTROL_P_H
#ifndef QWidgetLineControl_P_H
#define QWidgetLineControl_P_H
//
// W A R N I N G
@ -71,12 +71,12 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class Q_WIDGETS_EXPORT QLineControl : public QObject
class Q_WIDGETS_EXPORT QWidgetLineControl : public QObject
{
Q_OBJECT
public:
QLineControl(const QString &txt = QString())
QWidgetLineControl(const QString &txt = QString())
: m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto),
m_hideCursor(false), m_separator(0), m_readOnly(0),
m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0),
@ -88,7 +88,7 @@ public:
init(txt);
}
~QLineControl()
~QWidgetLineControl()
{
delete [] m_maskData;
}
@ -459,4 +459,4 @@ QT_END_HEADER
#endif // QT_NO_LINEEDIT
#endif // QLINECONTROL_P_H
#endif // QWidgetLineControl_P_H

View File

@ -39,8 +39,8 @@
**
****************************************************************************/
#ifndef QTEXTCONTROL_P_H
#define QTEXTCONTROL_P_H
#ifndef QWIDGETTEXTCONTROL_P_H
#define QWIDGETTEXTCONTROL_P_H
//
// W A R N I N G
@ -73,16 +73,16 @@ QT_MODULE(Gui)
class QStyleSheet;
class QTextDocument;
class QMenu;
class QTextControlPrivate;
class QWidgetTextControlPrivate;
class QMimeData;
class QAbstractScrollArea;
class QEvent;
class QTimerEvent;
class Q_WIDGETS_EXPORT QTextControl : public QObject
class Q_WIDGETS_EXPORT QWidgetTextControl : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QTextControl)
Q_DECLARE_PRIVATE(QWidgetTextControl)
#ifndef QT_NO_TEXTHTMLPARSER
Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true)
#endif
@ -93,10 +93,10 @@ class Q_WIDGETS_EXPORT QTextControl : public QObject
Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
Q_PROPERTY(bool ignoreUnusedNavigationEvents READ ignoreUnusedNavigationEvents WRITE setIgnoreUnusedNavigationEvents)
public:
explicit QTextControl(QObject *parent = 0);
explicit QTextControl(const QString &text, QObject *parent = 0);
explicit QTextControl(QTextDocument *doc, QObject *parent = 0);
virtual ~QTextControl();
explicit QWidgetTextControl(QObject *parent = 0);
explicit QWidgetTextControl(const QString &text, QObject *parent = 0);
explicit QWidgetTextControl(QTextDocument *doc, QObject *parent = 0);
virtual ~QWidgetTextControl();
void setDocument(QTextDocument *document);
QTextDocument *document() const;
@ -259,7 +259,7 @@ protected:
virtual bool event(QEvent *e);
private:
Q_DISABLE_COPY(QTextControl)
Q_DISABLE_COPY(QWidgetTextControl)
Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentCharFormatAndSelection())
Q_PRIVATE_SLOT(d_func(), void _q_emitCursorPosChanged(const QTextCursor &))
Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected())
@ -304,4 +304,4 @@ QT_END_NAMESPACE
QT_END_HEADER
#endif // QTEXTCONTROL_H
#endif // QWidgetTextControl_H

View File

@ -39,8 +39,8 @@
**
****************************************************************************/
#ifndef QTEXTCONTROL_P_P_H
#define QTEXTCONTROL_P_P_H
#ifndef QWIDGETTEXTCONTROL_P_P_H
#define QWIDGETTEXTCONTROL_P_P_H
//
// W A R N I N G
@ -69,11 +69,11 @@ class QMimeData;
class QAbstractScrollArea;
class QInputContext;
class QTextControlPrivate : public QObjectPrivate
class QWidgetTextControlPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QTextControl)
Q_DECLARE_PUBLIC(QWidgetTextControl)
public:
QTextControlPrivate();
QWidgetTextControlPrivate();
bool cursorMoveKeyEvent(QKeyEvent *e);
@ -235,4 +235,4 @@ public:
QT_END_NAMESPACE
#endif // QTEXTCONTROL_P_H
#endif // QWidgetTextControl_P_H

View File

@ -76,6 +76,9 @@ HEADERS += \
widgets/qscrollarea.h \
widgets/qworkspace.h \
widgets/qwidgetanimator_p.h \
widgets/qwidgettextcontrol_p.h \
widgets/qwidgettextcontrol_p_p.h \
widgets/qwidgetlinecontrol_p.h \
widgets/qtoolbararealayout_p.h \
widgets/qplaintextedit.h \
widgets/qplaintextedit_p.h \
@ -136,6 +139,8 @@ SOURCES += \
widgets/qscrollarea.cpp \
widgets/qworkspace.cpp \
widgets/qwidgetanimator.cpp \
widgets/qwidgettextcontrol.cpp \
widgets/qwidgetlinecontrol.cpp \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp \
widgets/qprintpreviewwidget.cpp