Results 1 to 3 of 3

Thread: Model over the network

  1. #1
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Model over the network

    Hey @all,

    is there a way to transport a model over the network? For Example: I've a client which are connected with a server (QTcpServer), this server is connected to a database.

    Now i would like to use a QSqlQueryModel or similar in my client, but the problem now is that the client hasn't direct access to the database, the clients only have the connection to the server.

    Hope someone can understood what I mean and could help me
    Best Regards

    NoRulez

  2. #2
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Model over the network

    Only as an idea. As you said, derive QSqlQueryModel or similar, the one you need.Then, you have to implement a protocol between client and server, so you can "proxy" calls between them.

    A method might look like this ( as an example ) :

    Qt Code:
    1. int MyClientModel::rowCount ( void ) const
    2. {
    3. // Call to TCP Server
    4. return myRemoteServerManager.requestRowCount ( myID );
    5. }
    To copy to clipboard, switch view to plain text mode 

    myRemoteServerManager is an object that wraps the implementation of interchange protocol.

    myID is used to allow more than one connection for the same server with different models attached at the same time.

    On server's side, you can derive also the same model, but simply adding the ID ( to search it easily ), and the TCP server must proxy the calls for client to the corrsponding server's model.

    I don't know if it's a clear explanation or it's confusing... But the basic idea is : you have to wrap every call to the server's model.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Model over the network

    You have to cache as much as possible. Otherwise it would become very slow.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. hierarchical model in a flat view
    By gniking in forum Qt Programming
    Replies: 4
    Last Post: 10th November 2009, 20:17
  2. Replies: 1
    Last Post: 3rd June 2009, 19:08
  3. Model / Threading Advice
    By tntcoda in forum Qt Programming
    Replies: 6
    Last Post: 19th November 2008, 14:02
  4. Custom Model Advice Requested
    By mclark in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2008, 16:26
  5. Model Choices review/questions
    By ucntcme in forum Qt Programming
    Replies: 1
    Last Post: 16th September 2007, 21:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.