📄 zmultilineedit.h
字号:
/**
* 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);
virtual void drawLineText( QPainter* painter, int x, int y, int width,
int height, int flags, const QString& lineStr, int, int); //fox add last 2 params
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:
int Temp128; //fox f: $128
int Temp12C; //fox f: $12C
int Temp130; //fox f: $130
int Temp134; //fox f: $134
bool cursorOn; //fox f: $138
void insertChar( QChar );
#ifndef QT_NO_QWS_MMI_TEST
QRect globalRect( int mx, int my, int mwidth, int mheight );
//virtual int sendPackage(); //fox removed
//virtual int sendPackageItem( int mmix, int mmiy, int mmiwidth, int mmiheight, QString mmis ); //fox removed
#endif
private 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; //fox f: $13C
ZMultiLineData* d; //fox f: $140
int indent; //fox f: $144
QSize hint; //fox f: $148
bool ezx_style; //fox f: $150
int lines; //fox f: $154
int minLines; //fox f: $158
bool underline; //fox f: $15C
bool readOnly; //fox f: $15D
bool dummy; //fox f: $15E
bool markIsOn; //fox f: $15F
bool dragScrolling ; //fox f: $160
bool dragMarking; //fox f: $161
bool textDirty; //fox f: $162
bool wordMark; //fox f: $163
bool overWrite; //fox f: $164
int cursorX; //fox f: $168
int cursorY; //fox f: $16C
int markAnchorX; //fox f: $170
int markAnchorY; //fox f: $174
int markDragX; //fox f: $178
int markDragY; //fox f: $17C
int curXPos; // cell coord of cursor //fox f: $180
int blinkTimer; // #### not used anymore - remove in 3.0 //fox f: $184
int scrollTimer; // #### not used anymore - remove in 3.0 //fox f: $188
#ifdef M_A1200
bool M_190;
int M_194;
int M_198;
int M_19C;
int M_1A0;
int M_1A4;
int M_1A8;
int M_1AC;
int M_1B0;
int M_1B4;
int M_1B8;
int M_1BC;
int M_1C0;
int M_1C4;
int M_1C8;
int M_1CC;
int M_1D0;
#endif
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
public: //fox add
int deleteWord(void);
int bufferUpdate(int, int);
int bufferUpdate(void);
int calCursorPos(QPoint, int);
int getLineCount(void);
int getMDTopArea(void);
int getRowString(int);
int paintCell_if(QPainter*, int, int, bool, int, bool, int, int, QString, QFontMetrics, QRect, QColorGroup);
int clearUndoList(void);
int cursorChanged(int, int);
// int drawMultiArea(QPainter*, const QRect&, const QRect&, ZSkinBase*); //fox todo ZSkinBase
// int drawOtherArea(QPainter*, const QRect&, const QRect&, ZSkinBase*); //fox todo ZSkinBase
int getInputField(void);
int getMDLeftArea(void);
int addReplacedStr(const QString&, int);
int contentChanged(void);
int getLineContent(int);
int getMDRightArea(void);
int emitTextChanged(void);
int getMDBottomArea(void);
int insertString_if(QPoint, QString);
int setTruncateInfo(int, const QString&);
int setWordComplete(bool);
int getContentsWidth(void);
int getTruncateCount(void);
// int setTitlePosition(ZMultiLineEdit::TitlePosition); //fox todo TitlePosition
int smartPunctuation(void);
int getFormItemTopArea(void);
int setAutoFixedHeight(bool);
int fastDelTimerTimeout(void);
int getFormItemLeftArea(void);
int setTitlePositionAux(const QString&, int);
int getFormItemRightArea(void);
int cursorPosBeforeInsert(int, int, int, int*, int*);
int rightSmartPuncOccurred(void);
int setTitle(const QString&);
};
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 + -