Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
8ca2498d
Commit
8ca2498d
authored
Jul 06, 2021
by
Simone Gaiarin
Browse files
Make annotation toolbar visibility changed connection unique
parent
5d968d51
Changes
2
Hide whitespace changes
Inline
Side-by-side
part/annotationactionhandler.cpp
View file @
8ca2498d
...
...
@@ -99,7 +99,6 @@ public:
void
slotQuickToolSelected
(
int
favToolId
);
void
slotSetColor
(
AnnotationColor
colorType
,
const
QColor
&
color
=
QColor
());
void
slotSelectAnnotationFont
();
void
slotAnnotationToolBarVisibilityChanged
(
bool
visible
);
bool
isQuickToolAction
(
QAction
*
aTool
);
bool
isQuickToolStamp
(
int
toolId
);
void
assertToolBarExists
(
KParts
::
MainWindow
*
mw
,
const
QString
&
toolBarName
);
...
...
@@ -515,14 +514,6 @@ void AnnotationActionHandlerPrivate::slotSelectAnnotationFont()
}
}
void
AnnotationActionHandlerPrivate
::
slotAnnotationToolBarVisibilityChanged
(
bool
visible
)
{
aShowToolBar
->
setEnabled
(
!
visible
);
if
(
!
visible
&&
!
isQuickToolAction
(
agTools
->
checkedAction
()))
{
q
->
deselectAllAnnotationActions
();
}
}
bool
AnnotationActionHandlerPrivate
::
isQuickToolAction
(
QAction
*
aTool
)
{
return
quickTools
.
contains
(
aTool
);
...
...
@@ -800,8 +791,7 @@ void AnnotationActionHandler::setupAnnotationToolBarVisibilityAction()
d
->
assertToolBarExists
(
mw
,
QStringLiteral
(
"quickAnnotationToolBar"
));
KToolBar
*
annotationToolBar
=
mw
->
toolBar
(
QStringLiteral
(
"annotationToolBar"
));
connect
(
annotationToolBar
,
&
QToolBar
::
visibilityChanged
,
this
,
[
this
](
bool
visible
)
{
d
->
slotAnnotationToolBarVisibilityChanged
(
visible
);
},
Qt
::
UniqueConnection
);
connect
(
annotationToolBar
,
&
QToolBar
::
visibilityChanged
,
this
,
&
AnnotationActionHandler
::
slotAnnotationToolBarVisibilityChanged
,
Qt
::
UniqueConnection
);
// show action
connect
(
d
->
aShowToolBar
,
&
QAction
::
triggered
,
annotationToolBar
,
&
KToolBar
::
show
,
Qt
::
UniqueConnection
);
// hide action
...
...
@@ -860,4 +850,12 @@ void AnnotationActionHandler::deselectAllAnnotationActions()
}
}
void
AnnotationActionHandler
::
slotAnnotationToolBarVisibilityChanged
(
bool
visible
)
{
d
->
aShowToolBar
->
setEnabled
(
!
visible
);
if
(
!
visible
&&
!
d
->
isQuickToolAction
(
d
->
agTools
->
checkedAction
()))
{
deselectAllAnnotationActions
();
}
}
#include "moc_annotationactionhandler.cpp"
part/annotationactionhandler.h
View file @
8ca2498d
...
...
@@ -45,6 +45,9 @@ public:
signals:
void
ephemeralStampWarning
();
private
slots
:
void
slotAnnotationToolBarVisibilityChanged
(
bool
visible
);
private:
class
AnnotationActionHandlerPrivate
*
d
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment