GridLayoutPage added
This commit is contained in:
parent
d53cb4116b
commit
4850cdfac1
48
examples/layouts/GridLayoutPage.cpp
Normal file
48
examples/layouts/GridLayoutPage.cpp
Normal 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 );
|
||||
}
|
17
examples/layouts/GridLayoutPage.h
Normal file
17
examples/layouts/GridLayoutPage.h
Normal 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
|
@ -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 \
|
||||
|
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user