textinput page added

This commit is contained in:
Uwe Rathmann 2022-04-19 08:42:53 +02:00
parent 8eda6ad35e
commit 8abbae3661
6 changed files with 76 additions and 0 deletions

View File

@ -5,6 +5,11 @@
#include "Page.h"
Page::Page( QQuickItem* parent )
: Page( Qt::Vertical )
{
}
Page::Page( Qt::Orientation orientation, QQuickItem* parent )
: QskLinearBox( orientation, parent )
{

View File

@ -10,5 +10,6 @@
class Page : public QskLinearBox
{
public:
Page( QQuickItem* parent = nullptr );
Page( Qt::Orientation, QQuickItem* parent = nullptr );
};

View File

@ -24,6 +24,12 @@ HEADERS += \
SOURCES += \
button/ButtonPage.cpp \
HEADERS += \
textinput/TextInputPage.h
SOURCES += \
textinput/TextInputPage.cpp \
HEADERS += \
Page.h

View File

@ -7,6 +7,7 @@
#include "progressbar/ProgressBarPage.h"
#include "slider/SliderPage.h"
#include "button/ButtonPage.h"
#include "textinput/TextInputPage.h"
#include <SkinnyShortcut.h>
#include <SkinnyShapeProvider.h>
@ -20,6 +21,7 @@
#include <QskPushButton.h>
#include <QskMenu.h>
#include <QskWindow.h>
#include <QskDialog.h>
#include <QGuiApplication>
@ -132,6 +134,7 @@ namespace
tabView->addTab( "Buttons", new ButtonPage() );
tabView->addTab( "Sliders", new SliderPage() );
tabView->addTab( "Progress\nBars", new ProgressBarPage() );
tabView->addTab( "Text\nInputs", new TextInputPage() );
connect( header, &Header::enabledToggled,
tabView, &TabView::setTabsEnabled );
@ -147,6 +150,9 @@ int main( int argc, char* argv[] )
Qsk::addGraphicProvider( "shapes", new SkinnyShapeProvider() );
// dialogs in faked windows -> QskSubWindow
QskDialog::instance()->setPolicy( QskDialog::EmbeddedBox );
QGuiApplication app( argc, argv );
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );

View File

@ -0,0 +1,41 @@
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#include "TextInputPage.h"
#include <QskLinearBox.h>
#include <QskTextInput.h>
TextInputPage::TextInputPage( QQuickItem* parent )
: Page( parent )
{
setSpacing( 40 );
populate();
}
void TextInputPage::populate()
{
auto box = new QskLinearBox( Qt::Horizontal, 2, this );
box->setExtraSpacingAt( Qt::BottomEdge );
{
new QskTextInput( "Edit Me", box );
}
{
auto input = new QskTextInput( "Only Read Me", box );
input->setReadOnly( true );
}
{
auto input = new QskTextInput( "12345", box );
input->setMaxLength( 5 );
input->setEchoMode( QskTextInput::PasswordEchoOnEdit );
}
{
// once we have QskTextEdit it will be here too.
}
}

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 TextInputPage : public Page
{
public:
TextInputPage( QQuickItem* = nullptr );
private:
void populate();
};