GridLayoutPage added
This commit is contained in:
parent
d53cb4116b
commit
4850cdfac1
|
@ -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 );
|
||||||
|
}
|
|
@ -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 \
|
TestRectangle.h \
|
||||||
ButtonBox.h \
|
ButtonBox.h \
|
||||||
FlowLayoutPage.h \
|
FlowLayoutPage.h \
|
||||||
|
GridLayoutPage.h \
|
||||||
LinearLayoutPage.h \
|
LinearLayoutPage.h \
|
||||||
DynamicConstraintsPage.h \
|
DynamicConstraintsPage.h \
|
||||||
StackLayoutPage.h
|
StackLayoutPage.h
|
||||||
|
@ -12,6 +13,7 @@ SOURCES += \
|
||||||
TestRectangle.cpp \
|
TestRectangle.cpp \
|
||||||
ButtonBox.cpp \
|
ButtonBox.cpp \
|
||||||
FlowLayoutPage.cpp \
|
FlowLayoutPage.cpp \
|
||||||
|
GridLayoutPage.cpp \
|
||||||
LinearLayoutPage.cpp \
|
LinearLayoutPage.cpp \
|
||||||
DynamicConstraintsPage.cpp \
|
DynamicConstraintsPage.cpp \
|
||||||
StackLayoutPage.cpp \
|
StackLayoutPage.cpp \
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "DynamicConstraintsPage.h"
|
#include "DynamicConstraintsPage.h"
|
||||||
#include "FlowLayoutPage.h"
|
#include "FlowLayoutPage.h"
|
||||||
#include "LinearLayoutPage.h"
|
#include "LinearLayoutPage.h"
|
||||||
|
#include "GridLayoutPage.h"
|
||||||
#include "StackLayoutPage.h"
|
#include "StackLayoutPage.h"
|
||||||
|
|
||||||
#include <SkinnyFont.h>
|
#include <SkinnyFont.h>
|
||||||
|
@ -52,11 +53,13 @@ int main( int argc, char* argv[] )
|
||||||
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
||||||
|
|
||||||
auto tabView = new QskTabView();
|
auto tabView = new QskTabView();
|
||||||
|
|
||||||
tabView->setMargins( 10 );
|
tabView->setMargins( 10 );
|
||||||
tabView->setTabPosition( Qsk::Left );
|
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( "Flow Layout", new FlowLayoutPage() );
|
||||||
tabView->addTab( "Linear Layout", new LinearLayoutPage() );
|
tabView->addTab( "Linear Layout", new LinearLayoutPage() );
|
||||||
|
|
||||||
int dynamicIndex = tabView->addTab( "Dynamic\nConstraints", new DynamicConstraintsPage() );
|
int dynamicIndex = tabView->addTab( "Dynamic\nConstraints", new DynamicConstraintsPage() );
|
||||||
|
|
||||||
auto button = tabView->buttonAt( dynamicIndex );
|
auto button = tabView->buttonAt( dynamicIndex );
|
||||||
|
|
Loading…
Reference in New Issue