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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? qtextview.cpp

?? qtopia-phone-2.2.0下公共的控件實現(xiàn)源代碼。
?? 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;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产另类一区| 中文字幕高清一区| 色偷偷一区二区三区| 国产一区二区免费在线| 香港成人在线视频| 怡红院av一区二区三区| 国产精品卡一卡二卡三| 久久一日本道色综合| 日韩手机在线导航| 在线不卡的av| 欧美日韩mp4| 欧美国产禁国产网站cc| 日韩免费一区二区三区在线播放| 欧美色大人视频| 色综合久久久久综合体桃花网| 久久99精品一区二区三区| 免费成人美女在线观看| 天天做天天摸天天爽国产一区| 一区二区在线观看不卡| 亚洲精品日韩专区silk| 亚洲婷婷综合久久一本伊一区| 久久综合九色综合欧美亚洲| 欧美xxxxxxxx| 精品国产乱码久久久久久浪潮| 日韩欧美卡一卡二| 精品不卡在线视频| 久久众筹精品私拍模特| 日韩精品中午字幕| 久久久美女毛片| 亚洲国产精品v| 国产精品视频一区二区三区不卡| 精品国产青草久久久久福利| 精品国产sm最大网站免费看| 久久这里只有精品视频网| 欧美老肥妇做.爰bbww视频| 6080yy午夜一二三区久久| 91麻豆精品国产自产在线观看一区 | 成人18精品视频| 91欧美一区二区| 色菇凉天天综合网| 欧美性大战久久久久久久蜜臀| 欧美日韩日日夜夜| 日韩三级在线免费观看| 欧美精品一区二区在线观看| 久久久久高清精品| 欧美高清hd18日本| 精品国产91乱码一区二区三区| 国产午夜亚洲精品理论片色戒| 国产欧美日韩不卡免费| 一区二区视频在线看| 亚洲综合在线五月| 久久福利视频一区二区| 国产成人精品免费网站| 91国产视频在线观看| 欧美一区二区啪啪| 日韩午夜激情av| 国产精品麻豆一区二区| 亚洲一区二区视频在线| 日韩经典中文字幕一区| 国产黄色精品视频| 欧洲精品一区二区| 精品粉嫩aⅴ一区二区三区四区| 久久精品欧美一区二区三区不卡| 亚洲欧洲av一区二区三区久久| 亚洲成a人片在线观看中文| 免费高清成人在线| 99精品桃花视频在线观看| 欧美日韩大陆在线| 国产女主播在线一区二区| 夜夜嗨av一区二区三区中文字幕 | 欧美一区二区三区性视频| 久久久亚洲高清| 亚洲自拍偷拍九九九| 国产一区欧美日韩| 91亚洲精品一区二区乱码| 欧美日韩一级视频| 欧美国产国产综合| 日本不卡中文字幕| 97久久超碰国产精品电影| 日韩欧美精品三级| 一区二区在线观看不卡| 久久99国产精品免费| 欧美中文字幕不卡| 国产精品天天看| 青青草原综合久久大伊人精品 | 一区二区三区在线观看视频| 国产精品一区二区在线观看网站| 欧美性生活一区| 国产精品美日韩| 午夜免费欧美电影| 91色porny| 精品对白一区国产伦| 午夜电影网一区| 一本久久精品一区二区| 亚洲日本在线a| 国产麻豆欧美日韩一区| 51精品国自产在线| 亚洲一区二区三区在线播放| 国产成人精品亚洲日本在线桃色| 91精品国产一区二区| 综合欧美一区二区三区| 成人午夜激情视频| 久久久久久久久久久电影| 日韩电影免费一区| 欧美日韩亚洲综合在线 | 国产精品久久毛片| 国产精品综合网| 精品国产自在久精品国产| 免费观看30秒视频久久| 欧美日韩情趣电影| 亚洲综合一区二区| 色婷婷综合中文久久一本| 国产精品久久久久久久久晋中| 国产精品一区在线观看乱码| 91精品久久久久久久91蜜桃 | 日韩电影在线免费| 欧美日韩免费在线视频| 亚洲一区二区三区四区中文字幕| 91麻豆精品视频| 国产亚洲一区二区在线观看| 精品亚洲国内自在自线福利| 日韩欧美国产麻豆| 午夜久久久影院| 在线不卡一区二区| 久久99久久久久| 精品国产一区二区三区久久影院 | 国产精品毛片久久久久久久| 91在线精品一区二区三区| 亚洲理论在线观看| 欧美裸体bbwbbwbbw| 黑人巨大精品欧美黑白配亚洲| 久久久国产午夜精品| av在线播放不卡| 视频精品一区二区| 26uuu久久天堂性欧美| 成人黄色av电影| 91美女精品福利| 爽爽淫人综合网网站| 精品乱人伦一区二区三区| 国产69精品久久久久777| 亚洲欧美日韩国产综合在线| 宅男噜噜噜66一区二区66| 国产激情精品久久久第一区二区 | 亚洲精品免费一二三区| 欧美福利电影网| 国产福利一区二区三区视频在线 | 日本不卡一二三| 国产亚洲成av人在线观看导航| 99国产精品国产精品毛片| 亚洲成av人片在www色猫咪| 精品成人一区二区三区四区| 91美女视频网站| 精品亚洲porn| 一区二区国产盗摄色噜噜| 精品国产一区久久| 在线免费观看一区| 国产一区二区免费视频| 亚洲一区在线看| 国产欧美精品一区| 欧美一区二区视频在线观看2020 | 亚洲午夜免费电影| 久久综合九色综合97_久久久| 91在线视频免费观看| 精品一区二区在线播放| 一区二区欧美国产| 国产精品美女久久久久久久网站| 538在线一区二区精品国产| 91偷拍与自偷拍精品| 韩国成人精品a∨在线观看| 亚洲无人区一区| 国产精品久久99| 久久九九国产精品| 欧美一区日韩一区| 欧美日韩国产天堂| 日本韩国精品在线| 成人午夜大片免费观看| 久久国产日韩欧美精品| 亚洲福利一二三区| 亚洲免费毛片网站| 国产精品欧美经典| 久久蜜桃av一区二区天堂| 欧美一区二区三区男人的天堂| 色菇凉天天综合网| 91色乱码一区二区三区| 成人性生交大片免费看中文| 激情亚洲综合在线| 蜜芽一区二区三区| 香蕉加勒比综合久久 | 一本大道久久a久久综合| 国产成人无遮挡在线视频| 喷水一区二区三区| 天堂一区二区在线| 亚洲国产精品久久人人爱蜜臀 | 韩国女主播成人在线观看| 三级欧美韩日大片在线看| 亚洲已满18点击进入久久| 亚洲曰韩产成在线| 亚洲制服丝袜在线| 亚瑟在线精品视频| 香蕉影视欧美成人|