Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
7f8d9c10
Commit
7f8d9c10
authored
Apr 13, 2012
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SankoréSANKORE-499
Document explorer(navigator): pages of a document can not be moved using D'n'D
parent
0d339d4c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
2 deletions
+53
-2
UBBoardController.h
src/board/UBBoardController.h
+2
-0
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+9
-2
UBDocumentNavigator.cpp
src/gui/UBDocumentNavigator.cpp
+1
-0
UBDocumentNavigator.h
src/gui/UBDocumentNavigator.h
+1
-0
UBDocumentTreeWidget.cpp
src/gui/UBDocumentTreeWidget.cpp
+36
-0
UBDocumentTreeWidget.h
src/gui/UBDocumentTreeWidget.h
+4
-0
No files found.
src/board/UBBoardController.h
View file @
7f8d9c10
...
...
@@ -152,6 +152,7 @@ class UBBoardController : public QObject
void
displayMetaData
(
QMap
<
QString
,
QString
>
metadatas
);
void
ClearUndoStack
();
void
emitScrollSignal
()
{
emit
scrollToSelectedPage
();
}
public
slots
:
void
setActiveDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
int
pSceneIndex
=
0
);
...
...
@@ -230,6 +231,7 @@ class UBBoardController : public QObject
void
setDocOnPageNavigator
(
UBDocumentProxy
*
doc
);
void
documentReorganized
(
int
index
);
void
displayMetadata
(
QMap
<
QString
,
QString
>
metadata
);
void
scrollToSelectedPage
();
protected
:
void
setupViews
();
...
...
src/core/UBApplicationController.cpp
View file @
7f8d9c10
...
...
@@ -337,8 +337,15 @@ void UBApplicationController::showBoard()
mMainWindow
->
tutorialToolBar
->
hide
();
mMainWindow
->
boardToolBar
->
show
();
if
(
mMainMode
==
Document
&&
UBApplication
::
documentController
->
getSelectedItemIndex
()
!=
-
1
)
UBApplication
::
boardController
->
setActiveDocumentScene
(
UBApplication
::
documentController
->
getCurrentDocument
(),
UBApplication
::
documentController
->
getSelectedItemIndex
());
if
(
mMainMode
==
Document
)
{
int
selectedSceneIndex
=
UBApplication
::
documentController
->
getSelectedItemIndex
();
if
(
selectedSceneIndex
!=
-
1
)
{
UBApplication
::
boardController
->
setActiveDocumentScene
(
UBApplication
::
documentController
->
getCurrentDocument
(),
selectedSceneIndex
);
UBApplication
::
boardController
->
emitScrollSignal
();
}
}
mMainMode
=
Board
;
...
...
src/gui/UBDocumentNavigator.cpp
View file @
7f8d9c10
...
...
@@ -58,6 +58,7 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
this
,
SLOT
(
addNewPage
()));
connect
(
mScene
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
onSelectionChanged
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
documentReorganized
(
int
)),
this
,
SLOT
(
onMovedToIndex
(
int
)));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
scrollToSelectedPage
()),
this
,
SLOT
(
onScrollToSelectedPage
()));
}
/**
...
...
src/gui/UBDocumentNavigator.h
View file @
7f8d9c10
...
...
@@ -46,6 +46,7 @@ signals:
public
slots
:
void
onMovedToIndex
(
int
index
);
void
onScrollToSelectedPage
()
{
centerOn
(
mCrntItem
);
}
protected
:
virtual
void
resizeEvent
(
QResizeEvent
*
event
);
...
...
src/gui/UBDocumentTreeWidget.cpp
View file @
7f8d9c10
...
...
@@ -39,11 +39,14 @@ UBDocumentTreeWidget::UBDocumentTreeWidget(QWidget * parent)
setDragDropMode
(
QAbstractItemView
::
InternalMove
);
setAutoScroll
(
true
);
mScrollTimer
=
new
QTimer
(
this
);
connect
(
UBDocumentManager
::
documentManager
(),
SIGNAL
(
documentUpdated
(
UBDocumentProxy
*
))
,
this
,
SLOT
(
documentUpdated
(
UBDocumentProxy
*
)));
connect
(
this
,
SIGNAL
(
itemChanged
(
QTreeWidgetItem
*
,
int
))
,
this
,
SLOT
(
itemChangedValidation
(
QTreeWidgetItem
*
,
int
)));
connect
(
mScrollTimer
,
SIGNAL
(
timeout
())
,
this
,
SLOT
(
autoScroll
()));
}
...
...
@@ -104,6 +107,12 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
{
Q_UNUSED
(
event
);
if
(
mScrollTimer
->
isActive
())
{
mScrollMagnitude
=
0
;
mScrollTimer
->
stop
();
}
if
(
mDropTargetProxyTi
)
{
mDropTargetProxyTi
->
setBackground
(
0
,
mBackground
);
...
...
@@ -114,6 +123,27 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
void
UBDocumentTreeWidget
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
{
QRect
boundingFrame
=
frameRect
();
//setting up automatic scrolling
const
int
SCROLL_DISTANCE
=
4
;
int
bottomDist
=
boundingFrame
.
bottom
()
-
event
->
pos
().
y
(),
topDist
=
boundingFrame
.
top
()
-
event
->
pos
().
y
();
if
(
qAbs
(
bottomDist
)
<=
SCROLL_DISTANCE
)
{
mScrollMagnitude
=
(
SCROLL_DISTANCE
-
bottomDist
)
*
4
;
if
(
verticalScrollBar
()
->
isVisible
()
&&
!
mScrollTimer
->
isActive
())
mScrollTimer
->
start
(
100
);
}
else
if
(
qAbs
(
topDist
)
<=
SCROLL_DISTANCE
)
{
mScrollMagnitude
=
(
-
SCROLL_DISTANCE
-
topDist
)
*
4
;
if
(
verticalScrollBar
()
->
isVisible
()
&&
!
mScrollTimer
->
isActive
())
mScrollTimer
->
start
(
100
);
}
else
{
mScrollMagnitude
=
0
;
mScrollTimer
->
stop
();
}
QTreeWidgetItem
*
underlyingItem
=
this
->
itemAt
(
event
->
pos
());
if
(
event
->
mimeData
()
->
hasFormat
(
UBApplication
::
mimeTypeUniboardPage
))
...
...
@@ -417,3 +447,9 @@ bool UBDocumentGroupTreeItem::isDefaultFolder() const
{
return
(
0
==
(
flags
()
&
Qt
::
ItemIsEditable
))
&&
(
groupName
()
==
UBSettings
::
defaultDocumentGroupName
);
}
void
UBDocumentTreeWidget
::
autoScroll
()
{
this
->
verticalScrollBar
()
->
setValue
(
this
->
verticalScrollBar
()
->
value
()
+
mScrollMagnitude
);
}
\ No newline at end of file
src/gui/UBDocumentTreeWidget.h
View file @
7f8d9c10
...
...
@@ -43,10 +43,14 @@ class UBDocumentTreeWidget : public QTreeWidget
void
itemChangedValidation
(
QTreeWidgetItem
*
item
,
int
column
);
void
autoScroll
();
private
:
UBDocumentProxyTreeItem
*
mSelectedProxyTi
;
QTreeWidgetItem
*
mDropTargetProxyTi
;
QBrush
mBackground
;
QTimer
*
mScrollTimer
;
int
mScrollMagnitude
;
};
...
...
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