Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Pim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Pim
Commits
58aa116a
Commit
58aa116a
authored
Nov 21, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt code from master code
parent
4efde039
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
23 deletions
+31
-23
pimcommon/widgets/splittercollapser.cpp
pimcommon/widgets/splittercollapser.cpp
+30
-23
pimcommon/widgets/splittercollapser.h
pimcommon/widgets/splittercollapser.h
+1
-0
No files found.
pimcommon/widgets/splittercollapser.cpp
View file @
58aa116a
...
...
@@ -100,11 +100,10 @@ bool SplitterCollapser::Private::isVertical() const
bool
SplitterCollapser
::
Private
::
isVisible
()
const
{
const
QRect
widgetRect
=
childWidget
->
geometry
();
const
QPoint
br
=
widgetRect
.
bottomRight
();
if
((
br
.
x
()
<=
0
)
||
(
br
.
y
()
<=
0
))
{
return
false
;
}
else
{
if
((
widgetRect
.
height
()
==
0
)
||
(
widgetRect
.
width
()
==
0
))
{
return
true
;
}
else
{
return
false
;
}
}
...
...
@@ -117,17 +116,17 @@ void SplitterCollapser::Private::updatePosition()
if
(
!
isVertical
())
{
const
int
splitterWidth
=
splitter
->
width
();
const
int
width
=
q
->
width
();
const
int
width
=
q
->
sizeHint
().
width
();
// FIXME: Make this configurable
y
=
30
;
if
(
direction
==
LeftToRight
)
{
if
(
isVisible
())
{
if
(
!
isVisible
())
{
x
=
widgetRect
.
right
()
+
handleWidth
;
}
else
{
x
=
0
;
}
}
else
{
// RightToLeft
if
(
isVisible
())
{
if
(
!
isVisible
())
{
x
=
widgetRect
.
left
()
-
handleWidth
-
width
;
}
else
{
x
=
splitterWidth
-
handleWidth
-
width
;
...
...
@@ -135,16 +134,16 @@ void SplitterCollapser::Private::updatePosition()
}
}
else
{
x
=
30
;
const
int
height
=
q
->
height
();
const
int
height
=
q
->
sizeHint
().
height
();
const
int
splitterHeight
=
splitter
->
height
();
if
(
direction
==
TopToBottom
)
{
if
(
isVisible
())
{
if
(
!
isVisible
())
{
y
=
widgetRect
.
bottom
()
+
handleWidth
;
}
else
{
y
=
0
;
}
}
else
{
// BottomToTop
if
(
isVisible
())
{
if
(
!
isVisible
())
{
y
=
widgetRect
.
top
()
-
handleWidth
-
height
;
}
else
{
y
=
splitterHeight
-
handleWidth
-
height
;
...
...
@@ -156,7 +155,7 @@ void SplitterCollapser::Private::updatePosition()
void
SplitterCollapser
::
Private
::
updateArrow
()
{
q
->
setArrowType
(
isVisible
()
?
s_arrowDirection
[
direction
].
arrowVisible
:
s_arrowDirection
[
direction
].
notA
rrowVisible
);
q
->
setArrowType
(
isVisible
()
?
s_arrowDirection
[
direction
].
notArrowVisible
:
s_arrowDirection
[
direction
].
a
rrowVisible
);
}
void
SplitterCollapser
::
Private
::
widgetEventFilter
(
QEvent
*
event
)
...
...
@@ -181,11 +180,10 @@ void SplitterCollapser::Private::updateOpacity()
const
QPoint
pos
=
q
->
parentWidget
()
->
mapFromGlobal
(
QCursor
::
pos
());
const
QRect
opaqueRect
=
q
->
geometry
();
const
bool
opaqueCollapser
=
opaqueRect
.
contains
(
pos
);
const
int
frame
=
opacityTimeLine
->
currentFrame
();
if
(
opaqueCollapser
&&
frame
==
opacityTimeLine
->
startFrame
())
{
if
(
opaqueCollapser
)
{
opacityTimeLine
->
setDirection
(
QTimeLine
::
Forward
);
startTimeLine
();
}
else
if
(
!
opaqueCollapser
&&
frame
==
opacityTimeLine
->
endFrame
())
{
}
else
{
opacityTimeLine
->
setDirection
(
QTimeLine
::
Backward
);
startTimeLine
();
}
...
...
@@ -193,9 +191,10 @@ void SplitterCollapser::Private::updateOpacity()
void
SplitterCollapser
::
Private
::
startTimeLine
()
{
if
(
opacityTimeLine
->
state
()
!
=
QTimeLine
::
Running
)
{
opacityTimeLine
->
st
art
();
if
(
opacityTimeLine
->
state
()
=
=
QTimeLine
::
Running
)
{
opacityTimeLine
->
st
op
();
}
opacityTimeLine
->
start
();
}
...
...
@@ -237,7 +236,6 @@ SplitterCollapser::SplitterCollapser(QWidget *childWidget, QSplitter *splitter)
}
connect
(
this
,
SIGNAL
(
clicked
()),
SLOT
(
slotClicked
()));
show
();
}
SplitterCollapser
::~
SplitterCollapser
()
...
...
@@ -247,7 +245,7 @@ SplitterCollapser::~SplitterCollapser()
bool
SplitterCollapser
::
isCollapsed
()
const
{
return
!
d
->
isVisible
();
return
d
->
isVisible
();
}
bool
SplitterCollapser
::
eventFilter
(
QObject
*
object
,
QEvent
*
event
)
...
...
@@ -255,7 +253,7 @@ bool SplitterCollapser::eventFilter(QObject *object, QEvent *event)
if
(
object
==
d
->
childWidget
)
{
d
->
widgetEventFilter
(
event
);
}
return
false
;
return
QToolButton
::
eventFilter
(
object
,
event
)
;
}
void
SplitterCollapser
::
enterEvent
(
QEvent
*
event
)
...
...
@@ -270,9 +268,18 @@ void SplitterCollapser::leaveEvent(QEvent *event)
d
->
updateOpacity
();
}
void
SplitterCollapser
::
showEvent
(
QShowEvent
*
event
)
{
Q_UNUSED
(
event
)
d
->
updateOpacity
();
}
QSize
SplitterCollapser
::
sizeHint
()
const
{
const
int
extent
=
style
()
->
pixelMetric
(
QStyle
::
PM_ScrollBarExtent
);
QStyleOption
opt
;
opt
.
initFrom
(
this
);
const
int
extent
=
style
()
->
pixelMetric
(
QStyle
::
PM_ScrollBarExtent
,
&
opt
);
QSize
sh
(
extent
*
3
/
4
,
extent
*
240
/
100
);
if
(
d
->
isVertical
())
{
sh
.
transpose
();
...
...
@@ -284,7 +291,7 @@ void SplitterCollapser::slotClicked()
{
QList
<
int
>
sizes
=
d
->
splitter
->
sizes
();
const
int
index
=
d
->
splitter
->
indexOf
(
d
->
childWidget
);
if
(
d
->
isVisible
())
{
if
(
!
d
->
isVisible
())
{
d
->
sizeAtCollapse
=
sizes
;
sizes
[
index
]
=
0
;
}
else
{
...
...
@@ -305,7 +312,7 @@ void SplitterCollapser::slotClicked()
void
SplitterCollapser
::
collapse
()
{
if
(
d
->
isVisible
())
{
if
(
!
d
->
isVisible
())
{
slotClicked
();
}
// else do nothing
...
...
@@ -313,7 +320,7 @@ void SplitterCollapser::collapse()
void
SplitterCollapser
::
restore
()
{
if
(
!
d
->
isVisible
())
{
if
(
d
->
isVisible
())
{
slotClicked
();
}
// else do nothing
...
...
pimcommon/widgets/splittercollapser.h
View file @
58aa116a
...
...
@@ -84,6 +84,7 @@ protected:
void
enterEvent
(
QEvent
*
event
);
void
leaveEvent
(
QEvent
*
event
);
void
showEvent
(
QShowEvent
*
event
);
private:
class
Private
;
Private
*
const
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