QtiPlot  0.9.8.2
TextFormatButtons.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : TextFormatButtons.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief, Tilman Hoener zu Siederdissen
6  Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7  Description : Widget with text format buttons (connected to a QTextEdit)
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef TEXTFORMATBUTTONS_H
31 #define TEXTFORMATBUTTONS_H
32 
33 #include <QWidget>
34 class QTextEdit;
35 class QPushButton;
36 
38 class TextFormatButtons : public QWidget
39 {
40  Q_OBJECT
41 
42 public:
44 
46 
50  TextFormatButtons(QTextEdit * textEdit, Buttons buttons = Plot3D, QWidget * parent=0);
51  void setButtons(Buttons btns);
52 
53 private:
54  QTextEdit *connectedTextEdit;
57  void formatText(const QString & prefix, const QString & postfix);
58  void init(Buttons btns);
59 
60 private slots:
62  void addFraction();
64  void addSquareRoot();
66  void addSubscript();
68  void addSuperscript();
70  void addUnderline();
72  void addItalics();
74  void addBold();
76  void addCurve();
77 
79  void showLowerGreek();
81  void showUpperGreek();
83  void showMathSymbols();
85  void showArrowSymbols();
87  void addSymbol(const QString& letter);
88 };
89 
90 #endif // TEXTFORMATBUTTONS_H
void formatText(const QString &prefix, const QString &postfix)
Internal function: format selected text with prefix and postfix.
Definition: TextFormatButtons.cpp:528
void addCurve()
Insert curve marker into the text.
Definition: TextFormatButtons.cpp:480
Definition: TextFormatButtons.h:43
Definition: TextFormatButtons.h:43
Definition: TextFormatButtons.h:43
void showUpperGreek()
Let the user insert capital greek letters.
Definition: TextFormatButtons.cpp:177
void showMathSymbols()
Let the user insert mathematical symbols.
Definition: TextFormatButtons.cpp:189
void addUnderline()
Format seleted text to underlined.
Definition: TextFormatButtons.cpp:485
Definition: TextFormatButtons.h:43
Buttons
Definition: TextFormatButtons.h:43
void addSquareRoot()
Format seleted text to square root.
Definition: TextFormatButtons.cpp:522
void addBold()
Format seleted text to bold.
Definition: TextFormatButtons.cpp:495
void addItalics()
Format seleted text to italics.
Definition: TextFormatButtons.cpp:490
Buttons d_buttons
Definition: TextFormatButtons.h:55
Definition: TextFormatButtons.h:43
void addSymbol(const QString &letter)
Insert &#39;letter&#39; into the text.
Definition: TextFormatButtons.cpp:222
TextFormatButtons(QTextEdit *textEdit, Buttons buttons=Plot3D, QWidget *parent=0)
Constructor.
Definition: TextFormatButtons.cpp:37
Widget with text format buttons (connected to a QTextEdit)
Definition: TextFormatButtons.h:38
void addSuperscript()
Format seleted text to superscript.
Definition: TextFormatButtons.cpp:508
QTextEdit * connectedTextEdit
Definition: TextFormatButtons.h:54
void init(Buttons btns)
Definition: TextFormatButtons.cpp:49
void setButtons(Buttons btns)
Definition: TextFormatButtons.cpp:547
void showArrowSymbols()
Let the user insert arrow symbols.
Definition: TextFormatButtons.cpp:205
void showLowerGreek()
Let the user insert lower case greek letters.
Definition: TextFormatButtons.cpp:165
void addFraction()
Format seleted text to fraction.
Definition: TextFormatButtons.cpp:516
void addSubscript()
Format seleted text to subscript.
Definition: TextFormatButtons.cpp:500