KDEUI
ksqueezedtextlabel.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KSQUEEZEDTEXTLABEL_H 00020 #define KSQUEEZEDTEXTLABEL_H 00021 00022 #include <kdeui_export.h> 00023 #include <QtGui/QLabel> 00024 00025 class KSqueezedTextLabelPrivate; 00026 00044 /* 00045 * QLabel 00046 */ 00047 class KDEUI_EXPORT KSqueezedTextLabel : public QLabel { 00048 Q_OBJECT 00049 Q_PROPERTY( Qt::TextElideMode textElideMode READ textElideMode WRITE setTextElideMode ) 00050 00051 public: 00055 explicit KSqueezedTextLabel( QWidget *parent = 0 ); 00056 explicit KSqueezedTextLabel( const QString &text, QWidget *parent = 0 ); 00057 00058 virtual ~KSqueezedTextLabel(); 00059 00060 virtual QSize minimumSizeHint() const; 00061 virtual QSize sizeHint() const; 00065 virtual void setAlignment( Qt::Alignment ); 00066 00070 Qt::TextElideMode textElideMode() const; 00071 00076 void setTextElideMode( Qt::TextElideMode mode ); 00077 00083 QString fullText() const; 00084 00085 public Q_SLOTS: 00100 void setText( const QString &text ); 00105 void clear(); 00106 00107 protected: 00111 void mouseReleaseEvent(QMouseEvent*); 00112 00116 void resizeEvent( QResizeEvent * ); 00120 void contextMenuEvent(QContextMenuEvent* ); 00124 void squeezeTextToLabel(); 00125 00126 private: 00127 Q_PRIVATE_SLOT(d, void _k_copyFullText()) 00128 KSqueezedTextLabelPrivate * const d; 00129 }; 00130 00131 #endif // KSQUEEZEDTEXTLABEL_H
KDE 4.6 API Reference