diff -r 16b250a57c17 -r f4bbdc809fec texteditor.h --- a/texteditor.h Fri Jul 22 15:38:06 2005 +0000 +++ b/texteditor.h Mon Aug 01 19:33:16 2005 +0000 @@ -1,3 +1,4 @@ +/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */ #ifndef TEXTEDITOR_H #define TEXTEDITOR_H @@ -12,6 +13,8 @@ QString textConvertToASCII(const QString &); +class MyTextEdit; + class TextEditor : public QMainWindow { Q_OBJECT public: @@ -71,15 +74,17 @@ void textSize( const QString &p ); void textColor(); void textAlign(QAction*); + void textVAlign(); void fontChanged( const QFont &f ); void colorChanged( const QColor &c ); void alignmentChanged( int a ); + void verticalAlignmentChanged(int a); void enableActions(); void disableActions(); private: QPrinter *printer; - QTextEdit *e; + MyTextEdit *e; QPoint lastPos; // save last position of window QString filename; QString filenameHint; @@ -119,7 +124,39 @@ *actionAlignLeft, *actionAlignCenter, *actionAlignRight, - *actionAlignJustify; + *actionAlignJustify, + *actionAlignSubScript, + *actionAlignSuperScript; +}; + +/* Wraps currentVerticalAlignmentChanged(VerticalAlignment) + * to currentVerticalAlignmentChanged(int) + * this way the signal can be used without use of the internal + * VerticalAlignment enum of QTextEdit + * If VerticalAlignment has been a global like the normal alignment there + * have been no problems! + */ + +class MyTextEdit : public QTextEdit +{ + Q_OBJECT; + public: + MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name) { + connect(this, + SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)), + this, + SLOT(verticalAlignmentChanged(VerticalAlignment))); + } + int verticalAlignment() const { return m_verticalAlignment; } + signals: + void currentVerticalAlignmentChanged(int a); + public slots: + void verticalAlignmentChanged(VerticalAlignment a) { + m_verticalAlignment = a; + emit currentVerticalAlignmentChanged((int)a); + } + private: + int m_verticalAlignment; }; #endif