亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qtextview.cpp

?? qtopia-phone-2.2.0下公共的控件實現源代碼。
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************************** $Id: qt/src/widgets/qtextview.cpp   2.3.12   edited 2005-10-27 $**** Implementation of the QTextView class**** Created : 990101**** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.**** This file is part of the widgets module of the Qt GUI Toolkit.**** This file may be distributed under the terms of the Q Public License** as defined by Trolltech AS of Norway and appearing in the file** LICENSE.QPL included in the packaging of this file.**** This file may be distributed and/or modified under the terms of the** GNU General Public License version 2 as published by the Free Software** Foundation and appearing in the file LICENSE.GPL included in the** packaging of this file.**** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition** licenses may use this file in accordance with the Qt Commercial License** Agreement provided with the Software.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.**** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for**   information about Qt Commercial License Agreements.** See http://www.trolltech.com/qpl/ for QPL licensing information.** See http://www.trolltech.com/gpl/ for GPL licensing information.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#include "qtextview.h"#ifndef QT_NO_TEXTVIEW#include "../kernel/qrichtext_p.h"#include "qapplication.h"#include "qlayout.h"#include "qpainter.h"#include "qstack.h"#include "stdio.h"#include "qfile.h"#include "qtextstream.h"#include "qlayout.h"#include "qbitmap.h"#include "qtimer.h"#include "qimage.h"#include "qmime.h"#include "qdragobject.h"#include "qclipboard.h"#include "qdragobject.h"#ifdef QT_KEYPAD_MODEextern bool qt_singleFocusWidget(const QWidget *in);extern bool qt_modalEditingEnabled;#endif/*!  \class QTextView qtextview.h  \brief A sophisticated single-page rich text viewer.  \ingroup basic  \ingroup helpsystem  Unlike QSimpleRichText, which merely draws small pieces of rich  text, a QTextView is a real widget, with scrollbars when necessary,  for showing large text documents.  The rendering style and available tags are defined by a  styleSheet(). Custom tags can be created and placed in a custom  style sheet. Change the style sheet with \l{setStyleSheet()}; see  QStyleSheet for details. Currently, a small XML/CSS1 subset including  embedded images and tables is supported. See QStyleSheet for  details. Possible images within the text document are resolved by  using a QMimeSourceFactory.  See setMimeSourceFactory() for details.  Using QTextView is quite similar to QLabel. It's mainly a call to  setText() to set the contents. Setting the background color is  slightly different from other widgets, since a text view is a  scrollable widget that naturally provides a scrolling background. You  can specify the colorgroup of the displayed text with  setPaperColorGroup() or directly define the paper background with  setPaper(). QTextView supports both plain color and complex pixmap  backgrounds.  Note that we do not intend to add a full-featured web browser widget  to Qt (since that would easily double Qt's size and only few  applications would benefit from it). In particular, the rich text  support in Qt is supposed to provide a fast, portable and sufficient  way to add reasonable online help facilities to applications. We  will, however, extend it to some degree in future versions of Qt.  For even more, like hypertext capabilities, see QTextBrowser.*/class QTextViewData{public:    QStyleSheet* sheet_;    QRichText* doc_;    QMimeSourceFactory* factory_;    QString original_txt;    QString txt;    QString contxt;    QColorGroup mypapcolgrp;    QColorGroup papcolgrp;    QColor mylinkcol;    QColor paplinkcol;    bool linkunderline;    QTimer* resizeTimer;#ifndef QT_NO_DRAGANDDROP    QTimer* dragTimer;#endif    QTimer* scrollTimer;    Qt::TextFormat textformat;    QRichTextFormatter* fcresize;    QPoint cursor;    QtTriple selorigin;    QtTriple selstart;    QtTriple selend;    uint selection :1;    uint dirty :1;    uint dragselection :1;    uint ownpalette : 1;};/*!  Constructs an empty QTextView  with the standard \a parent and \a name optional arguments.*/QTextView::QTextView(QWidget *parent, const char *name)    : QScrollView( parent, name, WRepaintNoErase ){    init();}/*!  Constructs a QTextView displaying the contents \a text with context  \a context, with the standard \a parent and \a name optional  arguments.*/QTextView::QTextView( const QString& text, const QString& context,		      QWidget *parent, const char *name)    : QScrollView( parent, name, WRepaintNoErase ){    init();    setText( text, context );}void QTextView::init(){    d = new QTextViewData;    d->mypapcolgrp = palette().active();    d->papcolgrp = d->mypapcolgrp;    d->mylinkcol = blue;    d->paplinkcol = d->mylinkcol;    d->linkunderline = TRUE;    d->fcresize = 0;    setKeyCompression( TRUE );    setVScrollBarMode( QScrollView::Auto );    setHScrollBarMode( QScrollView::Auto );    d->doc_ = 0;    d->sheet_ = 0;    d->factory_ = 0;    d->txt = QString::fromLatin1("<p></p>");    d->textformat = AutoText;    d->dirty = TRUE;    d->selection = FALSE;    d->dragselection = FALSE;    d->ownpalette = FALSE;    viewport()->setBackgroundMode( PaletteBase );    viewport()->setFocusProxy( this );    viewport()->setFocusPolicy( WheelFocus );    d->resizeTimer = new QTimer( this, "qt_resizetimer" );    connect( d->resizeTimer, SIGNAL( timeout() ), this, SLOT( doResize() ));#ifndef QT_NO_DRAGANDDROP    d->dragTimer = new QTimer( this );    connect( d->dragTimer, SIGNAL( timeout() ), this, SLOT( doStartDrag() ));#endif    d->scrollTimer = new QTimer( this );    connect( d->scrollTimer, SIGNAL( timeout() ), this, SLOT( doAutoScroll() ));}/*!  Destructs the view.*/QTextView::~QTextView(){    delete d->fcresize;    QTextFormatCollection* formats = d->doc_?d->doc_->formats:0;    delete d->doc_;    delete formats; //#### fix inheritance structure in rich text    delete d;}/*!  Changes the contents of the view to the string \a text and the  context to \a context.  \a text may be interpreted either as plain text or as rich text,  depending on the textFormat(). The default setting is \c AutoText,  i.e. the text view autodetects the format from \a text.  For rich text the rendering style and available tags are defined by  a styleSheet(); see QStyleSheet for details.  The optional \a context is used to resolve references within the  text document, for example image sources. It is passed directly to  the mimeSourceFactory() when quering data.  \sa text(), setTextFormat()*/void QTextView::setText( const QString& text, const QString& context){    QTextFormatCollection* formats = d->doc_?d->doc_->formats:0;    delete d->doc_;    delete formats; //#### fix inheritance structure in rich text    d->doc_ = 0;    d->selection = FALSE;    d->original_txt = text;    d->contxt = context;    if ( text.isEmpty() )	d->txt = QString::fromLatin1("<p></p>");    else if ( d->textformat == AutoText ) {	if ( QStyleSheet::mightBeRichText( text ) )	    d->txt = text;	else	    d->txt = QStyleSheet::convertFromPlainText( text );    }    else if ( d->textformat == PlainText )	d->txt = QStyleSheet::convertFromPlainText( text );    else // rich text	d->txt = text;    setContentsPos( 0, 0 );    richText().invalidateLayout();    richText().flow()->initialize( visibleWidth() );    updateLayout();    viewport()->update();}/*!\overload  Changes the contents of the view to the string \a text.  \a text may be interpreted either as plain text or as rich text,  depending on the textFormat(). The default setting is \c AutoText,  i.e. the text view autodetects the format from \a text.  This function calls setText( text, QString::null ), i.e. it sets a  text without any context.  \sa text(), setTextFormat() */void QTextView::setText( const QString& text ){    setText( text, QString::null );}/*!  Appends \a text to the current text.  Useful for log viewers.  \warning This function has known problems (incorrect painting and  layouting). If this problem occures to you, use setText( text() +  theNewText ) instead. The new richtext engine, which is part of Qt  3.0, is able to handle append(), insert(), etc. properly.*/void QTextView::append( const QString& text ){    richText().append( text,  mimeSourceFactory(), styleSheet() );    if ( isVisible() ) {	int y = contentsHeight();	int h = richText().lastChild()->bottomMargin();	if ( d->fcresize ) {	    d->fcresize->updateLayout();	    doResize();	} else	    updateLayout();	updateContents( contentsX(), y-h, visibleWidth(), h );    }    d->original_txt += text;}/*!  Returns the contents of the view.  \sa context(), setText()*/QString QTextView::text() const{    return d->original_txt;}/*!  Returns the context of the view.  \sa text(), setText()*/QString QTextView::context() const{    return d->contxt;}void QTextView::createRichText(){    if ( d->mypapcolgrp != d->papcolgrp )	viewport()->setBackgroundColor( d->mypapcolgrp.base() );    d->papcolgrp = d->mypapcolgrp;    d->paplinkcol = d->mylinkcol;    int offset = 8;    if ( width() < 240) 	offset = 4;    d->doc_ = new QRichText( d->txt, viewport()->font(), d->contxt,			     offset, mimeSourceFactory(), styleSheet() );    if (d->doc_->attributes().contains("bgcolor")){	QColor  col ( d->doc_->attributes()["bgcolor"].latin1() );	if ( col.isValid() ) {	    d->papcolgrp.setColor( QColorGroup::Base, col );	    viewport()->setBackgroundColor( col );	}    }    if (d->doc_->attributes().contains("link")){	QColor  col ( d->doc_->attributes()["link"].latin1() );	if ( col.isValid() )	    d->paplinkcol = col;    }    if (d->doc_->attributes().contains("text")){	QColor  col ( d->doc_->attributes()["text"].latin1() );	if ( col.isValid() )	    d->papcolgrp.setColor( QColorGroup::Text,  col );    }    if (d->doc_->attributes().contains("background")){	QString imageName = d->doc_->attributes()["background"];	QPixmap pm;	const QMimeSource* m =	    context().isNull()		? mimeSourceFactory()->data( imageName )		: mimeSourceFactory()->data( imageName, context() );	if ( m ) {	    if ( !QImageDrag::decode( m, pm ) ) {		qWarning("QTextImage: cannot load %s", imageName.latin1() );	    }	}	if (!pm.isNull())	    d->papcolgrp.setBrush( QColorGroup::Base, QBrush(d->papcolgrp.base(), pm) );    }    d->cursor = QPoint(0,0);}/*!  Returns the current style sheet of the view.  \sa setStyleSheet()*/QStyleSheet* QTextView::styleSheet() const{    if (!d->sheet_)	return QStyleSheet::defaultSheet();    else	return d->sheet_;}/*!  Sets the style sheet of the view.  \sa styleSheet()*/void QTextView::setStyleSheet( QStyleSheet* styleSheet ){    d->sheet_ = styleSheet;    viewport()->update();}/*!  Returns the current mime source factory  for the view.  \sa setMimeSourceFactory()*/QMimeSourceFactory* QTextView::mimeSourceFactory() const{    if (!d->factory_)	return QMimeSourceFactory::defaultFactory();    else	return d->factory_;}/*!  Sets the mime source factory for the view. The factory is used to  resolve named references within rich text documents. If no factory  has been specified, the text view uses the default factory  QMimeSourceFactory::defaultFactory().  Ownership of \a factory is \e not transferred to make it possible  for several text view widgets to share the same mime source.  \sa mimeSourceFactory()*/void QTextView::setMimeSourceFactory( QMimeSourceFactory* factory ){    d->factory_ = factory;    viewport()->update();}/*!  Sets the brush to use as the background to \a pap.  This may be a nice parchment or marble pixmap or simply another  plain color.  Technically, setPaper() is just a convenience function to set the  base brush of the paperColorGroup().  \sa paper()*/void QTextView::setPaper( const QBrush& pap){    d->mypapcolgrp.setBrush( QColorGroup::Base, pap );    d->papcolgrp.setBrush( QColorGroup::Base, pap );    d->ownpalette = TRUE;    viewport()->setBackgroundColor( pap.color() );    viewport()->update();}/*!  Sets the full colorgroup of the paper to \a colgrp. If not specified  otherwise in the document itself, any text will use  QColorGroup::text(). The background will be painted with  QColorGroup::brush(QColorGroup::Base).  \sa paperColorGroup(), setPaper()*/void QTextView::setPaperColorGroup( const QColorGroup& colgrp){    d->mypapcolgrp = colgrp;    d->papcolgrp = colgrp;    d->ownpalette = TRUE;    viewport()->setBackgroundColor( colgrp.base() );    viewport()->update();}/*!  Returns the colorgroup of the paper.  \sa setPaperColorGroup(), setPaper()*/const QColorGroup& QTextView::paperColorGroup() const{    return d->papcolgrp;}/*!  Sets the color used to display links in the document to \c col.  \sa linkColor() */void QTextView::setLinkColor( const QColor& col ){    d->mylinkcol = col;    d->paplinkcol = col;}/*!  Returns the current link color.  The color may either have been set with setLinkColor() or stem from  the document's body tag.  \sa setLinkColor() */const QColor& QTextView::linkColor() const{    return d->paplinkcol;}/*!  Defines whether or not links should be displayed underlined. */void QTextView::setLinkUnderline( bool u){    d->linkunderline = u;}/*!  Returns whether or not links should be displayed underlined. */bool QTextView::linkUnderline() const{    return d->linkunderline;}/*!  Returns the document title parsed from the content.*/QString QTextView::documentTitle() const{    return richText().attributes()["title"];}/*!  Returns the height of the view given a width of \a w.*/int QTextView::heightForWidth( int w ) const{    QRichText doc( d->txt, viewport()->font(), d->contxt,		   8, mimeSourceFactory(), styleSheet() );    doc.doLayout( 0, w );    return doc.height;}/*!  Returns the document defining the view as drawable and queryable rich  text object.  This is not currently useful for applications.*/QRichText& QTextView::richText() const{    if (!d->doc_){	QTextView* that = (QTextView*) this;	that->createRichText();    }    return *d->doc_;}/*!  Returns the brush used to paint the background.*/const QBrush& QTextView::paper(){#ifdef QT_KEYPAD_MODE    if( qt_modalEditingEnabled ) {	if ( !isModalEditing() && !qt_singleFocusWidget(this) )	    return d->papcolgrp.brush( QColorGroup::Background );    }#endif    return d->papcolgrp.brush( QColorGroup::Base );}/*!  Returns the brush used to paint the background.*/const QBrush& QTextView::paper() const{#ifdef QT_KEYPAD_MODE    if( qt_modalEditingEnabled ) {	if ( !isModalEditing() && !qt_singleFocusWidget(this) )	    return d->papcolgrp.brush( QColorGroup::Background );    }#endif    return d->papcolgrp.brush( QColorGroup::Base );}/*!  \reimp*/void QTextView::drawContentsOffset(QPainter* p, int ox, int oy,				 int cx, int cy, int cw, int ch){    if ( !d->ownpalette && d->mypapcolgrp == d->papcolgrp ) {	d->mypapcolgrp = colorGroup();	d->papcolgrp = d->mypapcolgrp;    }    QTextOptions to(&paper(), d->paplinkcol, d->linkunderline );    to.offsetx = ox;    to.offsety = oy;    if ( d->selection ) {	to.selstart = d->selstart;	to.selend = d->selend;    }    QRegion r(cx-ox, cy-oy, cw, ch);    QRichTextFormatter tc( richText() );    tc.gotoParagraph( p, richText().getParBefore( cy ) );    QTextParagraph* b = tc.paragraph;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产不卡在线视频| 青娱乐精品视频在线| 日产国产欧美视频一区精品| 韩日精品视频一区| 91麻豆swag| 欧美一区二区国产| 国产精品理论片在线观看| 亚洲女同一区二区| 国产乱码精品1区2区3区| 91成人网在线| 欧美激情在线观看视频免费| 五月天视频一区| 高清日韩电视剧大全免费| 欧美日本国产一区| 樱桃视频在线观看一区| 国产美女视频一区| 91麻豆精品国产自产在线 | 精品无码三级在线观看视频| 91蜜桃网址入口| www久久精品| 午夜电影久久久| 欧洲一区在线电影| 1区2区3区精品视频| 久久99精品久久久久婷婷| 欧美系列日韩一区| 中文字幕五月欧美| 捆绑调教一区二区三区| 欧美午夜一区二区三区免费大片| 国产精品国产成人国产三级| 精品一区二区三区在线播放视频 | 日日夜夜免费精品| 色婷婷综合激情| 日本一区二区三区在线观看| 久久综合综合久久综合| 欧美精品1区2区3区| 一片黄亚洲嫩模| 一本色道久久综合亚洲aⅴ蜜桃| 久久精品综合网| 午夜视频在线观看一区| 色天天综合久久久久综合片| 成人欧美一区二区三区黑人麻豆| 国产精品一区专区| 久久麻豆一区二区| 午夜精品久久久久久久蜜桃app| 欧洲日韩一区二区三区| 亚洲男人的天堂在线观看| 国产99精品在线观看| 久久久久国产精品人| 国产一区视频在线看| 精品嫩草影院久久| 国产丝袜美腿一区二区三区| 国产精品一区一区| 国产欧美精品一区| 国产福利精品一区二区| 日本一区二区免费在线观看视频 | 不卡视频在线看| 欧美r级在线观看| 狠狠久久亚洲欧美| 国产午夜一区二区三区| av午夜一区麻豆| 亚洲精品第一国产综合野| 欧美探花视频资源| 秋霞电影网一区二区| 26uuu精品一区二区三区四区在线| 国产精品白丝av| 亚洲人成伊人成综合网小说| 欧美三级中文字幕| 久久国产精品区| 中文一区一区三区高中清不卡| 99这里都是精品| 天堂久久一区二区三区| 欧美大胆人体bbbb| 成人激情午夜影院| 午夜精品久久久久久久99水蜜桃 | 欧美福利视频一区| 久久国产夜色精品鲁鲁99| 欧美激情一区不卡| 欧美中文字幕一区| 韩国女主播一区二区三区| 国产精品国产三级国产aⅴ入口| 欧美视频三区在线播放| 国产一区二区视频在线播放| 欧美激情一区二区三区四区| 欧美午夜精品一区二区蜜桃| 久久99国产精品尤物| 最新国产精品久久精品| 欧美久久一二区| 国产一级精品在线| 洋洋成人永久网站入口| 久久久综合激的五月天| 欧美性色黄大片手机版| 国产一区二区主播在线| 亚洲黄色录像片| 久久久欧美精品sm网站| 日本韩国一区二区三区| 国产在线国偷精品免费看| 一区二区三区在线观看动漫| 久久综合色综合88| 欧美性猛片xxxx免费看久爱| 国产福利91精品一区| 天堂成人免费av电影一区| 国产精品免费观看视频| 日韩一区二区精品在线观看| 99re在线精品| 国产一区美女在线| 午夜精品成人在线视频| 亚洲欧洲性图库| 久久亚洲二区三区| 欧美日韩一区三区四区| 不卡的av网站| 国产一区二区中文字幕| 丝袜诱惑制服诱惑色一区在线观看 | 国产91精品露脸国语对白| 日韩av在线发布| 亚洲欧美日韩小说| 国产视频一区在线观看| 欧美一区二区三区精品| 91久久精品国产91性色tv| 国产ts人妖一区二区| 麻豆国产精品视频| 亚洲国产精品综合小说图片区| 国产精品免费aⅴ片在线观看| 精品蜜桃在线看| 制服.丝袜.亚洲.另类.中文 | 国模少妇一区二区三区| 亚洲成人动漫av| 亚洲精品一卡二卡| 日本一区二区三区免费乱视频| 日韩精品中文字幕在线一区| 欧美三区在线观看| 在线免费观看成人短视频| 成人性生交大合| 国产美女主播视频一区| 久久97超碰色| 看国产成人h片视频| 日韩和的一区二区| 亚洲男人天堂av| 中文字幕一区日韩精品欧美| 欧美激情一区二区三区蜜桃视频| 精品免费日韩av| 欧美成人bangbros| 欧美一级搡bbbb搡bbbb| 欧美老年两性高潮| 欧美日韩高清在线| 欧美日韩一区二区电影| 欧美性色黄大片| 欧美性猛交xxxx乱大交退制版 | 国产精品1区二区.| 激情六月婷婷综合| 国产真实精品久久二三区| 麻豆91在线看| 另类小说色综合网站| 久久精工是国产品牌吗| 男女视频一区二区| 麻豆精品在线观看| 精品无人区卡一卡二卡三乱码免费卡| 男女男精品视频网| 精品中文av资源站在线观看| 麻豆国产精品777777在线| 精品一区二区三区香蕉蜜桃 | 曰韩精品一区二区| 一区二区三区不卡视频| 亚洲一卡二卡三卡四卡五卡| 亚洲高清中文字幕| 三级不卡在线观看| 日韩电影免费在线看| 久久er精品视频| 国产精品911| 96av麻豆蜜桃一区二区| 色欧美片视频在线观看| 欧美久久高跟鞋激| 一区二区高清在线| 亚洲一区二区美女| 免费三级欧美电影| 国产精品一区二区在线观看网站| 国产成人免费视| 色综合久久综合网| 欧美美女喷水视频| 日韩精品中文字幕一区 | 99久久国产综合精品色伊 | 久久超级碰视频| 国产精品一区二区在线观看网站| 国产91丝袜在线观看| 99精品国产91久久久久久 | 国产成人精品网址| 99久久99久久综合| 欧美性感一区二区三区| 欧美一区二区三区在线观看视频| 久久精品人人爽人人爽| 亚洲欧美激情插| 青青草原综合久久大伊人精品| 国产乱色国产精品免费视频| 91麻豆国产福利在线观看| 欧美乱熟臀69xxxxxx| 久久亚洲精精品中文字幕早川悠里 | 高清日韩电视剧大全免费| 91久久人澡人人添人人爽欧美| 777午夜精品免费视频| 国产亚洲精品免费| 亚洲高清免费在线|