root/trunk/qt4-gui/src/widgets/mlview.h

Revision 6428, 2.3 kB (checked in by eugene, 5 months ago)

Don't interfere Qt with additional mouse selection copying slots, just instruct how to do the copy.

  • Property svn:eol-style set to native
Line 
1/*
2 * This file is part of Licq, an instant messaging client for UNIX.
3 * Copyright (C) 2002-2006 Licq developers
4 *
5 * Licq is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Licq is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Licq; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20#ifndef MLVIEW_H
21#define MLVIEW_H
22
23#include <QTextBrowser>
24
25namespace LicqQtGui
26{
27
28class MLView : public QTextBrowser
29{
30  Q_OBJECT
31public:
32  MLView(QWidget* parent = 0);
33  virtual ~MLView() {}
34
35  void appendNoNewLine(const QString& s);
36  void GotoHome();
37  void GotoEnd();
38
39  bool hasMarkedText() const;
40  QString markedText() const;
41
42  void setBackground(const QColor&);
43  void setForeground(const QColor&);
44  void setHandleLinks(bool enable);
45
46  static QString toRichText(const QString& s, bool highlightURLs = false, bool useHTML = false, QRegExp highlight = QRegExp());
47
48  /**
49   * Caclulate height for widget to fit a specified number of lines with
50   * current font
51   *
52   * @param lines Number of text lines to calculate for
53   * @return Widget height in pixels
54   */
55  int heightForLines(int lines) const;
56
57  /**
58   * Set size hint as number of lines of text
59   *
60   * @param lines Lines of text that should be visible
61   */
62  void setSizeHintLines(int lines);
63
64  /**
65   * Get recommended widget size
66   *
67   * @return Recommended size
68   */
69  QSize sizeHint() const;
70
71protected:
72  virtual void contextMenuEvent(QContextMenuEvent* event);
73  virtual QMimeData* createMimeDataFromSelection() const;
74
75public slots:
76  virtual void setSource(const QUrl& url);
77
78private slots:
79  void slotCopyUrl();
80  void makeQuote();
81  void updateFont();
82
83private:
84  bool m_handleLinks;
85  QString m_url;
86  int myFontHeight;
87  int myLinesHint;
88
89signals:
90  void quote(const QString& text);
91};
92
93} // namespace LicqQtGui
94
95#endif
Note: See TracBrowser for help on using the browser.