Modified Qt GUI to make Qt Help module an optional dependency.

This commit is contained in:
mjbudd77 2021-10-21 19:24:10 -04:00
parent 7d6ea59c5a
commit 607ca6fe29
4 changed files with 21 additions and 3 deletions

View File

@ -12,12 +12,17 @@ else()
set( Qt Qt5 )
endif()
if ( ${QHELP} )
set(QtHelpModule Help)
add_definitions( -D_USE_QHELP )
endif()
if ( ${QT6} )
find_package( Qt6 COMPONENTS Widgets Help OpenGL OpenGLWidgets REQUIRED)
find_package( Qt6 REQUIRED COMPONENTS Widgets OpenGL OpenGLWidgets ${QtHelpModule})
add_definitions( ${Qt6Widgets_DEFINITIONS} ${Qt6Help_DEFINITIONS} ${Qt6OpenGLWidgets_DEFINITIONS} )
include_directories( ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Help_INCLUDE_DIRS} ${Qt6OpenGLWidgets_INCLUDE_DIRS} )
else()
find_package( Qt5 COMPONENTS Widgets OpenGL Help REQUIRED)
find_package( Qt5 REQUIRED COMPONENTS Widgets OpenGL ${QtHelpModule})
add_definitions( ${Qt5Widgets_DEFINITIONS} ${Qt5Help_DEFINITIONS} )
include_directories( ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Help_INCLUDE_DIRS} )
endif()

View File

@ -1862,6 +1862,7 @@ void consoleWin_t::createMainMenu(void)
subMenu->addAction(act);
#if defined(WIN32) || defined(_USE_QHELP)
// Help -> Documentation Offline
act = new QAction(tr("&Local"), this);
act->setStatusTip(tr("Documentation"));
@ -1869,6 +1870,7 @@ void consoleWin_t::createMainMenu(void)
connect(act, SIGNAL(triggered()), this, SLOT(openOfflineDocs(void)) );
subMenu->addAction(act);
#endif
};
//---------------------------------------------------------------------------
int consoleWin_t::loadVideoDriver( int driverId )

View File

@ -28,9 +28,12 @@
#include <QMenu>
#include <QAction>
#include <QSettings>
#ifdef _USE_QHELP
#include <QHelpEngine>
#include <QHelpIndexModel>
#include <QHelpContentWidget>
#endif
#include "driver.h"
#include "Qt/HelpPages.h"
@ -111,9 +114,11 @@ void consoleWin_t::OpenHelpWindow(std::string subpage)
}
//helpWin = forkHelpFileViewer( helpFileViewer.c_str(), helpFileName.c_str() );
#ifdef _USE_QHELP
HelpDialog *win = new HelpDialog( helpFileName.c_str(), this);
win->show();
#endif
#endif
}
@ -230,6 +235,7 @@ std::string consoleWin_t::findHelpFile(void)
//}
//#endif
#ifdef _USE_QHELP
//-----------------------------------------------------------------------------------------------
//--- Help Page Dialog
//-----------------------------------------------------------------------------------------------
@ -392,3 +398,4 @@ QVariant HelpBrowser::loadResource(int type, const QUrl &name)
return QTextBrowser::loadResource(type, name);
}
//-----------------------------------------------------------------------------------------------
#endif // _USE_QHELP

View File

@ -5,8 +5,10 @@
#include <QAction>
#include <QSplitter>
#include <QTabWidget>
#include <QTextBrowser>
#include <QCloseEvent>
#ifdef _USE_QHELP
#include <QTextBrowser>
#include <QHelpEngine>
class HelpBrowser : public QTextBrowser
@ -41,3 +43,5 @@ class HelpDialog : public QDialog
void navBackwardAvailable(bool);
void navForwardAvailable(bool);
};
#endif