1.1 --- a/texteditor.h Fri Jul 22 15:38:06 2005 +0000
1.2 +++ b/texteditor.h Mon Aug 01 19:33:16 2005 +0000
1.3 @@ -1,3 +1,4 @@
1.4 +/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
1.5 #ifndef TEXTEDITOR_H
1.6 #define TEXTEDITOR_H
1.7
1.8 @@ -12,6 +13,8 @@
1.9
1.10 QString textConvertToASCII(const QString &);
1.11
1.12 +class MyTextEdit;
1.13 +
1.14 class TextEditor : public QMainWindow {
1.15 Q_OBJECT
1.16 public:
1.17 @@ -71,15 +74,17 @@
1.18 void textSize( const QString &p );
1.19 void textColor();
1.20 void textAlign(QAction*);
1.21 + void textVAlign();
1.22 void fontChanged( const QFont &f );
1.23 void colorChanged( const QColor &c );
1.24 void alignmentChanged( int a );
1.25 + void verticalAlignmentChanged(int a);
1.26 void enableActions();
1.27 void disableActions();
1.28
1.29 private:
1.30 QPrinter *printer;
1.31 - QTextEdit *e;
1.32 + MyTextEdit *e;
1.33 QPoint lastPos; // save last position of window
1.34 QString filename;
1.35 QString filenameHint;
1.36 @@ -119,7 +124,39 @@
1.37 *actionAlignLeft,
1.38 *actionAlignCenter,
1.39 *actionAlignRight,
1.40 - *actionAlignJustify;
1.41 + *actionAlignJustify,
1.42 + *actionAlignSubScript,
1.43 + *actionAlignSuperScript;
1.44 +};
1.45 +
1.46 +/* Wraps currentVerticalAlignmentChanged(VerticalAlignment)
1.47 + * to currentVerticalAlignmentChanged(int)
1.48 + * this way the signal can be used without use of the internal
1.49 + * VerticalAlignment enum of QTextEdit
1.50 + * If VerticalAlignment has been a global like the normal alignment there
1.51 + * have been no problems!
1.52 + */
1.53 +
1.54 +class MyTextEdit : public QTextEdit
1.55 +{
1.56 + Q_OBJECT;
1.57 + public:
1.58 + MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name) {
1.59 + connect(this,
1.60 + SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)),
1.61 + this,
1.62 + SLOT(verticalAlignmentChanged(VerticalAlignment)));
1.63 + }
1.64 + int verticalAlignment() const { return m_verticalAlignment; }
1.65 + signals:
1.66 + void currentVerticalAlignmentChanged(int a);
1.67 + public slots:
1.68 + void verticalAlignmentChanged(VerticalAlignment a) {
1.69 + m_verticalAlignment = a;
1.70 + emit currentVerticalAlignmentChanged((int)a);
1.71 + }
1.72 + private:
1.73 + int m_verticalAlignment;
1.74 };
1.75
1.76 #endif