Commit 1dd49b8e authored by bonnell's avatar bonnell

Fixed print support on Windows: ensure Qt's printsupport plugin is installed.

Re-enable QvisGUIApplication::PrintWindow for Qt 5.
This partially resolves #2911.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@31489 18c085ea-50e0-402c-830e-de6fd14e8384
parent acba9786
......@@ -223,14 +223,22 @@ if(NOT VISIT_QT_SKIP_INSTALL)
if (WIN32)
install(DIRECTORY ${VISIT_QT_DIR}/plugins/platforms
DESTINATION ${VISIT_INSTALLED_VERSION_BIN}/qtplugins)
install(DIRECTORY ${VISIT_QT_DIR}/plugins/printsupport
DESTINATION ${VISIT_INSTALLED_VERSION_BIN}/qtplugins)
# We also need the platforms and the qt.conf in the build dir.
# We also need the platforms, print support and qt.conf in the build dir.
file(COPY ${VISIT_QT_DIR}/plugins/platforms
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ThirdParty/qtplugins
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ
)
file(COPY ${VISIT_QT_DIR}/plugins/printsupport
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ThirdParty/qtplugins
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ
)
foreach(CFG ${CMAKE_CONFIGURATION_TYPES})
file(WRITE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CFG}/qt.conf
"[Paths]\nPlugins=../ThirdParty/qtplugins\n")
......
......@@ -6902,7 +6902,6 @@ void
QvisGUIApplication::PrintWindow()
{
PrinterAttributes *p = GetViewerState()->GetPrinterAttributes();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#if (defined(Q_WS_MACX) || defined(Q_OS_MAC)) && !defined(VISIT_MAC_NO_CARBON)
//
// If we're on MacOS X and the Mac application style is being used, manage
......@@ -7109,7 +7108,6 @@ QvisGUIApplication::PrintWindow()
#if (defined(Q_WS_MACX) || defined(Q_OS_MAC)) && !defined(VISIT_MAC_NO_CARBON)
}
#endif
#endif
}
// ****************************************************************************
......@@ -7187,6 +7185,9 @@ QPrinterToPrinterAttributes(QPrinter *printer, PrinterAttributes *p)
// Brad Whitlock, Mon May 24 13:42:17 PDT 2010
// Only allow valid printer names.
//
// Kathleen Biagas, Tues Sep 12 10:27:13 MST 2017
// Add less expensive call to availablePrinterNames for Qt version >= 5.3.
//
// ****************************************************************************
static void
......@@ -7194,6 +7195,7 @@ PrinterAttributesToQPrinter(PrinterAttributes *p, QPrinter *printer)
{
// Only set the printer name if it is a valid name.
QString printerName(p->GetPrinterName().c_str());
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
QList<QPrinterInfo> availablePrinters(QPrinterInfo::availablePrinters());
for(int i = 0; i < availablePrinters.size(); ++i)
{
......@@ -7203,6 +7205,18 @@ PrinterAttributesToQPrinter(PrinterAttributes *p, QPrinter *printer)
break;
}
}
#else
// less expensive call introduced in Qt 5.3
QStringList availablePrinters(QPrinterInfo::availablePrinterNames());
for(int i = 0; i < availablePrinters.size(); ++i)
{
if(availablePrinters[i] == printerName)
{
printer->setPrinterName(printerName);
break;
}
}
#endif
printer->setPrintProgram(p->GetPrintProgram().c_str());
printer->setCreator(p->GetCreator().c_str());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment