Results 1 to 17 of 17

Thread: load pixmap from another host

  1. #1
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default load pixmap from another host

    Hi everybody,

    QT: 4.1.3
    COMPILER: Mingw
    OS: WinXP Pro

    My app is able to show and change a pixmap on a QLabel by changing the selection on a Q3ListView. On changing the selection i call this function to show the pixmap:

    Qt Code:
    1. connect(ui.listView, SIGNAL(selectionChanged ()), this, SLOT(getPicA()));
    2. .
    3. .
    4. .
    5. void MainWindow::getPicA()
    6. {
    7.  
    8. ui.label->setPixmap(QPixmap(( ui.listView->currentItem() )->text( 4 )));
    9. }
    To copy to clipboard, switch view to plain text mode 

    Now my app is runing on another machine. The Picture are saved on the server. (//pcps391/transfer/images/a.jpg).

    If i run my app from the server i can see the picture, but if i run my app from another machine i cant see the pic.
    ui.listView->currentItem() )->text( 4 ) = "//pcps391/transfer/images/a.jpg".

    If i change a item on my Q3ListView i can feel that the app is slower


    Can somebody see the problem?
    Think DigitalGasoline

  2. #2
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: load pixmap from another host

    Have you tried \\pcps391\transfer\images\a.jpg instead?
    ui.listView->currentItem() )->text( 4 ) = "\\\\pcps391\\transfer\\images\\a.jpg"
    Software Engineer



  3. #3
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    Hi gFunk,

    Itried "\\pcps391\transfer\images\a.jpg" and "\\\\pcps391\\transfer\\images\\a.jpg" but it not works.

    If i run my app from the server i can see the picture, but if i run my app from another machine i cant see the pic by using "\\pcps391\transfer\images\a.jpg"

    What could i try?
    Think DigitalGasoline

  4. #4
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: load pixmap from another host

    Maybe the UNC filenaming isn't working inside Qt? Perhaps try mapping the folder to a drive, and then accessing the file, ie, map \\pcps391\transfer to z:, then access it as z:\images\a.jpg


    Or, try copying that file to the machine so that it is local, make sure it isn't a machine-specific problem.
    Software Engineer



  5. #5
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    hi gFunk,

    I map it to z:\ on the server and on the client..

    If i run the app from the server i can see the pic, but if i run it from the client i am not able to see the pic..

    I cant use the copy solution, because my second step will be to start mp3 files on the client (the files are saved on the server) and i can not copy everytime a file localy on the client
    I can not understand why is not working..
    Have you another idea??
    Think DigitalGasoline

  6. #6
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    Hi,

    I try again to use : "//pcps391/transfer/images/a.jpg" and check if the file is readable like this:

    Qt Code:
    1. QFileInfo file(( ui.listView->currentItem() )->text( 4 ));
    2. if(file.isReadable() == true)
    3. {
    4. QMessageBox::information(this, "", ( "true"));
    5. ui.label->setPixmap(QPixmap(( ui.listView->currentItem() )->text( 4 )));
    6. }
    To copy to clipboard, switch view to plain text mode 

    THE CLIENT RETURN TRUE, so the client can read the file but are not able to show it..
    The same problem i have by trying to play a sound that are saved on the server and execute on the client..
    Have i a solution on qt4?
    Think DigitalGasoline

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

    Default Re: load pixmap from another host

    Try copying the pixmap file to a temporary storage on the client before making a pixmap out of it. Maybe there is some bug/feature in QPixmap constructor which prevents it from working on samba shares. You won't lose any performance as the file would have to be copied to the client anyway before creating the pixmap.

  8. #8
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    Hi wysota,

    How i wrote..I cant use this solution because my seconde step will be to play mp3 files on the client (the mp3 files are saved on the server).
    I cant copy every file on the client if i want to play a playlist for example..
    I think that i have a problem now..

    Can you see my problem?
    Think DigitalGasoline

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

    Default Re: load pixmap from another host

    Quote Originally Posted by raphaelf
    Hi wysota,

    How i wrote..I cant use this solution because my seconde step will be to play mp3 files on the client (the mp3 files are saved on the server).
    I cant copy every file on the client if i want to play a playlist for example..
    I think that i have a problem now..

    Can you see my problem?
    If you want to access them, they have to be transfered to the client over the network anyway. You can't just "magically" play them without transfering data between hosts. So the only difference is that copying to a temporary file requires a bit of disk (or ramdisk) space on the client machine. The gain, on the other hand, is that each file will be transfered only once, no matter how many times you want to play it. As for MP3, I doubt you'll be using Qt for that directly, so maybe playing over network will work just fine with the method you choose. As I said before, the problem might be in the QPixmap constructor.

  10. #10
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    Hi wysota,

    I tryed to play a song on the client and it works over the network. The song is saved on the server and i could listen on the client..

    Why qpixmap has this bug

    Could i use another QTQ Element for showing jpg files over the network?
    I need just to show a picture by selecting a album..
    Think DigitalGasoline

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

    Default Re: load pixmap from another host

    Quote Originally Posted by raphaelf
    Why qpixmap has this bug
    Hard to say. The bug is probably not in QPixmap but in QImageLoader.

    Could i use another QTQ Element for showing jpg files over the network?
    I need just to show a picture by selecting a album..
    You can always subclass QImageLoader (if it is the component causing the faulty behaviour) and fix the bug.

  12. #12
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    Hi Wysota,
    I dont know how to fix it wysota, i have not experience for that
    I have just a litle experience on QT3 and now Qt4
    Now i have really a problem..Because i need a solution for my diploma and i have not a lot of time to fix this bug..
    Do you mean QImageReader?I cant find QImageLoader

    My idea was to save everything on a server (pics and mp3 files) and install my app on 5 clients that are able to get pics and mp3 files from the server and play it..
    I can play mp3 that are saved on the server without problems on the client..
    Now i just need a solution to show album pics on the client that are saved on the server..
    I have a database and a complicated structure behind, so it will be very complex to copy this pics everytime on the client and show it..


    Have you another idea how to show this pics on the client via network?
    Think DigitalGasoline

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

    Default Re: load pixmap from another host

    Quote Originally Posted by raphaelf
    Have you another idea how to show this pics on the client via network?
    Open the image as a file, read its contents and construct the pixmap using QPixmap::loadFromData().

  14. #14
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    Hi wisota,
    thanks..I try to copy the picture localy and show it..it works fine..
    I think it will be not easy to read content and loadfromData...do you know if i could find a example for that?
    Its important that it works..
    of course if i could open directly from the server and show it, it could be most beautifull..


    thanks to all
    Think DigitalGasoline

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

    Default Re: load pixmap from another host

    Quote Originally Posted by raphaelf
    I think it will be not easy to read content and loadfromData...
    Why so? What's hard in that?

    do you know if i could find a example for that?
    Do you really need an example for using a single function call? Here is a pseudo-algo:
    1. Open a remote file
    2. Use QFile::readAll() to read contents into a byte array
    3. create an empty QPixmap object
    4. fill the pixmap using loadFromData from the byte array
    5. Display your pixmap

  16. #16
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: load pixmap from another host

    Hi wisota,

    Ok i will try
    I couldnt find QFile::readAll(). Did you mean QFile:pen ??
    Think DigitalGasoline

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

    Default Re: load pixmap from another host

    Quote Originally Posted by raphaelf
    Hi wisota,

    Ok i will try
    I couldnt find QFile::readAll(). Did you mean QFile:pen ??
    No, I meant File::readAll(). It's inherited from QIODevice (see QIODevice::readAll()).

Similar Threads

  1. Which version should I work on i686 host for arm target?
    By sliawati in forum Installation and Deployment
    Replies: 4
    Last Post: 11th August 2006, 09:44
  2. Invalid pixmap
    By munna in forum Newbie
    Replies: 2
    Last Post: 8th June 2006, 08:00
  3. Paint XP radio button to pixmap
    By Ben.Hines in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2006, 21:15
  4. Changing pixmap in PixmapLabel
    By bullerwj in forum Qt Tools
    Replies: 1
    Last Post: 11th April 2006, 22:28
  5. Replies: 4
    Last Post: 7th March 2006, 08:52

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
  •  
Qt is a trademark of The Qt Company.