Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPrinterInfo::availablePrinterNames() returns empty list
Forum Updated to NodeBB v4.3 + New Features

QPrinterInfo::availablePrinterNames() returns empty list

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 228 Views
  • 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.
  • H Offline
    H Offline
    hexaden
    wrote on last edited by
    #1

    QPrinterInfo::availablePrinterNames() returns empty list on linux with libcups2-dev installed. Qt is built with conan recipe, and I assume cups is enabled (how do I even check that - it's hard to find anything relatable to my problem). One of the solution I found is "enable cups support, recompile Qt with it, then it sees printers", but in my case that didn't work. With "it doesn't work" I mean QT_NO_CUPS macros is defined, and all code that touches cups library is thrown away from sources with that macros (so I assume problem is with Qt build, not the project build).

    Printers are visible in all other programs on that system, and cups is enabled (web interface is running and showing all printers).
    I can link cups library to my project and use its functions to get printers names in exactly same spot where qt fails to see.

    TLDR: how to check if cups library is added/enabled in Qt? How do I enable it?

    Qt 5.15.2, built with conan + cmake, project also is built with conan+cmake.

    Christian EhrlicherC 1 Reply Last reply
    0
    • H hexaden

      QPrinterInfo::availablePrinterNames() returns empty list on linux with libcups2-dev installed. Qt is built with conan recipe, and I assume cups is enabled (how do I even check that - it's hard to find anything relatable to my problem). One of the solution I found is "enable cups support, recompile Qt with it, then it sees printers", but in my case that didn't work. With "it doesn't work" I mean QT_NO_CUPS macros is defined, and all code that touches cups library is thrown away from sources with that macros (so I assume problem is with Qt build, not the project build).

      Printers are visible in all other programs on that system, and cups is enabled (web interface is running and showing all printers).
      I can link cups library to my project and use its functions to get printers names in exactly same spot where qt fails to see.

      TLDR: how to check if cups library is added/enabled in Qt? How do I enable it?

      Qt 5.15.2, built with conan + cmake, project also is built with conan+cmake.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @hexaden said in QPrinterInfo::availablePrinterNames() returns empty list:

      How do I enable it?

      Install the relevant cups development packages and see what configure is telling you about cups.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      H 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        @hexaden said in QPrinterInfo::availablePrinterNames() returns empty list:

        How do I enable it?

        Install the relevant cups development packages and see what configure is telling you about cups.

        H Offline
        H Offline
        hexaden
        wrote on last edited by
        #3

        @Christian-Ehrlicher is absence of QT_NO_CUPS enough to assume libcups now enabled and usable in Qt? Right now it seems like I have it enabled, but printer names list is still empty.

        jsulmJ 1 Reply Last reply
        0
        • H hexaden

          @Christian-Ehrlicher is absence of QT_NO_CUPS enough to assume libcups now enabled and usable in Qt? Right now it seems like I have it enabled, but printer names list is still empty.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @hexaden said in QPrinterInfo::availablePrinterNames() returns empty list:

          is absence of QT_NO_CUPS enough to assume libcups now enabled and usable in Qt?

          No. You need to rebuild Qt. When you call configure script you will see whether cups is enabled or not and if not you can check in configure log file why it was not enabled (or use -v parameter when you call configure).

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          H 1 Reply Last reply
          1
          • jsulmJ jsulm

            @hexaden said in QPrinterInfo::availablePrinterNames() returns empty list:

            is absence of QT_NO_CUPS enough to assume libcups now enabled and usable in Qt?

            No. You need to rebuild Qt. When you call configure script you will see whether cups is enabled or not and if not you can check in configure log file why it was not enabled (or use -v parameter when you call configure).

            H Offline
            H Offline
            hexaden
            wrote on last edited by
            #5

            @jsulm Do I need to have -cups (or something like that) in qt configure command?

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Just run configure, read the output if cups was found. If not, install the development packages. Where is the problem here?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              H 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                Just run configure, read the output if cups was found. If not, install the development packages. Where is the problem here?

                H Offline
                H Offline
                hexaden
                wrote on last edited by hexaden
                #7

                @Christian-Ehrlicher cups is found, I see it building printer support plugins. My problem is that printers list in my app is still empty. Right now I found out it might be packaging problem (I assume there must be MyApp/plugins/printsupport/something, which I don't have right now).
                Edit: I did rebuilt Qt already with libcups2-dev installed, sorry for misunderstanding (I did that after first answer).

                1 Reply Last reply
                0

                • Login

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