[SOLVED] Force focus



  • Hi,

    I would to force the focus on my webview.
    I set @Focus: true@ but this not lock all time

    Thx
    Fifix



  • What should you do in the webview ? You should give some details to give the understanding of your problem.



  • Yes,

    I create this page
    @import Qt 4.7
    import QtWebKit 1.0

    Item {
    width: 1024
    height: 550

    WebView {
        id: webView
        url: "http://ljouanneau.com/lab/html5/demodragdrop.html"
        focus: true
        anchors.fill: parent
    }
    

    }@

    And drag and drop doesn't work.
    I think is focus problem

    thx
    fx



  • "Drag and drop" means scrolling?

    If so, the scrolling is not a property of the webwiew, you should put your view in a flickable area :)



  • no drag and drop means to catch and move element.

    Look this game http://pasjans-online.pl/



  • Well, I played and completed the game. Score: 653 points :)
    Then I have also understood what you mean.

    First test: opened the site in the browser of the E7-00 (symbian Anna last updates) and C7-00 (the same) it won't work. Exactly happens that the cards moves but seems unresponsives: the movement is not catched by the web script that don't move the card in the right place - i.e. the aces on the four top slots - and cards remain floating on the screen. It is possible that as the actual web browser don't has a full support of this web program also the api can't
    On the contraty opening the same link on the N950 (last firmware update - Beta 2) the game palys correctly. And I suppose that if you will try your application on this device it will rung too. I think that the first thing you should check is what is the game engine that is running on the web and if it is compabile with the webview on the device you are working. Then try with a page that includes any drag-and-drop web application that you for sure see running on the device web browser. Then, is also in this case the application don't work in your webview it maybe possible that you have omitted something.

    As my experience the webview is almost a in-app windows with a web browser instance that depends from the web libraries of the os and sdk version that you are using. What is the device, os version and sdk version you are working on ?



  • I develop a PC to enjoy the graphics power of the QML

    device : desktop application
    os : windows 7
    sdk : 4.7.4

    This qml source code doesn't work but i find a cpp source code and this works.
    I don't understand what the difference.

    main.cpp
    @#include <QtGui>
    #include "mainwindow.h"

    int main(int argc, char * argv[])
    {
    QApplication app(argc, argv);
    QUrl url = QUrl("http://localhost/demo/Etiquetage/Eleve/vide.html");
    MainWindow *browser = new MainWindow(url);
    browser->show();
    return app.exec();
    }@

    mainwindow.cpp
    @#include <QtGui>
    #include <QtWebKit>
    #include "mainwindow.h"

    MainWindow::MainWindow(const QUrl& url)
    {
    view = new QWebView(this);
    view->load(url);

    setCentralWidget(view);
    

    }
    @

    mainwindow.h
    @
    #include <QtGui>

    class QWebView;
    QT_BEGIN_NAMESPACE
    class QLineEdit;
    QT_END_NAMESPACE

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    MainWindow(const QUrl& url);

    protected slots:

    private:
    QWebView *view;
    };
    @



  • Please try cloning this project: https://projects.developer.nokia.com/blackcatcuttingstudio

    It is on-the-run application that uses the browsing features embedded in the application (QML) to navigate the project wiki and some other pages. Try if this version of the browsing with Qt-Complex framework (that includes the components for embedded web pages) and the pages specific for the navigation can work. The first try is that you can clone it (it should run under windows platform), change one of the url pointed to the pages opened and see is the game is working.

    Else you can send me the html piece and I will see what can be. Is your project opensource?



  • I do not understand the link between that and my application.

    I want to create a small web browser. And drag and drop the following is just a website with javascript source code.

    It's not my site so I can not give. I have no access: D

    After testing I discovered that the QWebView (cpp) and WebView (qml) are differents.
    I think there are parameters, in addition, by default in the QML.
    And I think that the resolution of my problem is here.



  • In this project there is a set of pages that include a webveiw with some browsing features. It works. Test the application, download it and use the QML page in your application if it solve your problem or see how it is done.

    The relation is it.



  • I find the solution.
    I just write " pressGrabTime: 0 "

    @import Qt 4.7
    import QtWebKit 1.0

    Item {
    width: 1024
    height: 550

    WebView {
        id: webView
        url: "http://192.168.2.31/demo/Etiquetage/Eleve/vide.html"
        focus: true
        anchors.fill: parent
        pressGrabTime: 0
    }
    
    Component.onCompleted: {
        //qCApplication.onSetFocus(webView)
    }
    

    }@

    Thx for all

    fx



  • Yes, it is true. I rememebr that grabtime is the delay before the page react to the user interaction, used for zoom-in zoom-out pages in small screens. Great!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.