ソースを参照

onHideKeyPressed signal eingeführt
Hintergrund auch unter letzte Tastenreihe (warum auch immer, ich fands vorher schöner)

Reinhard Russinger 8 年 前
コミット
1393b389d4
3 ファイル変更15 行追加18 行削除
  1. 5 12
      FreeVirtualKeyboardInputContext.cpp
  2. 0 4
      FreeVirtualKeyboardInputContext.h
  3. 10 2
      InputPanel.qml

+ 5 - 12
FreeVirtualKeyboardInputContext.cpp

@@ -55,7 +55,6 @@ FreeVirtualKeyboardInputContext::FreeVirtualKeyboardInputContext() :
     qmlRegisterSingletonType<DeclarativeInputEngine>("FreeVirtualKeyboard", 1, 0,
     qmlRegisterSingletonType<DeclarativeInputEngine>("FreeVirtualKeyboard", 1, 0,
                                                      "InputEngine", inputEngineProvider);
                                                      "InputEngine", inputEngineProvider);
     connect(d->InputEngine, SIGNAL(animatingChanged()), this, SLOT(ensureFocusedObjectVisible()));
     connect(d->InputEngine, SIGNAL(animatingChanged()), this, SLOT(ensureFocusedObjectVisible()));
-    connect(d->InputEngine, SIGNAL(reset()), this, SLOT(resetInputEngine()));
 }
 }
 
 
 
 
@@ -190,14 +189,6 @@ void FreeVirtualKeyboardInputContext::setFocusObject(QObject *object)
     ensureFocusedObjectVisible();
     ensureFocusedObjectVisible();
 }
 }
 
 
-//==============================================================================
-void resetInputEngine(){
-
-    qDebug() << "RESET INPUT ENGINE !!!!!";
-    return;
-}
-
-
 //==============================================================================
 //==============================================================================
 void FreeVirtualKeyboardInputContext::ensureFocusedObjectVisible()
 void FreeVirtualKeyboardInputContext::ensureFocusedObjectVisible()
 {
 {
@@ -226,7 +217,6 @@ void FreeVirtualKeyboardInputContext::ensureFocusedObjectVisible()
 
 
     qDebug() << "FreeVirtualKeyboardInputContext::ensureFocusedObjectVisible";
     qDebug() << "FreeVirtualKeyboardInputContext::ensureFocusedObjectVisible";
 
 
-
     QRectF FocusItemRect(0, 0, d->FocusItem->width(), d->FocusItem->height());
     QRectF FocusItemRect(0, 0, d->FocusItem->width(), d->FocusItem->height());
     FocusItemRect = d->Flickable->mapRectFromItem(d->FocusItem, FocusItemRect);
     FocusItemRect = d->Flickable->mapRectFromItem(d->FocusItem, FocusItemRect);
     qDebug() << "FocusItemRect: " << FocusItemRect;
     qDebug() << "FocusItemRect: " << FocusItemRect;
@@ -238,17 +228,20 @@ void FreeVirtualKeyboardInputContext::ensureFocusedObjectVisible()
     if (FocusItemRect.bottom() >= d->Flickable->height())
     if (FocusItemRect.bottom() >= d->Flickable->height())
     {
     {
         qDebug() << "Item outside!!!  FocusItemRect.bottom() >= d->Flickable->height()";
         qDebug() << "Item outside!!!  FocusItemRect.bottom() >= d->Flickable->height()";
-        ContentY = d->Flickable->contentY() + (FocusItemRect.bottom() - d->Flickable->height()) + 20;
+        qDebug() << "ContentY " << d->Flickable->contentY() << "FocusItem Bottom : " << FocusItemRect.bottom()
+                 << "Flickable Height " << d->Flickable->height();
+        ContentY = d->Flickable->contentY() + (FocusItemRect.bottom() - d->Flickable->height());
         d->FlickableContentScrollAnimation->setEndValue(ContentY);
         d->FlickableContentScrollAnimation->setEndValue(ContentY);
         d->FlickableContentScrollAnimation->start();
         d->FlickableContentScrollAnimation->start();
     }
     }
     else if (FocusItemRect.top() < 0)
     else if (FocusItemRect.top() < 0)
     {
     {
         qDebug() << "Item outside!!!  d->FocusItem->position().x < 0";
         qDebug() << "Item outside!!!  d->FocusItem->position().x < 0";
-        ContentY = d->Flickable->contentY() + FocusItemRect.top() - 20;
+        ContentY = d->Flickable->contentY() + FocusItemRect.top();
         d->FlickableContentScrollAnimation->setEndValue(ContentY);
         d->FlickableContentScrollAnimation->setEndValue(ContentY);
         d->FlickableContentScrollAnimation->start();
         d->FlickableContentScrollAnimation->start();
     }
     }
+
 }
 }
 
 
 
 

+ 0 - 4
FreeVirtualKeyboardInputContext.h

@@ -100,10 +100,6 @@ private slots:
      * QML item is child of a flickable
      * QML item is child of a flickable
      */
      */
     void ensureFocusedObjectVisible();
     void ensureFocusedObjectVisible();
-    /**
-     */
-    void resetInputEngine();
-
 
 
 }; // FreeVirtualKeyboardInputContext
 }; // FreeVirtualKeyboardInputContext
 
 

+ 10 - 2
InputPanel.qml

@@ -14,6 +14,7 @@ Item {
     height: width / 4
     height: width / 4
     // Report actual keyboard rectangle to input engine
     // Report actual keyboard rectangle to input engine
     onYChanged: InputEngine.setKeyboardRectangle(Qt.rect(x, y, width, height))
     onYChanged: InputEngine.setKeyboardRectangle(Qt.rect(x, y, width, height))
+    signal hideKeyPressed
 
 
     KeyModel {
     KeyModel {
         id:keyModel
         id:keyModel
@@ -48,7 +49,7 @@ Item {
         KeyButton {
         KeyButton {
             id: button
             id: button
             width: pimpl.buttonWidth
             width: pimpl.buttonWidth
-            height: pimpl.rowHeight * 4 / 5
+            height: pimpl.rowHeight  * 4 / 5
             text: (pimpl.shiftModifier) ? letter.toUpperCase() : (pimpl.symbolModifier)?firstSymbol : letter
             text: (pimpl.shiftModifier) ? letter.toUpperCase() : (pimpl.symbolModifier)?firstSymbol : letter
             inputPanel: root
             inputPanel: root
             color: "grey"
             color: "grey"
@@ -81,6 +82,12 @@ Item {
         z: 100
         z: 100
     }
     }
 
 
+    Rectangle {
+        id: background
+        color: "black"
+        width: keyboard.width
+        height: keyboard.height + 4 * pimpl.verticalSpacing
+    }
 
 
     Rectangle {
     Rectangle {
         id:keyboard
         id:keyboard
@@ -180,7 +187,8 @@ Item {
                     text: "\uf11c" //"\uf078"
                     text: "\uf11c" //"\uf078"
                     functionKey: true
                     functionKey: true
                     onClicked: {
                     onClicked: {
-                        Qt.inputMethod.hide()
+                        Qt.inputMethod.hide();
+                        hideKeyPressed();
                     }
                     }
                     inputPanel: root
                     inputPanel: root
                     showPreview: false
                     showPreview: false