QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskMessageWindow.cpp
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#include "QskMessageWindow.h"
7#include "QskTextLabel.h"
8#include "QskTextOptions.h"
9
10namespace
11{
12 class TextLabel final : public QskTextLabel
13 {
14 public:
15 TextLabel( QskMessageWindow* box )
16 {
17 setObjectName( QStringLiteral( "QskMessageWindowTextLabel" ) );
18 initSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Preferred );
19
20 setAlignment( Qt::AlignLeft | Qt::AlignTop );
21 setWrapMode( QskTextOptions::WordWrap );
22
23 connect( this, &QskTextLabel::textChanged,
24 box, &QskMessageWindow::textChanged );
25
26 connect( this, &QskTextLabel::textOptionsChanged,
27 box, &QskMessageWindow::textOptionsChanged );
28 }
29 };
30}
31
32class QskMessageWindow::PrivateData
33{
34 public:
35 QskTextLabel* textLabel;
36};
37
38QskMessageWindow::QskMessageWindow( QWindow* parent )
39 : Inherited( parent )
40 , m_data( new PrivateData() )
41{
42 setFlags( Qt::Dialog | Qt::WindowTitleHint |
43 Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint );
44
45 m_data->textLabel = new TextLabel( this );
46 setDialogContentItem( m_data->textLabel );
47}
48
49QskMessageWindow::~QskMessageWindow()
50{
51}
52
53void QskMessageWindow::setText( const QString& text )
54{
55 m_data->textLabel->setText( text );
56}
57
58QString QskMessageWindow::text() const
59{
60 return m_data->textLabel->text();
61}
62
63void QskMessageWindow::setTextOptions( const QskTextOptions& options )
64{
65 m_data->textLabel->setTextOptions( options );
66}
67
68QskTextOptions QskMessageWindow::textOptions() const
69{
70 return m_data->textLabel->textOptions();
71}
72
73#include "moc_QskMessageWindow.cpp"
void initSizePolicy(QskSizePolicy::Policy, QskSizePolicy::Policy)