Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
6e0544a9
Commit
6e0544a9
authored
14 years ago
by
kh1
Browse files
Options
Downloads
Patches
Plain Diff
Sync against Assistant
Reviewed-by: ck
parent
3809327a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/shared/help/contentwindow.cpp
+14
-13
14 additions, 13 deletions
src/shared/help/contentwindow.cpp
src/shared/help/contentwindow.h
+0
-1
0 additions, 1 deletion
src/shared/help/contentwindow.h
src/shared/help/indexwindow.cpp
+3
-2
3 additions, 2 deletions
src/shared/help/indexwindow.cpp
with
17 additions
and
16 deletions
src/shared/help/contentwindow.cpp
+
14
−
13
View file @
6e0544a9
...
...
@@ -29,7 +29,9 @@
#include
"contentwindow.h"
#include
"centralwidget.h"
#include
"helpmanager.h"
#include
"helpviewer.h"
#include
"openpagesmanager.h"
#include
<QtGui/QLayout>
...
...
@@ -102,18 +104,21 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
if
(
m_contentWidget
&&
o
==
m_contentWidget
->
viewport
()
&&
e
->
type
()
==
QEvent
::
MouseButtonRelease
)
{
QMouseEvent
*
me
=
static_cast
<
QMouseEvent
*>
(
e
);
QModelIndex
index
=
m_contentWidget
->
indexAt
(
me
->
pos
());
QItemSelectionModel
*
sm
=
m_contentWidget
->
selectionModel
();
if
(
!
me
||
!
sm
)
return
QWidget
::
eventFilter
(
o
,
e
);
Qt
::
MouseButtons
button
=
me
->
button
();
if
(
index
.
isValid
()
&&
(
sm
&&
sm
->
isSelected
(
index
)))
{
const
QModelIndex
&
index
=
m_contentWidget
->
indexAt
(
me
->
pos
());
if
(
index
.
isValid
()
&&
sm
->
isSelected
(
index
))
{
if
((
button
==
Qt
::
LeftButton
&&
(
me
->
modifiers
()
&
Qt
::
ControlModifier
))
||
(
button
==
Qt
::
MidButton
))
{
QHelpContentModel
*
contentModel
=
qobject_cast
<
QHelpContentModel
*>
(
m_contentWidget
->
model
());
if
(
contentModel
)
{
QHelpContentItem
*
itm
=
contentModel
->
contentItemAt
(
index
);
if
(
itm
&&
!
isPdfFile
(
itm
))
if
(
itm
&&
HelpViewer
::
canOpenPage
(
itm
->
url
().
path
()
))
OpenPagesManager
::
instance
().
createPage
(
itm
->
url
());
}
}
else
if
(
button
==
Qt
::
LeftButton
)
{
...
...
@@ -137,7 +142,7 @@ void ContentWindow::showContextMenu(const QPoint &pos)
QMenu
menu
;
QAction
*
curTab
=
menu
.
addAction
(
tr
(
"Open Link"
));
QAction
*
newTab
=
menu
.
addAction
(
tr
(
"Open Link as New Page"
));
if
(
isPdfFile
(
itm
))
if
(
!
HelpViewer
::
canOpenPage
(
itm
->
url
().
path
()
))
newTab
->
setEnabled
(
false
);
menu
.
move
(
m_contentWidget
->
mapToGlobal
(
pos
));
...
...
@@ -155,14 +160,10 @@ void ContentWindow::itemClicked(const QModelIndex &index)
qobject_cast
<
QHelpContentModel
*>
(
m_contentWidget
->
model
());
if
(
contentModel
)
{
QHelpContentItem
*
itm
=
contentModel
->
contentItemAt
(
index
);
if
(
itm
)
emit
linkActivated
(
itm
->
url
());
if
(
QHelpContentItem
*
itm
=
contentModel
->
contentItemAt
(
index
))
{
const
QUrl
&
url
=
itm
->
url
();
if
(
url
!=
CentralWidget
::
instance
()
->
currentHelpViewer
()
->
source
())
emit
linkActivated
(
itm
->
url
());
}
}
}
bool
ContentWindow
::
isPdfFile
(
QHelpContentItem
*
item
)
const
{
const
QString
&
path
=
item
->
url
().
path
();
return
path
.
endsWith
(
QLatin1String
(
".pdf"
),
Qt
::
CaseInsensitive
);
}
This diff is collapsed.
Click to expand it.
src/shared/help/contentwindow.h
+
0
−
1
View file @
6e0544a9
...
...
@@ -62,7 +62,6 @@ private slots:
private:
bool
eventFilter
(
QObject
*
o
,
QEvent
*
e
);
bool
isPdfFile
(
QHelpContentItem
*
item
)
const
;
QHelpContentWidget
*
m_contentWidget
;
int
m_expandDepth
;
...
...
This diff is collapsed.
Click to expand it.
src/shared/help/indexwindow.cpp
+
3
−
2
View file @
6e0544a9
...
...
@@ -30,6 +30,7 @@
#include
"centralwidget.h"
#include
"helpmanager.h"
#include
"helpviewer.h"
#include
"indexwindow.h"
#include
"openpagesmanager.h"
#include
"topicchooser.h"
...
...
@@ -209,8 +210,8 @@ void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
return
;
}
if
(
url
.
path
().
endsWith
(
QLatin1String
(
".pdf"
),
Qt
::
CaseInsensitive
))
Help
::
Internal
::
CentralWidget
::
instance
()
->
setSource
(
url
);
if
(
!
HelpViewer
::
canOpenPage
(
url
.
path
()
))
CentralWidget
::
instance
()
->
setSource
(
url
);
else
OpenPagesManager
::
instance
().
createPage
(
url
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment