QPrinterInfo::availablePrinterNames() returns empty list
-
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.
-
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.
@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.
-
@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.
@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.
-
@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.
@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).
-
@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).
-
Just run configure, read the output if cups was found. If not, install the development packages. Where is the problem here?
-
Just run configure, read the output if cups was found. If not, install the development packages. Where is the problem here?
@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).