Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: Discovery of printers in the network?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to discover no of printers available in yourr network?

    Hey Guys !!
    i am new to qt4.7.2 and i got task to discover no of printers available in your network?
    I have read qt docs and got qprinterinfo class having availableprinter() function but can anyone give me idea about how to use it ? i am working on unix platform.

    Thanks...
    regards ,
    Sumit

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to discover no of printers available in yourr network?

    can anyone give me idea about how to use it ?
    You just call it!
    What is there to explain?
    If you know how to call a function, you know how to use it!
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to discover no of printers available in yourr network?

    hi wiseguy,
    I have searched for programs based on printer but nobody has explain these things properly.I went to Qt
    website but no examples are there.If you have any examples please let us know..
    regards,
    Sumit

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to discover no of printers available in yourr network?

    (my username is high_flyer)
    Again - example for what?
    you have found the correct function to solve your problem, just use it.
    What is your question?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. The following user says thank you to high_flyer for this useful post:

    surwassu (26th May 2011)

  6. #5
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to discover no of printers available in yourr network?

    Hi high_flyer,

    I have written code to show one of the available printer name ,I have used QLineText to show printer name
    but getting error in following part of code:

    Qt Code:
    1. void qprint::give_name_of_printer()
    2.  
    3. {
    4. QPrinterInfo PrinterInfo;
    5. QPrinter *printer=new QPrinter(QPrinter::ScreenResolution);
    6. //line no 33
    7. QList<QPrinterInfo> pinfo;
    8. //line 34
    9. QString str;
    10. pinfo= PrinterInfo.availablePrinters(); // transferring QList into temp list pinfo
    11. str=pinfo.value(1).printerName();//value function will return Qprinterinfo object at 2nd location & that object
    12. // is used get printer name & stored in CString object
    13. Name_edit->setText(str);//This is used to set text to printer name
    14.  
    15. }
    To copy to clipboard, switch view to plain text mode 





    I am getting error as incomplete type and cannot be defined 'class QList<QPrinterInfo>' at line no 33
    can you please help me out...

    Thanks
    Regards,
    Sumit
    Last edited by high_flyer; 25th May 2011 at 14:19. Reason: code tags

  7. #6
    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: How to discover no of printers available in yourr network?

    Did you remember to #include the proper header file?
    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.


  8. The following user says thank you to wysota for this useful post:

    surwassu (26th May 2011)

  9. #7
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to discover no of printers available in yourr network?

    thanks alot........

  10. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to discover no of printers available in yourr network?

    You also don't need to create an instance of QPrinterInfo (line 4) in order to use the static method QPrinterInfo::availablePrinters().

  11. #9
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to discover no of printers available in yourr network?

    You code is fine, it will work, may be you missed to include <QList> file, just add it and any other file which is required, you should have it running.

    Tip:
    when you read the printer name, make sure the list contains the printers on the first hand, else your program will crash
    Qt Code:
    1. ...
    2. str=pinfo.value(1).printerName(); // this is not suggersted;
    3. ...
    4. if(pinfo.count() > n)
    5. str=pinfo.value(n).printerName();// get nth printer name
    6. ...
    To copy to clipboard, switch view to plain text mode 
    remember to post the code in code tags

  12. The following user says thank you to Santosh Reddy for this useful post:

    surwassu (26th May 2011)

  13. #10
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Discovery of printers in the network?

    Hi Guys,

    Is there any API in Qt which will communicate with my print server to discover all printer present in the network???

    The function availablePrinters() is giving me locally configured printer details,But I want list of all printer present in the network on my machine..

    Plz guide me..
    Thank you
    Regards,
    Sumit

  14. #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: Discovery of printers in the network?

    You need to perform the process of service discovery. It differs based on the protocols the printers implement. You can try using zeroonf (http://doc.qt.nokia.com/qq/qq23-bonjour.html)
    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.


  15. #12
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Bonjour service for printer

    Hi guys,

    Can you guys please provide some direction on how I can use Bonjour service in Qt app to discover printer devices on the dedicated printer network?
    I have used http://doc.qt.nokia.com/qq/qq23-bonjour.html link but can't able to understand properly how to proceed...

    can anyone give me good n simple example for this..
    please give me somw guidence ..

    Thank you
    Regards,
    Sumit

  16. #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: Bonjour service for printer

    Please stop multiposting!

    What exactly are you having problems with?
    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.


  17. #14
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bonjour service for printer

    Quote Originally Posted by wysota View Post
    Please stop multiposting!

    What exactly are you having problems with?
    Extreme apologies my friend ! i should not supposed create another thread for same problem ..sorry
    i have already mention my problem in my previous post
    regards,
    sumit

  18. #15
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Bonjour service for printer

    There are examples included in the link. If you do not understand the examples, which part are you having problems with? Saying "can't able to understand" is too vague.

  19. #16
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bonjour service for printer

    Quote Originally Posted by squidge View Post
    There are examples included in the link. If you do not understand the examples, which part are you having problems with? Saying "can't able to understand" is too vague.
    Hi ,
    Good morning to all!

    I have gone through this link http://doc.qt.nokia.com/qq/qq23-bonjour.html (topic:Storing a Bonjour Entry).

    Can anybody tell me why they have use Q_DECLARE_METATYPE(BonjourRecord)?The explaination given by them is not understandable.

    Also why they have use reply domain?what does it mean?what is use of that?

    Please guide me.
    Reagds,
    Sumit

  20. #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: Bonjour service for printer

    Quote Originally Posted by surwassu View Post
    Can anybody tell me why they have use Q_DECLARE_METATYPE(BonjourRecord)?
    Because it allows to store objects of BonjourRecord class into QVariant.

    Also why they have use reply domain?what does it mean?what is use of that?
    Read about how zeroconf works and you'll understand that.
    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.


  21. #18
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bonjour service for printer

    Quote Originally Posted by wysota View Post
    Because it allows to store objects of BonjourRecord class into QVariant.


    Read about how zeroconf works and you'll understand that.
    Hi Master,
    I have gone through that code n downloaded source file it contails three folder .
    Do you have any idea about how to should I proceed to execute it on unix ?
    Thanks.
    Regards,
    Sumit

  22. #19
    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: Bonjour service for printer

    Come on. Read the readme file.
    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.


  23. #20
    Join Date
    May 2011
    Posts
    19
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bonjour service for printer

    Quote Originally Posted by wysota View Post
    Come on. Read the readme file.
    Do you have any idea from where i can get QPrintDialog class's Source code?

Similar Threads

  1. QPrintDialog lists no printers
    By TMan in forum Qt Programming
    Replies: 6
    Last Post: 9th June 2009, 15:33
  2. Discovery correct Language on all OS
    By patrik08 in forum Qt Programming
    Replies: 5
    Last Post: 25th February 2007, 19:27
  3. QSqlField discovery auto_increment int value
    By patrik08 in forum Qt Programming
    Replies: 6
    Last Post: 3rd December 2006, 11:19

Tags for this Thread

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.