Add top level application view
This commit is contained in:
parent
f1101f1706
commit
07e3cf7fd6
|
@ -15,6 +15,7 @@
|
|||
#include <SkinnyShapeProvider.h>
|
||||
#include <SkinnyNamespace.h>
|
||||
|
||||
#include <QskApplicationView.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskTabView.h>
|
||||
|
@ -42,7 +43,6 @@ namespace
|
|||
{
|
||||
setTabBarEdge( Qt::BottomEdge );
|
||||
setAutoFitTabs( true );
|
||||
setSection( QskAspect::Footer );
|
||||
}
|
||||
|
||||
void setTabsEnabled( bool on )
|
||||
|
@ -164,8 +164,6 @@ namespace
|
|||
initSizePolicy( QskSizePolicy::Ignored, QskSizePolicy::Fixed );
|
||||
setPanel( true );
|
||||
|
||||
setSection( QskAspect::Header );
|
||||
|
||||
new FileButton( "File", this );
|
||||
new SkinButton( "Skin", this );
|
||||
|
||||
|
@ -186,14 +184,12 @@ namespace
|
|||
void enabledToggled( bool );
|
||||
};
|
||||
|
||||
class ApplicationView : public QskLinearBox
|
||||
class ApplicationView : public QskApplicationView
|
||||
{
|
||||
public:
|
||||
ApplicationView( QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
: QskApplicationView( parent )
|
||||
{
|
||||
setSpacing( 0 );
|
||||
|
||||
auto header = new Header( this );
|
||||
|
||||
auto tabView = new TabView( this );
|
||||
|
@ -207,6 +203,9 @@ namespace
|
|||
|
||||
connect( header, &Header::enabledToggled,
|
||||
tabView, &TabView::setTabsEnabled );
|
||||
|
||||
setHeader( header );
|
||||
setFooter( tabView );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2022 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskApplicationView.h"
|
||||
|
||||
class QskApplicationView::PrivateData
|
||||
{
|
||||
public:
|
||||
PrivateData()
|
||||
{
|
||||
}
|
||||
|
||||
QskControl* header = nullptr;
|
||||
QskControl* body = nullptr;
|
||||
QskControl* footer = nullptr;
|
||||
};
|
||||
|
||||
QskApplicationView::QskApplicationView( QQuickItem* parent )
|
||||
: Inherited( Qt::Vertical, parent )
|
||||
, m_data( new PrivateData )
|
||||
{
|
||||
setAutoAddChildren( false );
|
||||
setSpacing( 0 );
|
||||
}
|
||||
|
||||
QskApplicationView::~QskApplicationView()
|
||||
{
|
||||
}
|
||||
|
||||
QskControl* QskApplicationView::header() const
|
||||
{
|
||||
return m_data->header;
|
||||
}
|
||||
|
||||
void QskApplicationView::setHeader( QskControl* header )
|
||||
{
|
||||
if( m_data->header )
|
||||
{
|
||||
removeItem( m_data->header );
|
||||
}
|
||||
|
||||
m_data->header = header;
|
||||
|
||||
if( m_data->header )
|
||||
{
|
||||
m_data->header->setSection( QskAspect::Header );
|
||||
insertItem( 0, m_data->header );
|
||||
}
|
||||
}
|
||||
|
||||
QskControl* QskApplicationView::body() const
|
||||
{
|
||||
return m_data->body;
|
||||
}
|
||||
|
||||
void QskApplicationView::setBody( QskControl* body )
|
||||
{
|
||||
if( m_data->body )
|
||||
{
|
||||
removeItem( m_data->body );
|
||||
}
|
||||
|
||||
m_data->body = body;
|
||||
|
||||
if( m_data->body )
|
||||
{
|
||||
m_data->body->setSection( QskAspect::Body );
|
||||
insertItem( 1, m_data->body );
|
||||
}
|
||||
}
|
||||
|
||||
QskControl* QskApplicationView::footer() const
|
||||
{
|
||||
return m_data->footer;
|
||||
}
|
||||
|
||||
void QskApplicationView::setFooter( QskControl* footer )
|
||||
{
|
||||
if( m_data->footer )
|
||||
{
|
||||
removeItem( m_data->footer );
|
||||
}
|
||||
|
||||
m_data->footer = footer;
|
||||
|
||||
if( m_data->footer )
|
||||
{
|
||||
m_data->footer->setSection( QskAspect::Footer );
|
||||
insertItem( 2, m_data->footer );
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_QskApplicationView.cpp"
|
|
@ -0,0 +1,35 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2022 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_APPLICATION_VIEW_H
|
||||
#define QSK_APPLICATION_VIEW_H
|
||||
|
||||
#include "QskLinearBox.h"
|
||||
|
||||
class QSK_EXPORT QskApplicationView : public QskLinearBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using Inherited = QskLinearBox;
|
||||
|
||||
public:
|
||||
QskApplicationView( QQuickItem* parent = nullptr );
|
||||
~QskApplicationView() override;
|
||||
|
||||
QskControl* header() const;
|
||||
void setHeader( QskControl* );
|
||||
|
||||
QskControl* body() const;
|
||||
void setBody( QskControl* );
|
||||
|
||||
QskControl* footer() const;
|
||||
void setFooter( QskControl* );
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -146,6 +146,7 @@ HEADERS += \
|
|||
controls/QskAbstractButton.h \
|
||||
controls/QskAnimationHint.h \
|
||||
controls/QskAnimator.h \
|
||||
controls/QskApplicationView.h \
|
||||
controls/QskBoundedControl.h \
|
||||
controls/QskBoundedInput.h \
|
||||
controls/QskBoundedRangeInput.h \
|
||||
|
@ -230,6 +231,7 @@ SOURCES += \
|
|||
controls/QskAbstractButton.cpp \
|
||||
controls/QskAnimator.cpp \
|
||||
controls/QskAnimationHint.cpp \
|
||||
controls/QskApplicationView.cpp \
|
||||
controls/QskBoundedControl.cpp \
|
||||
controls/QskBoundedInput.cpp \
|
||||
controls/QskBoundedRangeInput.cpp \
|
||||
|
|
Loading…
Reference in New Issue