Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
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
Environments
Packages & Registries
Packages & Registries
Container Registry
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
Marco Bubke
flatpak-qt-creator
Commits
1ce34736
Commit
1ce34736
authored
Mar 15, 2010
by
Lasse Holmstedt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed toolbar for splitted editors
parent
43f9c27b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
18 deletions
+51
-18
src/plugins/coreplugin/editormanager/editorview.cpp
src/plugins/coreplugin/editormanager/editorview.cpp
+21
-0
src/plugins/coreplugin/editormanager/editorview.h
src/plugins/coreplugin/editormanager/editorview.h
+4
-1
src/plugins/coreplugin/editortoolbar.cpp
src/plugins/coreplugin/editortoolbar.cpp
+20
-10
src/plugins/coreplugin/editortoolbar.h
src/plugins/coreplugin/editortoolbar.h
+4
-5
src/plugins/designer/formeditorw.cpp
src/plugins/designer/formeditorw.cpp
+1
-1
src/plugins/qmldesigner/designmodewidget.cpp
src/plugins/qmldesigner/designmodewidget.cpp
+1
-1
No files found.
src/plugins/coreplugin/editormanager/editorview.cpp
View file @
1ce34736
...
...
@@ -87,6 +87,8 @@ EditorView::EditorView(QWidget *parent) :
{
connect
(
m_toolBar
,
SIGNAL
(
goBackClicked
()),
this
,
SLOT
(
goBackInNavigationHistory
()));
connect
(
m_toolBar
,
SIGNAL
(
goForwardClicked
()),
this
,
SLOT
(
goForwardInNavigationHistory
()));
connect
(
m_toolBar
,
SIGNAL
(
closeClicked
()),
this
,
SLOT
(
closeView
()));
connect
(
m_toolBar
,
SIGNAL
(
listSelectionActivated
(
int
)),
this
,
SLOT
(
listSelectionActivated
(
int
)));
tl
->
addWidget
(
m_toolBar
);
}
{
...
...
@@ -157,6 +159,14 @@ EditorView::~EditorView()
{
}
void
EditorView
::
closeView
()
{
EditorManager
*
em
=
CoreImpl
::
instance
()
->
editorManager
();
if
(
IEditor
*
editor
=
currentEditor
())
{
em
->
closeDuplicate
(
editor
);
}
}
void
EditorView
::
showEditorInfoBar
(
const
QString
&
id
,
const
QString
&
infoText
,
const
QString
&
buttonText
,
...
...
@@ -249,6 +259,17 @@ IEditor *EditorView::currentEditor() const
return
0
;
}
void
EditorView
::
listSelectionActivated
(
int
index
)
{
EditorManager
*
em
=
CoreImpl
::
instance
()
->
editorManager
();
QAbstractItemModel
*
model
=
EditorManager
::
instance
()
->
openedEditorsModel
();
if
(
IEditor
*
editor
=
model
->
data
(
model
->
index
(
index
,
0
),
Qt
::
UserRole
).
value
<
IEditor
*>
())
{
em
->
activateEditor
(
this
,
editor
);
}
else
{
em
->
activateEditor
(
model
->
index
(
index
,
0
),
this
);
}
}
void
EditorView
::
setCurrentEditor
(
IEditor
*
editor
)
{
// FIXME: this keeps the editor hidden if switching from A to B and back
...
...
src/plugins/coreplugin/editormanager/editorview.h
View file @
1ce34736
...
...
@@ -96,6 +96,10 @@ public:
QObject
*
object
,
const
char
*
member
);
void
hideEditorStatusBar
(
const
QString
&
id
);
private
slots
:
void
closeView
();
void
listSelectionActivated
(
int
index
);
private:
void
updateNavigatorActions
();
void
updateToolBar
(
IEditor
*
editor
);
...
...
@@ -122,7 +126,6 @@ private:
int
m_currentNavigationHistoryPosition
;
void
updateCurrentPositionInNavigationHistory
();
public:
inline
bool
canGoForward
()
const
{
return
m_currentNavigationHistoryPosition
<
m_navigationHistory
.
size
()
-
1
;
}
inline
bool
canGoBack
()
const
{
return
m_currentNavigationHistoryPosition
>
0
;
}
...
...
src/plugins/coreplugin/editortoolbar.cpp
View file @
1ce34736
...
...
@@ -85,7 +85,7 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
m_activeToolBar
(
0
),
m_toolBarPlaceholder
(
new
QWidget
),
m_defaultToolBar
(
new
QWidget
(
this
)),
m_i
gnoreEditorToolbar
(
false
)
m_i
sStandalone
(
false
)
{
QHBoxLayout
*
toolBarLayout
=
new
QHBoxLayout
(
this
);
toolBarLayout
->
setMargin
(
0
);
...
...
@@ -139,7 +139,10 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
setLayout
(
toplayout
);
connect
(
m_editorList
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
listSelectionActivated
(
int
)));
// this signal is disconnected for standalone toolbars and replaced with
// a private slot connection
connect
(
m_editorList
,
SIGNAL
(
activated
(
int
)),
this
,
SIGNAL
(
listSelectionActivated
(
int
)));
connect
(
m_editorList
,
SIGNAL
(
customContextMenuRequested
(
QPoint
)),
this
,
SLOT
(
listContextMenu
(
QPoint
)));
connect
(
m_lockButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
makeEditorWritable
()));
connect
(
m_closeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
closeView
()),
Qt
::
QueuedConnection
);
...
...
@@ -175,9 +178,12 @@ void EditorToolBar::closeView()
if
(
!
currentEditor
())
return
;
EditorManager
*
em
=
ICore
::
instance
()
->
editorManager
();
if
(
IEditor
*
editor
=
currentEditor
())
{
em
->
closeDuplicate
(
editor
);
if
(
m_isStandalone
)
{
EditorManager
*
em
=
ICore
::
instance
()
->
editorManager
();
if
(
IEditor
*
editor
=
currentEditor
())
{
//em->closeDuplicate(editor);
em
->
closeEditor
(
editor
);
}
}
emit
closeClicked
();
}
...
...
@@ -187,7 +193,7 @@ void EditorToolBar::addEditor(IEditor *editor)
connect
(
editor
,
SIGNAL
(
changed
()),
this
,
SLOT
(
checkEditorStatus
()));
QWidget
*
toolBar
=
editor
->
toolBar
();
if
(
toolBar
&&
!
m_i
gnoreEditorToolbar
)
if
(
toolBar
&&
!
m_i
sStandalone
)
addCenterToolBar
(
toolBar
);
updateEditorStatus
(
editor
);
...
...
@@ -214,10 +220,13 @@ void EditorToolBar::updateToolBar(QWidget *toolBar)
void
EditorToolBar
::
setToolbarCreationFlags
(
ToolbarCreationFlags
flags
)
{
m_i
gnoreEditorToolbar
=
flags
&
FlagsIgnoreIEditorToolBar
;
if
(
m_i
gnoreEditorToolbar
)
{
m_i
sStandalone
=
flags
&
FlagsStandalone
;
if
(
m_i
sStandalone
)
{
EditorManager
*
em
=
EditorManager
::
instance
();
connect
(
em
,
SIGNAL
(
currentEditorChanged
(
Core
::
IEditor
*
)),
SLOT
(
updateEditorListSelection
(
Core
::
IEditor
*
)));
disconnect
(
m_editorList
,
SIGNAL
(
activated
(
int
)),
this
,
SIGNAL
(
listSelectionActivated
(
int
)));
connect
(
m_editorList
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
changeActiveEditor
(
int
)));
}
}
...
...
@@ -227,7 +236,7 @@ void EditorToolBar::setCurrentEditor(IEditor *editor)
// If we never added the toolbar from the editor, we will never change
// the editor, so there's no need to update the toolbar either.
if
(
!
m_i
gnoreEditorToolbar
)
if
(
!
m_i
sStandalone
)
updateToolBar
(
editor
->
toolBar
());
updateEditorStatus
(
editor
);
...
...
@@ -239,12 +248,13 @@ void EditorToolBar::updateEditorListSelection(IEditor *newSelection)
m_editorList
->
setCurrentIndex
(
m_editorsListModel
->
indexOf
(
newSelection
).
row
());
}
void
EditorToolBar
::
listSelectionActivated
(
int
row
)
void
EditorToolBar
::
changeActiveEditor
(
int
row
)
{
EditorManager
*
em
=
ICore
::
instance
()
->
editorManager
();
QAbstractItemModel
*
model
=
m_editorList
->
model
();
const
QModelIndex
modelIndex
=
model
->
index
(
row
,
0
);
IEditor
*
editor
=
model
->
data
(
modelIndex
,
Qt
::
UserRole
).
value
<
IEditor
*>
();
if
(
editor
)
{
if
(
editor
!=
em
->
currentEditor
())
em
->
activateEditor
(
editor
,
EditorManager
::
NoModeSwitch
);
...
...
src/plugins/coreplugin/editortoolbar.h
View file @
1ce34736
...
...
@@ -62,7 +62,7 @@ class CORE_EXPORT EditorToolBar : public Utils::StyledBar
public:
explicit
EditorToolBar
(
QWidget
*
parent
=
0
);
enum
ToolbarCreationFlags
{
FlagsNone
=
0
,
Flags
IgnoreIEditorToolBar
=
1
};
enum
ToolbarCreationFlags
{
FlagsNone
=
0
,
Flags
Standalone
=
1
};
/**
* Adds an editor whose state is listened to, so that the toolbar can be kept up to date
...
...
@@ -94,10 +94,11 @@ signals:
void
closeClicked
();
void
goBackClicked
();
void
goForwardClicked
();
void
listSelectionActivated
(
int
row
);
private
slots
:
void
updateEditorListSelection
(
Core
::
IEditor
*
newSelection
);
void
listSelectionActivated
(
int
row
);
void
changeActiveEditor
(
int
row
);
void
listContextMenu
(
QPoint
);
void
makeEditorWritable
();
...
...
@@ -123,9 +124,7 @@ private:
QWidget
*
m_toolBarPlaceholder
;
QWidget
*
m_defaultToolBar
;
bool
m_ignoreEditorToolbar
;
friend
class
Internal
::
EditorView
;
bool
m_isStandalone
;
};
}
...
...
src/plugins/designer/formeditorw.cpp
View file @
1ce34736
...
...
@@ -314,7 +314,7 @@ void FormEditorW::fullInit()
m_editorToolBar
=
createEditorToolBar
();
m_toolBar
=
Core
::
EditorManager
::
createToolBar
();
m_toolBar
->
setToolbarCreationFlags
(
Core
::
EditorToolBar
::
Flags
IgnoreIEditorToolBar
);
m_toolBar
->
setToolbarCreationFlags
(
Core
::
EditorToolBar
::
Flags
Standalone
);
m_toolBar
->
setNavigationVisible
(
false
);
m_toolBar
->
addCenterToolBar
(
m_editorToolBar
);
...
...
src/plugins/qmldesigner/designmodewidget.cpp
View file @
1ce34736
...
...
@@ -297,7 +297,7 @@ void DocumentWidget::setup()
m_designToolBar
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Ignored
);
m_fakeToolBar
->
setToolbarCreationFlags
(
Core
::
EditorToolBar
::
Flags
IgnoreIEditorToolBar
);
m_fakeToolBar
->
setToolbarCreationFlags
(
Core
::
EditorToolBar
::
Flags
Standalone
);
m_fakeToolBar
->
addEditor
(
textEditor
());
m_fakeToolBar
->
addCenterToolBar
(
m_designToolBar
);
m_fakeToolBar
->
setNavigationVisible
(
false
);
...
...
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