KDEUI
ktitlewidget.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2007-2009 Urs Wolfer <uwolfer @ kde.org> 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 KTITLEWIDGET_H 00020 #define KTITLEWIDGET_H 00021 00022 #include <kdeui_export.h> 00023 00024 #include <QtGui/QWidget> 00025 00061 class KDEUI_EXPORT KTitleWidget : public QWidget 00062 { 00063 Q_OBJECT 00064 Q_ENUMS(ImageAlignment) 00065 Q_PROPERTY(QString text READ text WRITE setText) 00066 Q_PROPERTY(QString comment READ comment WRITE setComment) 00067 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) 00068 Q_PROPERTY(int autoHideTimeout READ autoHideTimeout WRITE setAutoHideTimeout) 00069 00070 public: 00077 enum ImageAlignment { 00078 ImageLeft, 00079 ImageRight 00080 }; 00081 00085 enum MessageType { 00086 PlainMessage, 00087 InfoMessage, 00088 WarningMessage, 00089 ErrorMessage 00090 }; 00091 00095 explicit KTitleWidget(QWidget *parent = 0); 00096 00097 virtual ~KTitleWidget(); 00098 00102 void setWidget(QWidget *widget); 00103 00108 QString text() const; 00109 00114 QString comment() const; 00115 00120 const QPixmap *pixmap() const; 00121 00129 void setBuddy(QWidget *buddy); 00130 00135 int autoHideTimeout() const; 00136 00137 public Q_SLOTS: 00144 void setText(const QString &text, Qt::Alignment alignment = Qt::AlignLeft | Qt::AlignVCenter); 00151 void setText(const QString &text, MessageType type); 00152 00159 void setComment(const QString &comment, MessageType type = PlainMessage); 00160 00166 void setPixmap(const QPixmap &pixmap, ImageAlignment alignment = ImageRight); 00167 00173 void setPixmap(const QString &icon, ImageAlignment alignment = ImageRight); 00174 00180 void setPixmap(const QIcon& icon, ImageAlignment alignment = ImageRight); 00181 00187 void setPixmap(MessageType type, ImageAlignment alignment = ImageRight); 00188 00194 void setAutoHideTimeout(int msecs); 00195 00196 protected: 00197 void changeEvent(QEvent *e); 00198 void showEvent(QShowEvent *event); 00199 bool eventFilter(QObject *object, QEvent *event); 00200 00201 private: 00202 class Private; 00203 Private* const d; 00204 00205 Q_PRIVATE_SLOT(d, void _k_timeoutFinished()) 00206 Q_DISABLE_COPY(KTitleWidget) 00207 }; 00208 00209 #endif
KDE 4.6 API Reference