2017-07-21 18:21:34 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef QSK_TEXT_LABEL_H
|
|
|
|
#define QSK_TEXT_LABEL_H
|
|
|
|
|
|
|
|
#include "QskControl.h"
|
2018-10-19 12:53:45 +02:00
|
|
|
#include "QskTextOptions.h"
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
class QSK_EXPORT QskTextLabel : public QskControl
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged )
|
|
|
|
|
2017-08-22 20:15:11 +02:00
|
|
|
Q_PROPERTY( int fontRole READ fontRole
|
2020-12-27 16:31:07 +01:00
|
|
|
WRITE setFontRole RESET resetFontRole NOTIFY fontRoleChanged )
|
2017-08-22 20:15:11 +02:00
|
|
|
|
2020-07-15 16:17:50 +02:00
|
|
|
Q_PROPERTY( QFont font READ font )
|
|
|
|
|
2017-08-22 20:15:11 +02:00
|
|
|
Q_PROPERTY( QColor textColor READ textColor
|
2020-12-27 16:31:07 +01:00
|
|
|
WRITE setTextColor RESET resetTextColor NOTIFY textColorChanged )
|
2017-08-22 20:15:11 +02:00
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
|
|
|
WRITE setTextOptions NOTIFY textOptionsChanged )
|
|
|
|
|
|
|
|
Q_PROPERTY( Qt::Alignment alignment READ alignment
|
|
|
|
WRITE setAlignment NOTIFY alignmentChanged )
|
|
|
|
|
2019-12-15 13:57:19 +01:00
|
|
|
Q_PROPERTY( bool panel READ hasPanel
|
2021-08-26 15:17:41 +02:00
|
|
|
WRITE setPanel NOTIFY panelChanged )
|
2019-12-15 13:57:19 +01:00
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
using Inherited = QskControl;
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
public:
|
2019-12-15 13:57:19 +01:00
|
|
|
QSK_SUBCONTROLS( Panel, Text )
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
QskTextLabel( QQuickItem* parent = nullptr );
|
|
|
|
QskTextLabel( const QString& text, QQuickItem* parent = nullptr );
|
|
|
|
|
2018-07-31 17:32:25 +02:00
|
|
|
~QskTextLabel() override;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
QString text() const;
|
|
|
|
|
2017-08-22 20:15:11 +02:00
|
|
|
void setFontRole( int role );
|
2020-12-27 16:31:07 +01:00
|
|
|
void resetFontRole();
|
2017-08-22 20:15:11 +02:00
|
|
|
int fontRole() const;
|
|
|
|
|
|
|
|
void setTextColor( const QColor& );
|
2020-12-27 16:31:07 +01:00
|
|
|
void resetTextColor();
|
2017-08-22 20:15:11 +02:00
|
|
|
QColor textColor() const;
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
void setTextOptions( const QskTextOptions& );
|
|
|
|
QskTextOptions textOptions() const;
|
|
|
|
|
2018-10-19 12:53:45 +02:00
|
|
|
void setTextFormat( QskTextOptions::TextFormat );
|
|
|
|
QskTextOptions::TextFormat textFormat() const;
|
|
|
|
|
2020-12-29 09:45:00 +01:00
|
|
|
QskTextOptions::TextFormat effectiveTextFormat() const;
|
|
|
|
|
2018-10-19 12:53:45 +02:00
|
|
|
void setWrapMode( QskTextOptions::WrapMode );
|
|
|
|
QskTextOptions::WrapMode wrapMode() const;
|
|
|
|
|
|
|
|
void setElideMode( Qt::TextElideMode );
|
|
|
|
Qt::TextElideMode elideMode() const;
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
void setAlignment( Qt::Alignment );
|
2020-12-27 16:31:07 +01:00
|
|
|
void resetAlignment();
|
2017-07-21 18:21:34 +02:00
|
|
|
Qt::Alignment alignment() const;
|
|
|
|
|
|
|
|
QFont font() const;
|
|
|
|
|
2019-12-15 13:57:19 +01:00
|
|
|
void setPanel( bool );
|
|
|
|
bool hasPanel() const;
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
Q_SIGNALS:
|
2017-07-21 18:21:34 +02:00
|
|
|
void textChanged( const QString& );
|
2018-11-06 18:47:30 +01:00
|
|
|
void textColorChanged( const QColor& );
|
|
|
|
void textOptionsChanged( const QskTextOptions& );
|
2020-12-27 16:31:07 +01:00
|
|
|
void fontRoleChanged( int );
|
|
|
|
void alignmentChanged( Qt::Alignment );
|
2019-12-15 13:57:19 +01:00
|
|
|
void panelChanged( bool );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
public Q_SLOTS:
|
2017-07-21 18:21:34 +02:00
|
|
|
void setText( const QString& );
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
protected:
|
2018-07-31 17:32:25 +02:00
|
|
|
void changeEvent( QEvent* ) override;
|
2019-12-15 13:57:19 +01:00
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
private:
|
2017-07-21 18:21:34 +02:00
|
|
|
class PrivateData;
|
|
|
|
std::unique_ptr< PrivateData > m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|