From 7e7a1d29ad7800b6f3b763f9d230865cd1df441a Mon Sep 17 00:00:00 2001 From: Sergey Starosek Date: Thu, 9 Jan 2014 20:29:33 +0200 Subject: User manual: overlay search panel Make search panel floating so that web view does not resize. This commit also addresses following issues: - search now wraps around document - application icon and window title are now back Signed-off-by: Sergey Starosek Signed-off-by: Dirk Hohndel --- qt-ui/usermanual.cpp | 8 +- qt-ui/usermanual.h | 2 +- qt-ui/usermanual.ui | 263 ++++++++++++++++++++++++--------------------------- 3 files changed, 127 insertions(+), 146 deletions(-) diff --git a/qt-ui/usermanual.cpp b/qt-ui/usermanual.cpp index 56f0fe1c3..cb9b4da50 100644 --- a/qt-ui/usermanual.cpp +++ b/qt-ui/usermanual.cpp @@ -6,7 +6,7 @@ #include "../helpers.h" UserManual::UserManual(QWidget *parent) : - QWidget(parent), + QMainWindow(parent), ui(new Ui::UserManual) { ui->setupUi(this); @@ -21,12 +21,12 @@ UserManual::UserManual(QWidget *parent) : actionHideSearch->setShortcutContext(Qt::WindowShortcut); addAction(actionHideSearch); + setWindowTitle(tr("User Manual")); + ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks); QString searchPath = getSubsurfaceDataPath("Documentation"); if (searchPath != "") { QUrl url(searchPath.append("/user-manual.html")); - ui->webView->setWindowTitle(tr("User Manual")); - ui->webView->setWindowIcon(QIcon(":/subsurface-icon")); ui->webView->setUrl(url); } else { ui->webView->setHtml(tr("Cannot find the Subsurface manual")); @@ -56,7 +56,7 @@ void UserManual::hideSearchPanel() void UserManual::search(QString text, QWebPage::FindFlags flags = 0) { - if (ui->webView->findText(text, flags) || text.length() == 0) { + if (ui->webView->findText(text, QWebPage::FindWrapsAroundDocument|flags) || text.length() == 0) { ui->searchEdit->setStyleSheet(""); } else { ui->searchEdit->setStyleSheet("QLineEdit{background: red;}"); diff --git a/qt-ui/usermanual.h b/qt-ui/usermanual.h index f915f4c1e..6c5860206 100644 --- a/qt-ui/usermanual.h +++ b/qt-ui/usermanual.h @@ -8,7 +8,7 @@ namespace Ui { class UserManual; } -class UserManual : public QWidget +class UserManual : public QMainWindow { Q_OBJECT diff --git a/qt-ui/usermanual.ui b/qt-ui/usermanual.ui index de0784f39..766a0a832 100644 --- a/qt-ui/usermanual.ui +++ b/qt-ui/usermanual.ui @@ -1,7 +1,7 @@ UserManual - + 0 @@ -10,130 +10,126 @@ 599 - - - - - - 0 - 0 - - - - - 230 - 40 - - - - true - - - QFrame::NoFrame - - - - 0 - - - 9 - - - 9 + + + :/subsurface-icon:/subsurface-icon + + + + + + + + 0 + 0 + - - 0 + + + 230 + 40 + - - 0 + + true - - - - - 0 - 0 - - - - - 100 - 0 - - - - - - - - false - - - - - - - - - - - true - - - - - - - false - - - - 0 - 0 - - - - - - - - - - - - true - - - - - - - - - - - - - - - true - - - - - - - - - - - 1 - 1 - - - - - + + + 0 + + + 9 + + + 9 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + + + + false + + + + + + + + + + + true + + + + + + + false + + + + 0 + 0 + + + + + + + + + + + + true + + + + + + + + + + + + + + + true + + + + + + + + + + + @@ -143,23 +139,8 @@
qwebview.h
- - - - findClose - clicked() - searchPanel - hide() - - - 261 - 568 - - - 192 - 554 - - - - + + + +
-- cgit v1.2.3-70-g09d2