Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. CUPS for WebAssembly
Qt 6.11 is out! See what's new in the release blog

CUPS for WebAssembly

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
2 Posts 2 Posters 695 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wild-linkle
    wrote on last edited by
    #1

    Hi, I'm new to QT and I'm trying to run the CUPS API in my QT app and compile it with WebAssembly. However, it seems that an exception "getpwnam: TODO" was thrown.

    I tried to run this code below in 5.14.1 but it seems to fail after QPrinterInfo::availablePrinters() was called.

        int count = 0;
        qDebug() << "before QPrinterInfo";
        QList<QPrinterInfo> info_list = QPrinterInfo::availablePrinters();
        qDebug() << "after QPrinterInfo";
        foreach ( QPrinterInfo info, info_list )
        {
            count++;
            qDebug()<< "Printer_"<< count<< ": " << info.printerName() << "State: " << info.state();
    
            if(info.printerName() == "YOUR_PRINTER_NAME")
            {
                if (info.state() == 0)
                    qDebug()<< "Printer Idle";
                else if (info.state() == 1)
                    qDebug()<< "Printer Active";
                else if (info.state() == 2)
                    qDebug()<< "Printer Aborted";
                else if (info.state() == 3)
                    qDebug()<< "Printer Error";
                else
                    qDebug()<< "Printer Undefined Error";
            }
        }
    

    I also tried the code provided by the cups API documentation but failed after calling the function cupsGetDests

    cups_dest_t *dests;
    int num_dests = cupsGetDests(&dests); // exception getpwnam: TODO is thrown 
    

    Is there a way to determine the number of printers installed and access their corresponding information?

    1 Reply Last reply
    0
    • lorn.potterL Offline
      lorn.potterL Offline
      lorn.potter
      wrote on last edited by
      #2

      @wild-linkle said in CUPS for WebAssembly:

      getpwnam

      Wasm lives in the same sandbox as javascript. Accessing printers and other hardware is not supported at this time.

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved