gallery: Add tab for dialogs
This commit is contained in:
parent
7b247c67fe
commit
35e61ce52a
82
examples/gallery/dialog/DialogPage.cpp
Normal file
82
examples/gallery/dialog/DialogPage.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include "DialogPage.h"
|
||||
|
||||
#include <QskDialog.h>
|
||||
#include <QskGridBox.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskStandardSymbol.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class Box : public QskGridBox
|
||||
{
|
||||
public:
|
||||
Box( QQuickItem* parent )
|
||||
: QskGridBox( parent )
|
||||
{
|
||||
auto* messageButton = new QskPushButton( "message", this );
|
||||
|
||||
connect( messageButton, &QskPushButton::clicked, this, []()
|
||||
{
|
||||
qskDialog->message( "message", "text", QskStandardSymbol::Ok );
|
||||
} );
|
||||
|
||||
auto* informationButton = new QskPushButton( "information", this );
|
||||
|
||||
connect( informationButton, &QskPushButton::clicked, this, []()
|
||||
{
|
||||
qskDialog->information( "information", "text" );
|
||||
} );
|
||||
|
||||
auto* warningButton = new QskPushButton( "warning", this );
|
||||
|
||||
connect( warningButton, &QskPushButton::clicked, this, []()
|
||||
{
|
||||
qskDialog->warning( "warning", "text" );
|
||||
} );
|
||||
|
||||
auto* criticalButton = new QskPushButton( "critical", this );
|
||||
|
||||
connect( criticalButton, &QskPushButton::clicked, this, []()
|
||||
{
|
||||
qskDialog->critical( "critical", "text" );
|
||||
} );
|
||||
|
||||
auto* questionButton = new QskPushButton( "question", this );
|
||||
|
||||
connect( questionButton, &QskPushButton::clicked, this, []()
|
||||
{
|
||||
qskDialog->question( "question", "text" );
|
||||
} );
|
||||
|
||||
auto* selectButton = new QskPushButton( "select", this );
|
||||
|
||||
connect( selectButton, &QskPushButton::clicked, this, []()
|
||||
{
|
||||
qskDialog->select( "select", "text", { "yes", "no", "maybe" } );
|
||||
} );
|
||||
|
||||
addItem( messageButton, 0, 0 );
|
||||
addItem( informationButton, 0, 1 );
|
||||
addItem( warningButton, 0, 2 );
|
||||
addItem( criticalButton, 1, 0 );
|
||||
addItem( questionButton, 1, 1 );
|
||||
addItem( selectButton, 1, 2 );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
DialogPage::DialogPage( QQuickItem* parent )
|
||||
: Page( Qt::Horizontal, parent )
|
||||
{
|
||||
populate();
|
||||
}
|
||||
|
||||
void DialogPage::populate()
|
||||
{
|
||||
new Box( this );
|
||||
}
|
17
examples/gallery/dialog/DialogPage.h
Normal file
17
examples/gallery/dialog/DialogPage.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
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Page.h"
|
||||
|
||||
class DialogPage : public Page
|
||||
{
|
||||
public:
|
||||
DialogPage( QQuickItem* = nullptr );
|
||||
|
||||
private:
|
||||
void populate();
|
||||
};
|
@ -36,6 +36,12 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
selector/SelectorPage.cpp \
|
||||
|
||||
HEADERS += \
|
||||
dialog/DialogPage.h
|
||||
|
||||
SOURCES += \
|
||||
dialog/DialogPage.cpp \
|
||||
|
||||
HEADERS += \
|
||||
Page.h
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "button/ButtonPage.h"
|
||||
#include "textinput/TextInputPage.h"
|
||||
#include "selector/SelectorPage.h"
|
||||
#include "dialog/DialogPage.h"
|
||||
|
||||
#include <SkinnyShortcut.h>
|
||||
#include <SkinnyShapeProvider.h>
|
||||
@ -138,6 +139,7 @@ namespace
|
||||
tabView->addTab( "Progress\nBars", new ProgressBarPage() );
|
||||
tabView->addTab( "Text\nInputs", new TextInputPage() );
|
||||
tabView->addTab( "Selectors", new SelectorPage() );
|
||||
tabView->addTab( "Dialogs", new DialogPage() );
|
||||
|
||||
connect( header, &Header::enabledToggled,
|
||||
tabView, &TabView::setTabsEnabled );
|
||||
|
Loading…
x
Reference in New Issue
Block a user