diff --git a/playground/inputpanel/LineEdit.cpp b/playground/inputpanel/LineEdit.cpp
index b170b909..62029d06 100644
--- a/playground/inputpanel/LineEdit.cpp
+++ b/playground/inputpanel/LineEdit.cpp
@@ -52,7 +52,10 @@ LineEdit::LineEdit( QQuickItem* parent ):
setActiveFocusOnTab( true );
#if 1
- setSkinlet( new LineEditSkinlet() );
+ auto skinlet = new LineEditSkinlet();
+ skinlet->setOwnedBySkinnable( true );
+
+ setSkinlet( skinlet );
#endif
}
diff --git a/playground/inputpanel/LineEditSkinlet.cpp b/playground/inputpanel/LineEditSkinlet.cpp
index a5ec7527..4e756c69 100644
--- a/playground/inputpanel/LineEditSkinlet.cpp
+++ b/playground/inputpanel/LineEditSkinlet.cpp
@@ -16,16 +16,16 @@ LineEditSkinlet::~LineEditSkinlet() = default;
QRectF LineEditSkinlet::subControlRect(
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
-{
+{
const auto lineEdit = static_cast< const LineEdit* >( skinnable );
-
+
if ( subControl == LineEdit::Panel )
{
return panelRect( lineEdit );
}
-
+
return Inherited::subControlRect( skinnable, subControl );
-}
+}
QRectF LineEditSkinlet::panelRect( const LineEdit* lineEdit ) const
{
diff --git a/playground/inputpanel/inputpanel.pro b/playground/inputpanel/inputpanel.pro
index 0158bb75..a57d2af6 100644
--- a/playground/inputpanel/inputpanel.pro
+++ b/playground/inputpanel/inputpanel.pro
@@ -4,9 +4,6 @@ TARGET = inputpanel
DEFINES += PLUGIN_PATH=$$clean_path( $$QSK_OUT_ROOT/plugins )
-RESOURCES += \
- inputpanel.qrc
-
HEADERS += \
LineEditSkinlet.h \
LineEdit.h
diff --git a/playground/inputpanel/inputpanel.qml b/playground/inputpanel/inputpanel.qml
deleted file mode 100644
index 94ef8997..00000000
--- a/playground/inputpanel/inputpanel.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-import QtQuick 2.5
-import Skinny 1.0
-import LineEdit 1.0
-
-Main
-{
- id: main
- inputPanel: embeddedInputPanel
-
- Window
- {
- id: window
-
- visible: true
- color: "Gainsboro"
-
- width: 800
- height: 400
-
- LinearBox
- {
- orientation: Qt.Vertical
- defaultAlignment: Qt.AlignHCenter | Qt.AlignTop
-
- margins: 10
- spacing: 10
-
- LineEdit
- {
- sizePolicy: [ SizePolicy.Maximum ]
-
- text: "I am a line edit. Edit me."
- }
-
- InputPanel
- {
- id: embeddedInputPanel
- //visible: Qt.inputMethod.visible
- }
- }
- }
-}
diff --git a/playground/inputpanel/inputpanel.qrc b/playground/inputpanel/inputpanel.qrc
deleted file mode 100644
index e336e14a..00000000
--- a/playground/inputpanel/inputpanel.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- inputpanel.qml
-
-
diff --git a/playground/inputpanel/main.cpp b/playground/inputpanel/main.cpp
index a36655ff..2d3ecc32 100644
--- a/playground/inputpanel/main.cpp
+++ b/playground/inputpanel/main.cpp
@@ -8,15 +8,54 @@
#include
#include
-#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
#include
-#include
#include
#define STRINGIFY(x) #x
#define STRING(x) STRINGIFY(x)
+#define LOCAL_PANEL 1
+
+class InputBox : public QskLinearBox
+{
+public:
+ InputBox( QQuickItem* parentItem = nullptr ) :
+ QskLinearBox( Qt::Vertical, parentItem )
+ {
+ setBackgroundColor( "PapayaWhip" );
+ setDefaultAlignment( Qt::AlignHCenter | Qt::AlignTop );
+
+ setMargins( 10 );
+ setSpacing( 10 );
+
+ auto* lineEdit = new LineEdit( this );
+
+ lineEdit->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
+ lineEdit->setBackgroundColor( Qt::white );
+ lineEdit->setText( "I am a line edit. Press and edit Me." );
+
+#if LOCAL_PANEL
+ auto* inputPanel = new QskInputPanel( this );
+
+ /*
+ QskInputContext is connected to QskSetup::inputPanelChanged,
+ making it the system input. If no input panel has been assigned
+ QskInputContext would create a window or subwindow on the fly.
+ */
+ qskSetup->setInputPanel( inputPanel );
+#endif
+ }
+};
+
int main( int argc, char* argv[] )
{
#ifdef ITEM_STATISTICS
@@ -26,16 +65,23 @@ int main( int argc, char* argv[] )
qputenv( "QT_IM_MODULE", "skinny" );
qputenv( "QT_PLUGIN_PATH", STRING( PLUGIN_PATH ) );
- QskModule::registerTypes();
- qmlRegisterType< LineEdit >( "LineEdit", 1, 0, "LineEdit" );
-
QGuiApplication app( argc, argv );
SkinnyFont::init( &app );
SkinnyShortcut::enable( SkinnyShortcut::Quit |
SkinnyShortcut::DebugShortcuts );
- QQmlApplicationEngine engine( QUrl( QStringLiteral( "qrc:/qml/inputpanel.qml" ) ) );
+#if !LOCAL_PANEL
+ // We don't want to have a top level window.
+ qskDialog->setPolicy( QskDialog::EmbeddedBox );
+#endif
+
+ QskWindow window;
+ window.addItem( new InputBox() );
+ window.addItem( new QskFocusIndicator() );
+
+ window.resize( 800, 400 );
+ window.show();
return app.exec();
}