GridLayoutPage added

This commit is contained in:
Uwe Rathmann 2019-05-10 07:33:41 +02:00
parent d53cb4116b
commit 4850cdfac1
4 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,48 @@
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#include "GridLayoutPage.h"
#include "TestRectangle.h"
#include <QskGridBox.h>
#include <QskRgbValue.h>
namespace
{
class Box : public QskGridBox
{
public:
Box( QQuickItem* parent = nullptr )
: QskGridBox( parent )
{
setObjectName( "GridBox" );
setBackgroundColor( Qt::white );
setMargins( 10 );
addItem( new TestRectangle( "PaleVioletRed" ), 0, 0, 1, 2 );
addItem( new TestRectangle( "DarkSeaGreen" ), 1, 0, 2, 1 );
addItem( new TestRectangle( "SkyBlue" ), 2, 1, 1, 1 );
addItem( new TestRectangle( "NavajoWhite" ), 0, 2, 4, 1 );
}
void mirror()
{
setLayoutMirroring( !layoutMirroring() );
}
};
}
GridLayoutPage::GridLayoutPage( QQuickItem* parent )
: QskControl( parent )
{
#if 1
setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue );
#endif
setAutoLayoutChildren( true );
new Box( this );
}

View File

@ -0,0 +1,17 @@
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#ifndef GRID_LAYOUT_PAGE
#define GRID_LAYOUT_PAGE 1
#include <QskControl.h>
class GridLayoutPage : public QskControl
{
public:
GridLayoutPage( QQuickItem* parent = nullptr );
};
#endif

View File

@ -4,6 +4,7 @@ HEADERS += \
TestRectangle.h \
ButtonBox.h \
FlowLayoutPage.h \
GridLayoutPage.h \
LinearLayoutPage.h \
DynamicConstraintsPage.h \
StackLayoutPage.h
@ -12,6 +13,7 @@ SOURCES += \
TestRectangle.cpp \
ButtonBox.cpp \
FlowLayoutPage.cpp \
GridLayoutPage.cpp \
LinearLayoutPage.cpp \
DynamicConstraintsPage.cpp \
StackLayoutPage.cpp \

View File

@ -6,6 +6,7 @@
#include "DynamicConstraintsPage.h"
#include "FlowLayoutPage.h"
#include "LinearLayoutPage.h"
#include "GridLayoutPage.h"
#include "StackLayoutPage.h"
#include <SkinnyFont.h>
@ -52,11 +53,13 @@ int main( int argc, char* argv[] )
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
auto tabView = new QskTabView();
tabView->setMargins( 10 );
tabView->setTabPosition( Qsk::Left );
tabView->addTab( "Grid Layout", new DummyLabel( "Grid Layout - TODO ..." ) );
tabView->addTab( "Grid Layout", new GridLayoutPage() );
tabView->addTab( "Flow Layout", new FlowLayoutPage() );
tabView->addTab( "Linear Layout", new LinearLayoutPage() );
int dynamicIndex = tabView->addTab( "Dynamic\nConstraints", new DynamicConstraintsPage() );
auto button = tabView->buttonAt( dynamicIndex );