gallery: Add tab for dialogs

This commit is contained in:
Peter Hartmann 2022-07-05 15:45:06 +02:00
parent 7b247c67fe
commit 35e61ce52a
4 changed files with 107 additions and 0 deletions

View 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 );
}

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
*****************************************************************************/
#pragma once
#include "Page.h"
class DialogPage : public Page
{
public:
DialogPage( QQuickItem* = nullptr );
private:
void populate();
};

View File

@ -36,6 +36,12 @@ HEADERS += \
SOURCES += \
selector/SelectorPage.cpp \
HEADERS += \
dialog/DialogPage.h
SOURCES += \
dialog/DialogPage.cpp \
HEADERS += \
Page.h

View File

@ -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 );