mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
various cleanups
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
ad9372dfc7
commit
39701195bb
16 changed files with 53 additions and 162 deletions
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import sys, os, re
|
import os, re
|
||||||
|
|
||||||
|
regex = re.compile('(#include [<|"](?:.*)[>|"])')
|
||||||
|
|
||||||
cppfiles = []
|
cppfiles = []
|
||||||
for root, dirs, files in os.walk(os.curdir):
|
for root, dirs, files in os.walk(os.curdir):
|
||||||
|
@ -14,7 +16,7 @@ for cpp in cppfiles:
|
||||||
with open(cpp, 'r') as f:
|
with open(cpp, 'r') as f:
|
||||||
cppcontent = f.read()
|
cppcontent = f.read()
|
||||||
includes = []
|
includes = []
|
||||||
for match in re.findall('(#include [<|"](?:.*)[>|"])', cppcontent):
|
for match in regex.findall(cppcontent):
|
||||||
if match in includes:
|
if match in includes:
|
||||||
print('multiple inclusions of: %s, in %s' % (match, cpp))
|
print('multiple inclusions of: %s, in %s' % (match, cpp))
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -367,7 +367,6 @@ for cpp in cppfiles:
|
||||||
inc1 = '%s/%s' % (key, key2)
|
inc1 = '%s/%s' % (key, key2)
|
||||||
inc2 = key2
|
inc2 = key2
|
||||||
replacement = '#include <%s/%s>' % (key, incmap[key][key2])
|
replacement = '#include <%s/%s>' % (key, incmap[key][key2])
|
||||||
# print(inc1, inc2, replacement)
|
|
||||||
for match in re.findall('(#include [<|"](?:%s|%s)[>|"])' % (inc1, inc2), cppcontent):
|
for match in re.findall('(#include [<|"](?:%s|%s)[>|"])' % (inc1, inc2), cppcontent):
|
||||||
with open(cpp, 'w') as f:
|
with open(cpp, 'w') as f:
|
||||||
if replacement in replaced:
|
if replacement in replaced:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import sys, os, re
|
import os, re
|
||||||
|
|
||||||
# generated via find /usr/include/katie/ -name 'Q*' -printf ' "%f",\n' | sort -u
|
# generated via find /usr/include/katie/ -name 'Q*' -printf ' "%f",\n' | sort -u
|
||||||
classlist = {
|
classlist = {
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import sys, os, re
|
import os, re
|
||||||
|
|
||||||
regex = re.compile('(#ifndef (?:.*)_H\n#define .*$)', re.MULTILINE)
|
regex = re.compile('(#ifndef (?:.*)_H\n#define .*$)', re.MULTILINE)
|
||||||
|
|
||||||
cppfiles = []
|
hppfiles = []
|
||||||
for root, dirs, files in os.walk(os.curdir):
|
for root, dirs, files in os.walk(os.curdir):
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.endswith(('.hpp', '.h')):
|
if f.endswith(('.hpp', '.h')):
|
||||||
cppfiles.append('%s/%s' % (root, f))
|
hppfiles.append('%s/%s' % (root, f))
|
||||||
|
|
||||||
for cpp in cppfiles:
|
for hpp in hppfiles:
|
||||||
cpp = os.path.realpath(cpp)
|
hpp = os.path.realpath(hpp)
|
||||||
with open(cpp, 'r') as f:
|
with open(hpp, 'r') as f:
|
||||||
cppcontent = f.read()
|
cppcontent = f.read()
|
||||||
if '#pragma once' in cppcontent:
|
if '#pragma once' in cppcontent:
|
||||||
continue
|
continue
|
||||||
for match in regex.findall(cppcontent):
|
for match in regex.findall(cppcontent):
|
||||||
with open(cpp, 'w') as f:
|
with open(hpp, 'w') as f:
|
||||||
print('adding pragma once to: %s' % cpp)
|
print('adding pragma once to: %s' % hpp)
|
||||||
cppcontent = cppcontent.replace(match, '#pragma once\n\n%s' % match)
|
cppcontent = cppcontent.replace(match, '#pragma once\n\n%s' % match)
|
||||||
f.write(cppcontent)
|
f.write(cppcontent)
|
||||||
|
|
|
@ -76,49 +76,6 @@ template <typename T> inline void qToUnaligned(const T src, uchar *dest)
|
||||||
* and return the value in host-endian encoding.
|
* and return the value in host-endian encoding.
|
||||||
* There is no requirement that \a src must be aligned.
|
* There is no requirement that \a src must be aligned.
|
||||||
*/
|
*/
|
||||||
#if defined Q_CC_SUN
|
|
||||||
inline quint64 qFromLittleEndian_helper(const uchar *src, quint64 *dest)
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
| src[0]
|
|
||||||
| src[1] * Q_UINT64_C(0x0000000000000100)
|
|
||||||
| src[2] * Q_UINT64_C(0x0000000000010000)
|
|
||||||
| src[3] * Q_UINT64_C(0x0000000001000000)
|
|
||||||
| src[4] * Q_UINT64_C(0x0000000100000000)
|
|
||||||
| src[5] * Q_UINT64_C(0x0000010000000000)
|
|
||||||
| src[6] * Q_UINT64_C(0x0001000000000000)
|
|
||||||
| src[7] * Q_UINT64_C(0x0100000000000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline quint32 qFromLittleEndian_helper(const uchar *src, quint32 *dest)
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
| src[0]
|
|
||||||
| src[1] * quint32(0x00000100)
|
|
||||||
| src[2] * quint32(0x00010000)
|
|
||||||
| src[3] * quint32(0x01000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline quint16 qFromLittleEndian_helper(const uchar *src, quint16 *dest)
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
| src[0]
|
|
||||||
| src[1] * 0x0100;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline qint64 qFromLittleEndian_helper(const uchar *src, qint64 * dest)
|
|
||||||
{ return static_cast<qint64>(qFromLittleEndian_helper(src, reinterpret_cast<quint64*>(0))); }
|
|
||||||
inline qint32 qFromLittleEndian_helper(const uchar *src, qint32 * dest)
|
|
||||||
{ return static_cast<qint32>(qFromLittleEndian_helper(src, reinterpret_cast<quint32*>(0))); }
|
|
||||||
inline qint16 qFromLittleEndian_helper(const uchar *src, qint16 * dest)
|
|
||||||
{ return static_cast<qint16>(qFromLittleEndian_helper(src, reinterpret_cast<quint16*>(0))); }
|
|
||||||
|
|
||||||
template <class T> inline T qFromLittleEndian(const uchar *src)
|
|
||||||
{
|
|
||||||
return qFromLittleEndian_helper(src, reinterpret_cast<T*>(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
template <typename T> inline T qFromLittleEndian(const uchar *src);
|
template <typename T> inline T qFromLittleEndian(const uchar *src);
|
||||||
template <> inline quint64 qFromLittleEndian<quint64>(const uchar *src)
|
template <> inline quint64 qFromLittleEndian<quint64>(const uchar *src)
|
||||||
{
|
{
|
||||||
|
@ -158,56 +115,11 @@ template <> inline qint32 qFromLittleEndian<qint32>(const uchar *src)
|
||||||
|
|
||||||
template <> inline qint16 qFromLittleEndian<qint16>(const uchar *src)
|
template <> inline qint16 qFromLittleEndian<qint16>(const uchar *src)
|
||||||
{ return static_cast<qint16>(qFromLittleEndian<quint16>(src)); }
|
{ return static_cast<qint16>(qFromLittleEndian<quint16>(src)); }
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function will read a big-endian (also known as network order) encoded value from \a src
|
/* This function will read a big-endian (also known as network order) encoded value from \a src
|
||||||
* and return the value in host-endian encoding.
|
* and return the value in host-endian encoding.
|
||||||
* There is no requirement that \a src must be aligned.
|
* There is no requirement that \a src must be aligned.
|
||||||
*/
|
*/
|
||||||
#if defined Q_CC_SUN
|
|
||||||
inline quint64 qFromBigEndian_helper(const uchar *src, quint64 *dest)
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
| src[7]
|
|
||||||
| src[6] * Q_UINT64_C(0x0000000000000100)
|
|
||||||
| src[5] * Q_UINT64_C(0x0000000000010000)
|
|
||||||
| src[4] * Q_UINT64_C(0x0000000001000000)
|
|
||||||
| src[3] * Q_UINT64_C(0x0000000100000000)
|
|
||||||
| src[2] * Q_UINT64_C(0x0000010000000000)
|
|
||||||
| src[1] * Q_UINT64_C(0x0001000000000000)
|
|
||||||
| src[0] * Q_UINT64_C(0x0100000000000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline quint32 qFromBigEndian_helper(const uchar *src, quint32 * dest)
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
| src[3]
|
|
||||||
| src[2] * quint32(0x00000100)
|
|
||||||
| src[1] * quint32(0x00010000)
|
|
||||||
| src[0] * quint32(0x01000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline quint16 qFromBigEndian_helper(const uchar *src, quint16 * des)
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
| src[1]
|
|
||||||
| src[0] * 0x0100;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline qint64 qFromBigEndian_helper(const uchar *src, qint64 * dest)
|
|
||||||
{ return static_cast<qint64>(qFromBigEndian_helper(src, reinterpret_cast<quint64*>(0))); }
|
|
||||||
inline qint32 qFromBigEndian_helper(const uchar *src, qint32 * dest)
|
|
||||||
{ return static_cast<qint32>(qFromBigEndian_helper(src, reinterpret_cast<quint32*>(0))); }
|
|
||||||
inline qint16 qFromBigEndian_helper(const uchar *src, qint16 * dest)
|
|
||||||
{ return static_cast<qint16>(qFromBigEndian_helper(src, reinterpret_cast<quint16*>(0))); }
|
|
||||||
|
|
||||||
template <class T> inline T qFromBigEndian(const uchar *src)
|
|
||||||
{
|
|
||||||
return qFromBigEndian_helper(src, reinterpret_cast<T*>(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
template <class T> inline T qFromBigEndian(const uchar *src);
|
template <class T> inline T qFromBigEndian(const uchar *src);
|
||||||
template<>
|
template<>
|
||||||
inline quint64 qFromBigEndian<quint64>(const uchar *src)
|
inline quint64 qFromBigEndian<quint64>(const uchar *src)
|
||||||
|
@ -251,7 +163,7 @@ template <> inline qint32 qFromBigEndian<qint32>(const uchar *src)
|
||||||
|
|
||||||
template <> inline qint16 qFromBigEndian<qint16>(const uchar *src)
|
template <> inline qint16 qFromBigEndian<qint16>(const uchar *src)
|
||||||
{ return static_cast<qint16>(qFromBigEndian<quint16>(src)); }
|
{ return static_cast<qint16>(qFromBigEndian<quint16>(src)); }
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* T qbswap(T source).
|
* T qbswap(T source).
|
||||||
* Changes the byte order of a value from big endian to little endian or vice versa.
|
* Changes the byte order of a value from big endian to little endian or vice versa.
|
||||||
|
|
|
@ -464,11 +464,11 @@ QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
The <QtGlobal> header file provides a range of macros (Q_CC_*)
|
The <QtGlobal> header file provides a range of macros (Q_CC_*)
|
||||||
that are defined if the application is compiled using the
|
that are defined if the application is compiled using the
|
||||||
specified platforms. For example, the Q_CC_SUN macro is defined if
|
specified platforms. For example, the Q_CC_GNU macro is defined
|
||||||
the application is compiled using Forte Developer, or Sun Studio
|
if the application is compiled using GNU Compiler Collection.
|
||||||
C++. The header file also declares a range of macros (Q_OS_*)
|
The header file also declares a range of macros (Q_OS_*) that
|
||||||
that are defined for the specified platforms. For example,
|
are defined for the specified platforms. For example, Q_OS_WIN32
|
||||||
Q_OS_WIN32 which is defined for Microsoft Windows.
|
which is defined for Microsoft Windows.
|
||||||
|
|
||||||
The purpose of these macros is to enable programmers to add
|
The purpose of these macros is to enable programmers to add
|
||||||
compiler or platform specific code to their application.
|
compiler or platform specific code to their application.
|
||||||
|
|
|
@ -997,8 +997,7 @@ public:
|
||||||
enum TextFormat {
|
enum TextFormat {
|
||||||
PlainText,
|
PlainText,
|
||||||
RichText,
|
RichText,
|
||||||
AutoText,
|
AutoText
|
||||||
LogText
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AspectRatioMode {
|
enum AspectRatioMode {
|
||||||
|
|
|
@ -2171,9 +2171,6 @@
|
||||||
\value AutoText The text string is interpreted as for
|
\value AutoText The text string is interpreted as for
|
||||||
Qt::RichText if Qt::mightBeRichText() returns true, otherwise
|
Qt::RichText if Qt::mightBeRichText() returns true, otherwise
|
||||||
as Qt::PlainText.
|
as Qt::PlainText.
|
||||||
|
|
||||||
\value LogText A special, limited text format which is only used
|
|
||||||
by Q3TextEdit in an optimized mode.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -74,11 +74,7 @@ class QVector
|
||||||
typedef QVectorTypedData<T> Data;
|
typedef QVectorTypedData<T> Data;
|
||||||
union {
|
union {
|
||||||
QVectorData *d;
|
QVectorData *d;
|
||||||
#if defined(Q_CC_SUN) && (__SUNPRO_CC <= 0x550)
|
|
||||||
QVectorTypedData<T> *p;
|
|
||||||
#else
|
|
||||||
Data *p;
|
Data *p;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -250,7 +250,7 @@ void QDeclarativeTextEdit::setText(const QString &text)
|
||||||
if (QDeclarativeTextEdit::text() == text)
|
if (QDeclarativeTextEdit::text() == text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text));
|
d->richText = d->format == Qt::RichText || (d->format == Qt::AutoText && Qt::mightBeRichText(text));
|
||||||
if (d->richText) {
|
if (d->richText) {
|
||||||
#ifndef QT_NO_TEXTHTMLPARSER
|
#ifndef QT_NO_TEXTHTMLPARSER
|
||||||
d->control->setHtml(text);
|
d->control->setHtml(text);
|
||||||
|
@ -264,17 +264,17 @@ void QDeclarativeTextEdit::setText(const QString &text)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty enumeration TextEdit::textFormat
|
\qmlproperty enumeration Qt::textFormat
|
||||||
|
|
||||||
The way the text property should be displayed.
|
The way the text property should be displayed.
|
||||||
|
|
||||||
\list
|
\list
|
||||||
\o TextEdit.AutoText
|
\o Qt.AutoText
|
||||||
\o TextEdit.PlainText
|
\o Qt.PlainText
|
||||||
\o TextEdit.RichText
|
\o Qt.RichText
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
The default is TextEdit.AutoText. If the text format is TextEdit.AutoText the text edit
|
The default is Qt.AutoText. If the text format is Qt.AutoText the text edit
|
||||||
will automatically determine whether the text should be treated as
|
will automatically determine whether the text should be treated as
|
||||||
rich text. This determination is made using Qt::mightBeRichText().
|
rich text. This determination is made using Qt::mightBeRichText().
|
||||||
|
|
||||||
|
@ -289,12 +289,12 @@ Column {
|
||||||
}
|
}
|
||||||
TextEdit {
|
TextEdit {
|
||||||
font.pointSize: 24
|
font.pointSize: 24
|
||||||
textFormat: TextEdit.RichText
|
textFormat: Qt.RichText
|
||||||
text: "<b>Hello</b> <i>World!</i>"
|
text: "<b>Hello</b> <i>World!</i>"
|
||||||
}
|
}
|
||||||
TextEdit {
|
TextEdit {
|
||||||
font.pointSize: 24
|
font.pointSize: 24
|
||||||
textFormat: TextEdit.PlainText
|
textFormat: Qt.PlainText
|
||||||
text: "<b>Hello</b> <i>World!</i>"
|
text: "<b>Hello</b> <i>World!</i>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,19 +302,19 @@ Column {
|
||||||
\o \image declarative-textformat.png
|
\o \image declarative-textformat.png
|
||||||
\endtable
|
\endtable
|
||||||
*/
|
*/
|
||||||
QDeclarativeTextEdit::TextFormat QDeclarativeTextEdit::textFormat() const
|
Qt::TextFormat QDeclarativeTextEdit::textFormat() const
|
||||||
{
|
{
|
||||||
Q_D(const QDeclarativeTextEdit);
|
Q_D(const QDeclarativeTextEdit);
|
||||||
return d->format;
|
return d->format;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeTextEdit::setTextFormat(TextFormat format)
|
void QDeclarativeTextEdit::setTextFormat(Qt::TextFormat format)
|
||||||
{
|
{
|
||||||
Q_D(QDeclarativeTextEdit);
|
Q_D(QDeclarativeTextEdit);
|
||||||
if (format == d->format)
|
if (format == d->format)
|
||||||
return;
|
return;
|
||||||
bool wasRich = d->richText;
|
bool wasRich = d->richText;
|
||||||
d->richText = format == RichText || (format == AutoText && Qt::mightBeRichText(d->text));
|
d->richText = format == Qt::RichText || (format == Qt::AutoText && Qt::mightBeRichText(d->text));
|
||||||
|
|
||||||
if (wasRich && !d->richText) {
|
if (wasRich && !d->richText) {
|
||||||
d->control->setPlainText(d->text);
|
d->control->setPlainText(d->text);
|
||||||
|
@ -328,7 +328,7 @@ void QDeclarativeTextEdit::setTextFormat(TextFormat format)
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
d->format = format;
|
d->format = format;
|
||||||
d->control->setAcceptRichText(d->format != PlainText);
|
d->control->setAcceptRichText(d->format != Qt::PlainText);
|
||||||
emit textFormatChanged(d->format);
|
emit textFormatChanged(d->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(VAlignment)
|
Q_ENUMS(VAlignment)
|
||||||
Q_ENUMS(HAlignment)
|
Q_ENUMS(HAlignment)
|
||||||
Q_ENUMS(TextFormat)
|
|
||||||
Q_ENUMS(WrapMode)
|
Q_ENUMS(WrapMode)
|
||||||
Q_ENUMS(SelectionMode)
|
Q_ENUMS(SelectionMode)
|
||||||
|
|
||||||
|
@ -69,7 +68,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa
|
||||||
Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1)
|
Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1)
|
||||||
Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged)
|
Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged)
|
||||||
Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged)
|
Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged)
|
||||||
Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
|
Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
|
||||||
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
|
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
|
||||||
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
|
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
|
||||||
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
|
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
|
||||||
|
@ -102,12 +101,6 @@ public:
|
||||||
AlignVCenter = Qt::AlignVCenter
|
AlignVCenter = Qt::AlignVCenter
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TextFormat {
|
|
||||||
PlainText = Qt::PlainText,
|
|
||||||
RichText = Qt::RichText,
|
|
||||||
AutoText = Qt::AutoText
|
|
||||||
};
|
|
||||||
|
|
||||||
enum WrapMode { NoWrap = QTextOption::NoWrap,
|
enum WrapMode { NoWrap = QTextOption::NoWrap,
|
||||||
WordWrap = QTextOption::WordWrap,
|
WordWrap = QTextOption::WordWrap,
|
||||||
WrapAnywhere = QTextOption::WrapAnywhere,
|
WrapAnywhere = QTextOption::WrapAnywhere,
|
||||||
|
@ -126,8 +119,8 @@ public:
|
||||||
QString text() const;
|
QString text() const;
|
||||||
void setText(const QString &);
|
void setText(const QString &);
|
||||||
|
|
||||||
TextFormat textFormat() const;
|
Qt::TextFormat textFormat() const;
|
||||||
void setTextFormat(TextFormat format);
|
void setTextFormat(Qt::TextFormat format);
|
||||||
|
|
||||||
QFont font() const;
|
QFont font() const;
|
||||||
void setFont(const QFont &font);
|
void setFont(const QFont &font);
|
||||||
|
@ -224,7 +217,7 @@ Q_SIGNALS:
|
||||||
void verticalAlignmentChanged(VAlignment alignment);
|
void verticalAlignmentChanged(VAlignment alignment);
|
||||||
void wrapModeChanged();
|
void wrapModeChanged();
|
||||||
void lineCountChanged();
|
void lineCountChanged();
|
||||||
void textFormatChanged(TextFormat textFormat);
|
void textFormatChanged(Qt::TextFormat textFormat);
|
||||||
void readOnlyChanged(bool isReadOnly);
|
void readOnlyChanged(bool isReadOnly);
|
||||||
void cursorVisibleChanged(bool isCursorVisible);
|
void cursorVisibleChanged(bool isCursorVisible);
|
||||||
void cursorDelegateChanged();
|
void cursorDelegateChanged();
|
||||||
|
|
|
@ -61,10 +61,10 @@ class QDeclarativeTextEditPrivate : public QDeclarativeImplicitSizePaintedItemPr
|
||||||
public:
|
public:
|
||||||
QDeclarativeTextEditPrivate()
|
QDeclarativeTextEditPrivate()
|
||||||
: color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop),
|
: color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop),
|
||||||
imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
|
dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
|
||||||
showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), requireImplicitWidth(false),
|
showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), requireImplicitWidth(false),
|
||||||
hAlignImplicit(true), rightToLeftText(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0),
|
hAlignImplicit(true), rightToLeftText(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0),
|
||||||
cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap),
|
cursorComponent(0), cursor(0), format(Qt::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap),
|
||||||
mouseSelectionMode(QDeclarativeTextEdit::SelectCharacters), lineCount(0), selectByMouse(false), canPaste(false),
|
mouseSelectionMode(QDeclarativeTextEdit::SelectCharacters), lineCount(0), selectByMouse(false), canPaste(false),
|
||||||
yoff(0)
|
yoff(0)
|
||||||
{
|
{
|
||||||
|
@ -87,29 +87,24 @@ public:
|
||||||
QColor color;
|
QColor color;
|
||||||
QColor selectionColor;
|
QColor selectionColor;
|
||||||
QColor selectedTextColor;
|
QColor selectedTextColor;
|
||||||
QString style;
|
|
||||||
QColor styleColor;
|
|
||||||
QPixmap imgCache;
|
|
||||||
QPixmap imgStyleCache;
|
|
||||||
QDeclarativeTextEdit::HAlignment hAlign;
|
QDeclarativeTextEdit::HAlignment hAlign;
|
||||||
QDeclarativeTextEdit::VAlignment vAlign;
|
QDeclarativeTextEdit::VAlignment vAlign;
|
||||||
bool imgDirty : 1;
|
bool dirty;
|
||||||
bool dirty : 1;
|
bool richText;
|
||||||
bool richText : 1;
|
bool cursorVisible;
|
||||||
bool cursorVisible : 1;
|
bool focusOnPress;
|
||||||
bool focusOnPress : 1;
|
bool showInputPanelOnFocus;
|
||||||
bool showInputPanelOnFocus : 1;
|
bool clickCausedFocus;
|
||||||
bool clickCausedFocus : 1;
|
bool persistentSelection;
|
||||||
bool persistentSelection : 1;
|
bool requireImplicitWidth;
|
||||||
bool requireImplicitWidth:1;
|
bool hAlignImplicit;
|
||||||
bool hAlignImplicit:1;
|
bool rightToLeftText;
|
||||||
bool rightToLeftText:1;
|
|
||||||
qreal textMargin;
|
qreal textMargin;
|
||||||
int lastSelectionStart;
|
int lastSelectionStart;
|
||||||
int lastSelectionEnd;
|
int lastSelectionEnd;
|
||||||
QDeclarativeComponent* cursorComponent;
|
QDeclarativeComponent* cursorComponent;
|
||||||
QDeclarativeItem* cursor;
|
QDeclarativeItem* cursor;
|
||||||
QDeclarativeTextEdit::TextFormat format;
|
Qt::TextFormat format;
|
||||||
QTextDocument *document;
|
QTextDocument *document;
|
||||||
QTextControl *control;
|
QTextControl *control;
|
||||||
QDeclarativeTextEdit::WrapMode wrapMode;
|
QDeclarativeTextEdit::WrapMode wrapMode;
|
||||||
|
|
|
@ -728,7 +728,6 @@ void RichTextEditor::setDefaultFont(QFont font)
|
||||||
QString RichTextEditor::text(Qt::TextFormat format) const
|
QString RichTextEditor::text(Qt::TextFormat format) const
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case Qt::LogText:
|
|
||||||
case Qt::PlainText:
|
case Qt::PlainText:
|
||||||
return toPlainText();
|
return toPlainText();
|
||||||
case Qt::RichText:
|
case Qt::RichText:
|
||||||
|
|
|
@ -424,7 +424,7 @@ QTextHtmlImporter::QTextHtmlImporter(QTextDocument *_doc, const QString &_html,
|
||||||
QString html = _html;
|
QString html = _html;
|
||||||
const int startFragmentPos = html.indexOf(QLatin1String("<!--StartFragment-->"));
|
const int startFragmentPos = html.indexOf(QLatin1String("<!--StartFragment-->"));
|
||||||
if (startFragmentPos != -1) {
|
if (startFragmentPos != -1) {
|
||||||
QString qt3RichTextHeader(QLatin1String("<meta name=\"qrichtext\" content=\"1\" />"));
|
QLatin1String qt3RichTextHeader("<meta name=\"qrichtext\" content=\"1\" />");
|
||||||
|
|
||||||
// Hack for Qt3
|
// Hack for Qt3
|
||||||
const bool hasQtRichtextMetaTag = html.contains(qt3RichTextHeader);
|
const bool hasQtRichtextMetaTag = html.contains(qt3RichTextHeader);
|
||||||
|
|
|
@ -298,9 +298,8 @@ protected:
|
||||||
const QModelIndex &index) const {
|
const QModelIndex &index) const {
|
||||||
if (isSeparator(index)) {
|
if (isSeparator(index)) {
|
||||||
QRect rect = option.rect;
|
QRect rect = option.rect;
|
||||||
if (const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3*>(&option))
|
if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(option.widget))
|
||||||
if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(v3->widget))
|
rect.setWidth(view->viewport()->width());
|
||||||
rect.setWidth(view->viewport()->width());
|
|
||||||
QStyleOption opt;
|
QStyleOption opt;
|
||||||
opt.rect = rect;
|
opt.rect = rect;
|
||||||
mCombo->style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, painter, mCombo);
|
mCombo->style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, painter, mCombo);
|
||||||
|
|
|
@ -2384,7 +2384,7 @@ void QTextEdit::setText(const QString &text)
|
||||||
{
|
{
|
||||||
Qt::TextFormat format = Qt::mightBeRichText(text) ? Qt::RichText : Qt::PlainText;
|
Qt::TextFormat format = Qt::mightBeRichText(text) ? Qt::RichText : Qt::PlainText;
|
||||||
#ifndef QT_NO_TEXTHTMLPARSER
|
#ifndef QT_NO_TEXTHTMLPARSER
|
||||||
if (format == Qt::RichText || format == Qt::LogText)
|
if (format == Qt::RichText)
|
||||||
setHtml(text);
|
setHtml(text);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue