×

Discussion Board

Results 1 to 11 of 11

Thread: Use Qt Mobility

  1. #1
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Use Qt Mobility

    Hi, i installed this http://www.forum.nokia.com/info/sw.n...ia_Qt_SDK.html and for now it's ok but now i need to use qt mobility for that: http://wiki.forum.nokia.com/index.ph...nnection_in_Qt and i can't make it work. Can anyone take a look? I attache the project. Qt Mobility install with qt nokia sdk?

    http://dl.dropbox.com/u/6416035/session2.zip

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Use Qt Mobility

    hello metRo_

    it will be great if you let the discussion board know what are the errors you are facing, going through code may take time and all will not like so just compile the application and let us know what are the errors. :-)

    Regards,

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Use Qt Mobility

    Qt Mobility is part of Nokia Qt SDK if that was a question.

  4. #4
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: Use Qt Mobility

    Quote Originally Posted by divanov View Post
    Qt Mobility is part of Nokia Qt SDK if that was a question.
    Thanks

    qtsnippets.h
    Code:
    #ifndef QTSNIPPETS_H
    #define QTSNIPPETS_H
    
    #include <QMainWindow>
    #include <QtGui/QMainWindow>
    #include <QPointer>
    #include <QNetworkInterface> // have to be "QT += network" in pro file
    #include <QtNetwork>
    
    // QtMobility
    #include <qnetworkconfigmanager.h>
    #include <qnetworksession.h>
    QTM_USE_NAMESPACE
    
    class qtSnippets : public QMainWindow
    {
        Q_OBJECT
    public:
        qtSnippets(QWidget *parent = 0);
            ~qtSnippets();
    
    private slots:
        // Open network connection
        void openConnection();
    
    private:
        // Session of the connection
        QPointer<QNetworkSession> m_session;
    };
    
    #endif // QTSNIPPETS_H
    qtsnippets.cpp
    Code:
    #include "qtsnippets.h"
    
    #include <QTimer>
    #include <QMessageBox>
    
    qtSnippets::qtSnippets(QWidget *parent)
        : QMainWindow(parent)
    {
        // Let application to startup fully and then
        // open connection to the network
        QMessageBox::information(this,"LOL","loool");
    
        QTimer::singleShot(0, this, SLOT(openConnection()));
    }
    
    qtSnippets::~qtSnippets()
    {
        // Remeber to close connection
        if (m_session)
            m_session->close();
    }
    
    void qtSnippets::openConnection()
    {
        // Set Internet Access Point
        QNetworkConfigurationManager manager;
    
        const bool canStartIAP = (manager.capabilities()
            & QNetworkConfigurationManager::CanStartAndStopInterfaces);
    
            // Is there default access point, use it
        QNetworkConfiguration cfg = manager.defaultConfiguration();
        if (!cfg.isValid() || !canStartIAP) {
            // Available Access Points not found
            QMessageBox::information(this,"Bearer","Available Access Points not found");
            return;
        }
    
        // Open session
        m_session = new QNetworkSession(cfg);
        m_session->open();
        // Waits for session to be open and continues after that
        m_session->waitForOpened();
    
        // Show interface name to the user
        QNetworkInterface iff = m_session->interface();
        QMessageBox::information(this,"Network opened",iff.humanReadableName());
    }
    Error if i debug to desktop:
    In file included from ..\session1\mainwindow.cpp:2:
    ..\session1\/qtsnippets.h:11:35: error: qnetworkconfigmanager.h: No such file or directory
    ..\session1\/qtsnippets.h:12:29: error: qnetworksession.h: No such file or directory
    In file included from ..\session1\mainwindow.cpp:2:
    ..\session1\/qtsnippets.h:15: error: expected constructor, destructor, or type conversion before 'class'
    mingw32-make[1]: Leaving directory `C:/Users/Ze/Documents/Qt/session1-build-desktop'
    mingw32-make: Leaving directory `C:/Users/Ze/Documents/Qt/session1-build-desktop'
    mingw32-make[1]: *** [debug/mainwindow.o] Error 1
    mingw32-make: *** [debug] Error 2
    The process "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" exited with code %2.
    Error while building project session1 (target: Desktop)
    When executing build step 'Make'
    If i debug to phone it's ok, the aplication load but doesn't do nothing.

    And in Qt Creator how can i do to Qt Creator reconize it:
    #include <qnetworkconfigmanager.h>
    #include <qnetworksession.h>
    QTM_USE_NAMESPACE
    It compile but editor underline it and say: no such file or directory
    Last edited by metRo_; 2010-09-18 at 13:47.

  5. #5
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Use Qt Mobility

    Qt Mobility is not available on desktop (not really true for Linux desktops). You should include QNetworkConfigManager and QNetworkSession as it's more elegant way of doing it. Make sure that these file exist in directory, where Nokia Qt SDK is installed. What is your desktop platform?

  6. #6
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: Use Qt Mobility

    Windows vista, i can find the files in Nokia Qt SDK folder

    How i tell qt where it "#include <QNetworkConfigurationManager>" is?
    Last edited by metRo_; 2010-09-18 at 16:02.

  7. #7
    Nokia Developer Champion
    Join Date
    Sep 2007
    Location
    Bhavnagar
    Posts
    928

    Re: Use Qt Mobility

    Have you added network module in to your .pro file

    Add this line into your .pro file
    QT += network

    hope this may be useful for you.
    Jajal Mehul

  8. #8
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: Use Qt Mobility

    Quote Originally Posted by james1980 View Post
    Have you added network module in to your .pro file

    Add this line into your .pro file
    QT += network

    hope this may be useful for you.
    i already added, thanks

  9. #9
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Use Qt Mobility

    QNetworkConfigurationManager is part of Qt Mobility Bearer API so
    you should add
    CONFIG += mobility
    MOBILITY = bearer
    However, it was already mentioned in the Wiki example.

  10. #10
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: Use Qt Mobility

    Quote Originally Posted by divanov View Post
    QNetworkConfigurationManager is part of Qt Mobility Bearer API so
    you should add
    CONFIG += mobility
    MOBILITY = bearer
    However, it was already mentioned in the Wiki example.
    i already added that too. I'm trying to post the erros in another topic but my post was waintig for moderation :s I sent you divanov 2 prvate messages. I'll post here the errors:
    http://img826.imageshack.us/img826/2525/qtmobi.jpg

  11. #11
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Use Qt Mobility

    Rather than a screen shot of "issues", click on "Compile output" and copy/paste the log from there (though don't paste the whole thing, just relevant sections).

Similar Threads

  1. Qt Creator code completion not working with Qt Mobility for Symbian
    By ceefour in forum [Archived] Qt Mobility Project
    Replies: 4
    Last Post: 2011-09-10, 05:02
  2. Replies: 35
    Last Post: 2010-09-13, 12:05
  3. Qt Mobility with Qt Creator - QTSDK-98 doesn't fix it for me
    By pzman in forum [Archived] Qt SDKs and Tools
    Replies: 2
    Last Post: 2010-09-10, 09:52
  4. Replies: 3
    Last Post: 2010-06-30, 01:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×