File indexing completed on 2024-06-16 07:42:27

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_TITLE_LABEL_H_
0007 #define _K3B_TITLE_LABEL_H_
0008 
0009 #include "k3b_export.h"
0010 
0011 #include <QResizeEvent>
0012 #include <QFrame>
0013 
0014 class QResizeEvent;
0015 
0016 namespace K3b {
0017     class LIBK3B_EXPORT TitleLabel : public QFrame
0018     {
0019         Q_OBJECT
0020 
0021     public:
0022         explicit TitleLabel( QWidget* parent = 0 );
0023         ~TitleLabel() override;
0024 
0025         QSize sizeHint() const override;
0026         QSize minimumSizeHint() const override;
0027 
0028         bool event( QEvent* event ) override;
0029 
0030     public Q_SLOTS:
0031         /**
0032          * default: 2
0033          */
0034         void setMargin( int );
0035 
0036         void setTitle( const QString& title, const QString& subTitle = QString() );
0037         void setSubTitle( const QString& subTitle );
0038 
0039         /**
0040          * The title label only supports alignments left, hcenter, and right
0041          *
0042          * Default alignment is left.
0043          */
0044         void setAlignment( Qt::Alignment alignment );
0045 
0046     protected:
0047         void resizeEvent( QResizeEvent* ) override;
0048         void paintEvent( QPaintEvent* ) override;
0049 
0050     private:
0051         void updatePositioning();
0052 
0053         class Private;
0054         Private* d;
0055     };
0056 }
0057 
0058 #endif