KDEUI
kurllabel.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1998 Kurt Granroth <granroth@kde.org> 00003 Copyright (C) 2000 Peter Putzer <putzer@kde.org> 00004 Copyright (C) 2005 Jarosław Staniek <staniek@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KURLLABEL_H 00022 #define KURLLABEL_H 00023 00024 #include <kdeui_export.h> 00025 00026 #include <QtGui/QColor> 00027 #include <QtGui/QLabel> 00028 #include <QtGui/QPixmap> 00029 00030 class QCursor; 00031 00069 class KDEUI_EXPORT KUrlLabel : public QLabel 00070 { 00071 Q_OBJECT 00072 Q_PROPERTY(QString url READ url WRITE setUrl) 00073 Q_PROPERTY(QString tipText READ tipText WRITE setTipText ) 00074 Q_PROPERTY(QPixmap alternatePixmap READ alternatePixmap WRITE setAlternatePixmap ) 00075 Q_PROPERTY(bool glowEnabled READ isGlowEnabled WRITE setGlowEnabled ) 00076 Q_PROPERTY(bool floatEnabled READ isFloatEnabled WRITE setFloatEnabled ) 00077 Q_PROPERTY(bool useTips READ useTips WRITE setUseTips ) 00078 Q_PROPERTY(bool useCursor READ useCursor WRITE setUseCursor ) 00079 00080 public: 00087 explicit KUrlLabel( QWidget* parent = 0L ); 00088 00100 explicit KUrlLabel( const QString& url, const QString& text = QString(), 00101 QWidget* parent = 0L ); 00102 00106 virtual ~KUrlLabel(); 00107 00111 QString url() const; 00112 00116 QString tipText() const; 00117 00123 bool useTips() const; 00124 00130 bool useCursor() const; 00131 00136 bool isGlowEnabled() const; 00137 00146 bool isFloatEnabled() const; 00147 00151 const QPixmap* alternatePixmap() const; 00152 00153 public Q_SLOTS: 00160 void setUnderline( bool on = true ); 00161 00167 void setUrl( const QString& url ); 00168 00172 virtual void setFont( const QFont &font ); 00173 00181 void setUseTips ( bool on = true ); 00182 00190 void setTipText( const QString& tip ); 00191 00198 void setHighlightedColor( const QColor& highcolor ); 00199 00205 void setHighlightedColor( const QString& highcolor ); 00206 00214 void setSelectedColor( const QColor& color ); 00215 00221 void setSelectedColor( const QString& color ); 00222 00233 void setUseCursor( bool on, QCursor* cursor = 0L ); 00234 00242 void setGlowEnabled( bool glow = true ); 00243 00255 void setFloatEnabled( bool do_float = true ); 00256 00266 void setAlternatePixmap( const QPixmap& pixmap ); 00267 00268 Q_SIGNALS: 00269 00275 void enteredUrl( const QString& url ); 00276 00280 void enteredUrl(); 00281 00287 void leftUrl( const QString& url ); 00288 00292 void leftUrl(); 00293 00299 void leftClickedUrl( const QString& url ); 00300 00304 void leftClickedUrl(); 00305 00311 void rightClickedUrl( const QString& url ); 00312 00316 void rightClickedUrl(); 00317 00323 void middleClickedUrl( const QString& url ); 00324 00328 void middleClickedUrl(); 00329 00330 protected: 00334 virtual void mouseReleaseEvent( QMouseEvent* ); 00335 00339 virtual void enterEvent( QEvent* ); 00340 00344 virtual void leaveEvent( QEvent* ); 00345 00349 virtual bool event( QEvent* ); 00350 00351 private: 00352 class Private; 00353 Private* const d; 00354 00355 Q_PRIVATE_SLOT( d, void updateColor() ) 00356 }; 00357 00358 #endif
KDE 4.6 API Reference