OSDN Git Service

Implemented almost all ui.
[greensite/jasmine.git] / ui / rtfeditor.h
1 #pragma once
2 #include <QtGui>
3 class RtfEditor:virtual public QWidget{
4         Q_OBJECT
5         Q_PROPERTY(QString html READ html WRITE html)
6         Q_PROPERTY(QString plain READ plain WRITE plain)
7 public:
8         RtfEditor(QWidget *parent=NULL);
9 public:
10         QString html() const, plain() const;
11         void html(const QString &),plain(const QString &);
12 private slots:
13         void selectionChnged();
14         void makeBold(bool);
15         void makeItalic(bool);
16         void makeColor(bool);
17         void makeLink(bool);
18         void setLink(const QString &link);
19 signals:
20         void invalidLink(const QString &link);
21         void sendTriggered();
22 private:
23         enum style{Bold,Italic};
24         void makeStyle(const style s,bool on);
25         //When this widget is focused,To have this->editor focused is needed for convenience.
26         void focusInEvent(QFocusEvent *);
27         void keyPressEvent(QKeyEvent *);
28         QColor defaltTextColor;
29         QPalette colorset;
30         QAction *bold,*italic,*link,*color;
31         QToolBar *toolbar;
32         QTextEdit *editor;
33         QVBoxLayout *layout;
34 };