Skip to content
Snippets Groups Projects
Commit 2a9ab0da authored by Martyn Gigg's avatar Martyn Gigg Committed by GitHub
Browse files

Merge pull request #19528 from mantidproject/19527_qthelp_printbutton

Print button in MantidPlot help
parents 668f2b49 e50bd451
No related branches found
No related tags found
No related merge requests found
......@@ -58,11 +58,14 @@ public slots:
virtual void showPage(const QString &url);
virtual void showPage(const QUrl &url);
/// Tires to locate a file name index.html in the given namespace and then
/// Tries to locate a file name index.html in the given namespace and then
/// shows that page.
virtual void showHomePage(const QString &namespace_name);
virtual void showHomePage();
/// Prints the current open page
virtual void printPage();
signals:
/// fired to relay warning messages from the help system.
void helpWarnings(const QString &);
......
......@@ -42,6 +42,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPointer>
#include <QPrinter>
#include <QPrintDialog>
#include <QPushButton>
#include <QTextBrowser>
#include <QTextStream>
......@@ -196,6 +198,8 @@ pqHelpWindow::pqHelpWindow(
// add a navigation toolbar
QToolBar *navigation = new QToolBar("Navigation");
QPushButton *home = new QPushButton("Home");
QPushButton *print = new QPushButton("Print...");
print->setToolTip("Print the current page");
m_forward = new QToolButton();
m_forward->setArrowType(Qt::RightArrow);
......@@ -210,6 +214,7 @@ pqHelpWindow::pqHelpWindow(
m_backward->setAutoRaise(true);
navigation->addWidget(home);
navigation->addWidget(print);
navigation->addWidget(m_backward);
navigation->addWidget(m_forward);
navigation->setAllowedAreas(Qt::TopToolBarArea | Qt::RightToolBarArea);
......@@ -258,6 +263,7 @@ pqHelpWindow::pqHelpWindow(
// connect the navigation buttons
connect(home, SIGNAL(clicked()), this, SLOT(showHomePage()));
connect(print, SIGNAL(clicked()), this, SLOT(printPage()));
connect(m_forward, SIGNAL(clicked()), m_browser, SLOT(forward()));
connect(m_backward, SIGNAL(clicked()), m_browser, SLOT(back()));
connect(m_forward, SIGNAL(clicked()), this, SLOT(updateNavButtons()));
......@@ -319,6 +325,16 @@ void pqHelpWindow::showPage(const QUrl& url)
}
}
//-----------------------------------------------------------------------------
void pqHelpWindow::printPage() {
QPrinter printer;
QPrintDialog dialog(&printer, this);
dialog.setWindowTitle(tr("Print Document"));
if (dialog.exec() != QDialog::Accepted)
return;
m_browser->print(&printer);
}
//-----------------------------------------------------------------------------
void pqHelpWindow::updateNavButtons()
{
......
......@@ -19,6 +19,7 @@ User Interface
- MantidPlot now respects the system scaling on high-resolution displays. All icons and bitmaps will now be sized
appropriately rather than being too small to be usable (Windows only).
- A new Print button has been added to the MantidPlot help window.
- Masked bins are greyed out in the table view of the workspaces (except for EventWorkspaces):
.. figure:: ../../images/maskedbins.jpg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment