libyui-qt
Loading...
Searching...
No Matches
YQRichText.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 Copyright (C) 2019 SUSE LLC
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) version 3.0 of the License. This library
8 is distributed in the hope that it will be useful, but WITHOUT ANY
9 WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11 License for more details. You should have received a copy of the GNU
12 Lesser General Public License along with this library; if not, write
13 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14 Floor, Boston, MA 02110-1301 USA
15*/
16
17
18/*-/
19
20 File: YQRichText.h
21
22 Author: Stefan Hundhammer <shundhammer@suse.de>
23
24/-*/
25
26
27#ifndef YQRichText_h
28#define YQRichText_h
29
30#include <QFrame>
31#include <QTextBrowser>
32#include <yui/YRichText.h>
33
34using std::string;
35
36
37class YQTextBrowser;
38
39class YQRichText : public QFrame, public YRichText
40{
41 Q_OBJECT
42
43public:
44
48 YQRichText( YWidget * parent,
49 const std::string & text,
50 bool plainTextMode = false );
51
55 virtual ~YQRichText();
56
62 virtual void setValue( const std::string & newValue ) override;
63
69 virtual void setPlainTextMode( bool on = true );
70
76 virtual void setAutoScrollDown( bool on = true );
77
83 virtual int preferredWidth();
84
90 virtual int preferredHeight();
91
97 virtual void setSize( int newWidth, int newHeight );
98
104 virtual void setEnabled( bool enabled );
105
111 virtual bool setKeyboardFocus();
112
118 virtual bool eventFilter( QObject * obj, QEvent * ev );
119
124 bool haveHyperLinks();
125
131 virtual std::string vScrollValue() const override;
132
138 virtual void setVScrollValue( const std::string & newValue ) override;
139
145 virtual std::string hScrollValue() const override;
146
152 virtual void setHScrollValue( const std::string & newValue ) override;
153
158 virtual void activateLink( const std::string & url );
159
163 virtual void setRichTextStyleSheet( const QString &style );
164
165protected slots:
166
170 void linkClicked( const QUrl & url );
171
172protected:
173
174 YQTextBrowser * _textBrowser;
175
176private:
177
182 bool *_colors_specified;
183
187 std::string scrollValue( QScrollBar* scrollBar ) const;
188
192 void setScrollValue( QScrollBar* scrollBar, const std::string & newValue );
193
194};
195
196
206class YQTextBrowser: public QTextBrowser
207{
208 Q_OBJECT
209
210
211public:
212
216 YQTextBrowser( QWidget * parent = 0 )
217 : QTextBrowser( parent )
218 {}
219
220public slots:
221
228 virtual void setSource( const QUrl & name );
229};
230
231
232#endif // YQRichText_h
Definition YQRichText.h:40
virtual ~YQRichText()
Definition YQRichText.cc:100
virtual void activateLink(const std::string &url)
Definition YQRichText.cc:175
virtual void setSize(int newWidth, int newHeight)
Definition YQRichText.cc:233
virtual int preferredWidth()
Definition YQRichText.cc:221
bool haveHyperLinks()
Definition YQRichText.cc:212
virtual void setAutoScrollDown(bool on=true)
Definition YQRichText.cc:166
virtual bool eventFilter(QObject *obj, QEvent *ev)
Definition YQRichText.cc:188
virtual void setRichTextStyleSheet(const QString &style)
Definition YQRichText.cc:108
virtual void setHScrollValue(const std::string &newValue) override
Definition YQRichText.cc:272
virtual int preferredHeight()
Definition YQRichText.cc:227
virtual std::string hScrollValue() const override
Definition YQRichText.cc:266
virtual std::string vScrollValue() const override
Definition YQRichText.cc:254
virtual bool setKeyboardFocus()
Definition YQRichText.cc:246
virtual void setEnabled(bool enabled)
Definition YQRichText.cc:239
virtual void setVScrollValue(const std::string &newValue) override
Definition YQRichText.cc:260
virtual void setValue(const std::string &newValue) override
Definition YQRichText.cc:123
virtual void setPlainTextMode(bool on=true)
Definition YQRichText.cc:155
void linkClicked(const QUrl &url)
Definition YQRichText.cc:181
Definition YQRichText.h:207
virtual void setSource(const QUrl &name)
Definition YQRichText.cc:306
YQTextBrowser(QWidget *parent=0)
Definition YQRichText.h:216