diff --git a/examples/gallery/Page.cpp b/examples/gallery/Page.cpp index 078d96b3..327151fb 100644 --- a/examples/gallery/Page.cpp +++ b/examples/gallery/Page.cpp @@ -5,6 +5,11 @@ #include "Page.h" +Page::Page( QQuickItem* parent ) + : Page( Qt::Vertical ) +{ +} + Page::Page( Qt::Orientation orientation, QQuickItem* parent ) : QskLinearBox( orientation, parent ) { diff --git a/examples/gallery/Page.h b/examples/gallery/Page.h index f8f8bf83..92f3be25 100644 --- a/examples/gallery/Page.h +++ b/examples/gallery/Page.h @@ -10,5 +10,6 @@ class Page : public QskLinearBox { public: + Page( QQuickItem* parent = nullptr ); Page( Qt::Orientation, QQuickItem* parent = nullptr ); }; diff --git a/examples/gallery/gallery.pro b/examples/gallery/gallery.pro index c21ad9a3..ae8596b9 100644 --- a/examples/gallery/gallery.pro +++ b/examples/gallery/gallery.pro @@ -24,6 +24,12 @@ HEADERS += \ SOURCES += \ button/ButtonPage.cpp \ +HEADERS += \ + textinput/TextInputPage.h + +SOURCES += \ + textinput/TextInputPage.cpp \ + HEADERS += \ Page.h diff --git a/examples/gallery/main.cpp b/examples/gallery/main.cpp index fd6f25aa..04189f70 100644 --- a/examples/gallery/main.cpp +++ b/examples/gallery/main.cpp @@ -7,6 +7,7 @@ #include "progressbar/ProgressBarPage.h" #include "slider/SliderPage.h" #include "button/ButtonPage.h" +#include "textinput/TextInputPage.h" #include #include @@ -20,6 +21,7 @@ #include #include #include +#include #include @@ -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 ); diff --git a/examples/gallery/textinput/TextInputPage.cpp b/examples/gallery/textinput/TextInputPage.cpp new file mode 100644 index 00000000..9346d4cd --- /dev/null +++ b/examples/gallery/textinput/TextInputPage.cpp @@ -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 +#include + +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. + } +} diff --git a/examples/gallery/textinput/TextInputPage.h b/examples/gallery/textinput/TextInputPage.h new file mode 100644 index 00000000..879eb635 --- /dev/null +++ b/examples/gallery/textinput/TextInputPage.h @@ -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(); +};