📄 zmultilineedit.h
字号:
void textChanged(); void returnPressed(); void undoAvailable( bool ); void redoAvailable( bool ); void copyAvailable( bool ); /** * the signal is emitted when size hint is changed * * @note internal use */ void changeSizeHint( QWidget* widget,QSize size,QPoint cusrorPos,int larger ); /** * the signal is emitted when lines is changed * * @note internal use */ void linesChanged( int lines,QPoint cursorPos );protected: void updateMask(); void pixelPosToCursorPos(QPoint p, int* x, int* y) const; void setCursorPixelPosition(QPoint p, bool clear_mark = true); void paintEvent(QPaintEvent * );#define MOT_BLEND#ifdef MOT_BLEND void paintCell( QPainter *, int row, int col, int xPos, int yPos );#else void paintCell( QPainter *, int row, int col );#endif /** * draw the line text * override the function to draw own style's text. * for example: * change color of the line text * * @param (x,y) the base line to draw * @param width width of the area to draw * @param height height of the area to draw * @param flags alignment * @param flags lineStr line text * @param lineStr line text * @param marked if true, the text is in the marked area, or it is not marked * * @note all the params above have the right initial values */ virtual void drawLineText( QPainter* painter, int x, int y, int width, int height, int flags, const QString& lineStr); bool event( QEvent * ); void mousePressEvent( QMouseEvent * ); void mouseMoveEvent( QMouseEvent * ); void mouseReleaseEvent( QMouseEvent * ); void mouseDoubleClickEvent( QMouseEvent * ); void wheelEvent( QWheelEvent * ); void keyPressEvent( QKeyEvent * ); void focusInEvent( QFocusEvent * ); void focusOutEvent( QFocusEvent * ); void timerEvent( QTimerEvent * ); void leaveEvent( QEvent * ); void resizeEvent( QResizeEvent * ); bool focusNextPrevChild( bool );#ifndef QT_NO_DRAGANDDROP void dragMoveEvent( QDragMoveEvent* ); void dragEnterEvent( QDragEnterEvent * ); void dropEvent( QDropEvent* ); void dragLeaveEvent( QDragLeaveEvent* );#endif bool hasMarkedText() const; QString markedText() const; int textWidth( int ); int textWidth( const QString &); QPoint cursorPoint() const;protected: virtual void insert( const QString&, bool mark ); virtual void newLine(); virtual void killLine(); virtual void pageUp( bool mark=FALSE ); virtual void pageDown( bool mark=FALSE ); virtual void cursorLeft( bool mark=FALSE, bool wrap = TRUE ); virtual void cursorRight( bool mark=FALSE, bool wrap = TRUE ); virtual void cursorUp( bool mark=FALSE ); virtual void cursorDown( bool mark=FALSE ); virtual void backspace(); virtual void del(); virtual void home( bool mark=FALSE ); virtual void end( bool mark=FALSE ); bool getMarkedRegion( int *line1, int *col1, int *line2, int *col2 ) const; int lineLength( int row ) const; QString *getString( int row ) const; bool isEndOfParagraph( int row ) const; QString stringShown( int row ) const;protected: bool cursorOn; void insertChar( QChar );#ifndef QT_NO_QWS_MMI_TEST QRect globalRect( int mx, int my, int mwidth, int mheight ); virtual bool sendPackage(); virtual bool sendPackageItem( int mmix, int mmiy, int mmiwidth, int mmiheight, QString mmis );#endifprivate slots: void clipboardChanged(); void blinkTimerTimeout(); void scrollTimerTimeout(); void dndTimeout();private: void init( QWidget *parent,bool style,int lines,const char *name ); bool isValidChar( const QChar& ch ); void filterString( QString& filtered,const QString& s ); void autoSendScrollRequest( int lines,const QPoint& curPos );#ifndef AMT_NO_THAI_ADDITIONS int clusterForward(int cp) const; int clusterBackward(int cp) const; int toClusterEnd(int cp) const;#endif#ifndef QT_NO_MIME QCString pickSpecial( QMimeSource* ms, bool always_ask, const QPoint& );#endif/* #ifndef QT_NO_MIMECLIPBOARD */ void pasteSpecial(const QPoint&);/* #endif */ struct ZMultiLineEditRow { ZMultiLineEditRow( QString string, int width, bool nl = TRUE ) :s(string), w(width), newline( nl ) { }; QString s; int w; bool newline; }; QList<ZMultiLineEditRow>* contents; ZMultiLineData* d; int indent; QSize hint; bool ezx_style; int lines; int minLines; bool underline; bool readOnly; bool dummy; bool markIsOn; bool dragScrolling ; bool dragMarking; bool textDirty; bool wordMark; bool overWrite; int cursorX; int cursorY; int markAnchorX; int markAnchorY; int markDragX; int markDragY; int curXPos; // cell coord of cursor int blinkTimer; // #### not used anymore - remove in 3.0 int scrollTimer; // #### not used anymore - remove in 3.0 int mapFromView( int xPos, int row ); int mapToView( int xIndex, int row ); void setWidth( int ); void updateCellWidth(); bool partiallyInvisible( int row ); void makeVisible(); void setBottomCell( int row ); void newMark( int posx, int posy, bool copy=TRUE ); void markWord( int posx, int posy ); void extendSelectionWord( int &newX, int&newY); int charClass( QChar ); void turnMark( bool on ); bool inMark( int posx, int posy ) const; bool beforeMark( int posx, int posy ) const; bool afterMark( int posx, int posy ) const; int setNumRowsAndTruncate();#ifndef QT_NO_DRAGANDDROP void doDrag();#endif void startAutoScroll(); void stopAutoScroll(); void cursorLeft( bool mark, bool clear_mark, bool wrap ); void cursorRight( bool mark, bool clear_mark, bool wrap ); void cursorUp( bool mark, bool clear_mark ); void cursorDown( bool mark, bool clear_mark ); void wrapLine( int line, int removed = 0); void rebreakParagraph( int line, int removed = 0 ); void rebreakAll(); void insertAtAux( const QString &s, int line, int col, bool mark = FALSE ); void killLineAux(); void delAux(); int positionToOffsetInternal( int row, int col ) const; void offsetToPositionInternal( int position, int *row, int *col ) const; void deleteNextChar( int offset, int row, int col ); void addUndoCmd( ZMultiLineEditCommand* ); void addRedoCmd( ZMultiLineEditCommand* ); void processCmd( ZMultiLineEditCommand*, bool );private: // Disabled copy constructor and operator=#if defined(Q_DISABLE_COPY) ZMultiLineEdit( const ZMultiLineEdit & ); ZMultiLineEdit &operator=( const ZMultiLineEdit & );#endif };inline bool ZMultiLineEdit::isReadOnly() const { return readOnly; }inline bool ZMultiLineEdit::isOverwriteMode() const { return overWrite; }inline void ZMultiLineEdit::setOverwriteMode( bool on ){ overWrite = on;}inline int ZMultiLineEdit::lineLength( int row ) const{ return contents->at( row )->s.length();}inline bool ZMultiLineEdit::atEnd() const{ return cursorY == (int)contents->count() - 1 && cursorX == lineLength( cursorY ) ;}inline bool ZMultiLineEdit::atBeginning() const{ return cursorY == 0 && cursorX == 0;}inline QString *ZMultiLineEdit::getString( int row ) const{ return &(contents->at( row )->s);}inline int ZMultiLineEdit::numLines() const{ return contents->count();}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -