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
Marco Bubke
flatpak-qt-creator
Commits
baaf7b1d
Commit
baaf7b1d
authored
Jul 15, 2009
by
con
Browse files
Less QToolBars in editor tool bar.
parent
5e1a24f7
Changes
22
Hide whitespace changes
Inline
Side-by-side
src/libs/utils/styledbar.cpp
View file @
baaf7b1d
...
...
@@ -12,6 +12,17 @@ StyledBar::StyledBar(QWidget *parent)
:
QWidget
(
parent
)
{
setProperty
(
"panelwidget"
,
true
);
setProperty
(
"panelwidget_singlerow"
,
true
);
}
void
StyledBar
::
setSingleRow
(
bool
singleRow
)
{
setProperty
(
"panelwidget_singlerow"
,
singleRow
);
}
bool
StyledBar
::
isSingleRow
()
const
{
return
property
(
"panelwidget_singlerow"
).
toBool
();
}
void
StyledBar
::
paintEvent
(
QPaintEvent
*
event
)
...
...
src/libs/utils/styledbar.h
View file @
baaf7b1d
...
...
@@ -12,7 +12,8 @@ class QTCREATOR_UTILS_EXPORT StyledBar : public QWidget
{
public:
StyledBar
(
QWidget
*
parent
=
0
);
void
setSingleRow
(
bool
singleRow
);
bool
isSingleRow
()
const
;
protected:
void
paintEvent
(
QPaintEvent
*
event
);
};
...
...
src/plugins/bineditor/bineditorplugin.cpp
View file @
baaf7b1d
...
...
@@ -287,7 +287,7 @@ public:
QByteArray
saveState
()
const
{
return
QByteArray
();
}
// TODO
bool
restoreState
(
const
QByteArray
&
/* state */
)
{
return
false
;
}
// TODO
Q
ToolBar
*
toolBar
()
{
return
m_toolBar
;
}
Q
Widget
*
toolBar
()
{
return
m_toolBar
;
}
bool
isTemporary
()
const
{
return
false
;
}
...
...
src/plugins/coreplugin/editormanager/editorview.cpp
View file @
baaf7b1d
...
...
@@ -34,6 +34,7 @@
#include "openeditorsmodel.h"
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
...
...
@@ -49,7 +50,6 @@
#include <QtGui/QStackedWidget>
#include <QtGui/QStyle>
#include <QtGui/QStyleOption>
#include <QtGui/QToolBar>
#include <QtGui/QToolButton>
#include <QtGui/QMenu>
#include <QtGui/QClipboard>
...
...
@@ -74,7 +74,7 @@ EditorView::EditorView(OpenEditorsModel *model, QWidget *parent) :
m_editorList
(
new
QComboBox
),
m_closeButton
(
new
QToolButton
),
m_lockButton
(
new
QToolButton
),
m_defaultToolBar
(
new
Q
ToolBar
(
this
)),
m_defaultToolBar
(
new
Q
Widget
(
this
)),
m_infoWidget
(
new
QFrame
(
this
)),
m_editorForInfoWidget
(
0
),
m_statusHLine
(
new
QFrame
(
this
)),
...
...
@@ -94,12 +94,7 @@ EditorView::EditorView(OpenEditorsModel *model, QWidget *parent) :
m_editorList
->
setMaxVisibleItems
(
40
);
m_editorList
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
QToolBar
*
editorListToolBar
=
new
QToolBar
;
editorListToolBar
->
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Ignored
);
editorListToolBar
->
addWidget
(
m_editorList
);
m_defaultToolBar
->
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Minimum
);
m_defaultToolBar
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
m_activeToolBar
=
m_defaultToolBar
;
QHBoxLayout
*
toolBarLayout
=
new
QHBoxLayout
;
...
...
@@ -107,6 +102,7 @@ EditorView::EditorView(OpenEditorsModel *model, QWidget *parent) :
toolBarLayout
->
setSpacing
(
0
);
toolBarLayout
->
addWidget
(
m_defaultToolBar
);
m_toolBar
->
setLayout
(
toolBarLayout
);
m_toolBar
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
m_lockButton
->
setAutoRaise
(
true
);
m_lockButton
->
setProperty
(
"type"
,
QLatin1String
(
"dockbutton"
));
...
...
@@ -115,23 +111,16 @@ EditorView::EditorView(OpenEditorsModel *model, QWidget *parent) :
m_closeButton
->
setIcon
(
QIcon
(
":/core/images/closebutton.png"
));
m_closeButton
->
setProperty
(
"type"
,
QLatin1String
(
"dockbutton"
));
QToolBar
*
rightToolBar
=
new
QToolBar
;
rightToolBar
->
setLayoutDirection
(
Qt
::
RightToLeft
);
rightToolBar
->
addWidget
(
m_closeButton
);
rightToolBar
->
addWidget
(
m_lockButton
);
QHBoxLayout
*
toplayout
=
new
QHBoxLayout
;
toplayout
->
setSpacing
(
0
);
toplayout
->
setMargin
(
0
);
toplayout
->
addWidget
(
editorList
ToolBar
);
toplayout
->
addWidget
(
m_
editorList
);
toplayout
->
addWidget
(
m_toolBar
,
1
);
// Custom toolbar stretches
toplayout
->
addWidget
(
rightToolBar
);
toplayout
->
addWidget
(
m_lockButton
);
toplayout
->
addWidget
(
m_closeButton
);
QWidget
*
top
=
new
QWidget
;
QVBoxLayout
*
vlayout
=
new
QVBoxLayout
(
top
);
vlayout
->
setSpacing
(
0
);
vlayout
->
setMargin
(
0
);
vlayout
->
addLayout
(
toplayout
);
Core
::
Utils
::
StyledBar
*
top
=
new
Core
::
Utils
::
StyledBar
;
top
->
setLayout
(
toplayout
);
tl
->
addWidget
(
top
);
connect
(
m_editorList
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
listSelectionActivated
(
int
)));
...
...
@@ -258,7 +247,7 @@ void EditorView::addEditor(IEditor *editor)
m_container
->
addWidget
(
editor
->
widget
());
m_widgetEditorMap
.
insert
(
editor
->
widget
(),
editor
);
Q
ToolBar
*
toolBar
=
editor
->
toolBar
();
Q
Widget
*
toolBar
=
editor
->
toolBar
();
if
(
toolBar
)
{
toolBar
->
setVisible
(
false
);
// will be made visible in setCurrentEditor
m_toolBar
->
layout
()
->
addWidget
(
toolBar
);
...
...
@@ -297,7 +286,7 @@ void EditorView::removeEditor(IEditor *editor)
m_widgetEditorMap
.
remove
(
editor
->
widget
());
editor
->
widget
()
->
setParent
(
0
);
disconnect
(
editor
,
SIGNAL
(
changed
()),
this
,
SLOT
(
checkEditorStatus
()));
Q
ToolBar
*
toolBar
=
editor
->
toolBar
();
Q
Widget
*
toolBar
=
editor
->
toolBar
();
if
(
toolBar
!=
0
)
{
if
(
m_activeToolBar
==
toolBar
)
{
m_activeToolBar
=
m_defaultToolBar
;
...
...
@@ -375,7 +364,7 @@ void EditorView::updateEditorStatus(IEditor *editor)
void
EditorView
::
updateToolBar
(
IEditor
*
editor
)
{
Q
ToolBar
*
toolBar
=
editor
->
toolBar
();
Q
Widget
*
toolBar
=
editor
->
toolBar
();
if
(
!
toolBar
)
toolBar
=
m_defaultToolBar
;
if
(
m_activeToolBar
==
toolBar
)
...
...
src/plugins/coreplugin/editormanager/editorview.h
View file @
baaf7b1d
...
...
@@ -105,12 +105,12 @@ private:
OpenEditorsModel
*
m_model
;
QWidget
*
m_toolBar
;
Q
ToolBar
*
m_activeToolBar
;
Q
Widget
*
m_activeToolBar
;
QStackedWidget
*
m_container
;
QComboBox
*
m_editorList
;
QToolButton
*
m_closeButton
;
QToolButton
*
m_lockButton
;
Q
ToolBar
*
m_defaultToolBar
;
Q
Widget
*
m_defaultToolBar
;
QString
m_infoWidgetKind
;
QFrame
*
m_infoWidget
;
QLabel
*
m_infoWidgetLabel
;
...
...
src/plugins/coreplugin/editormanager/ieditor.h
View file @
baaf7b1d
...
...
@@ -65,7 +65,7 @@ public:
virtual
bool
isTemporary
()
const
=
0
;
virtual
Q
ToolBar
*
toolBar
()
=
0
;
virtual
Q
Widget
*
toolBar
()
=
0
;
signals:
void
changed
();
...
...
src/plugins/coreplugin/manhattanstyle.cpp
View file @
baaf7b1d
...
...
@@ -314,10 +314,10 @@ void ManhattanStyle::polish(QWidget *widget)
widget
->
removeEventFilter
(
d
->
style
);
}
if
(
panelWidget
(
widget
))
{
widget
->
setAttribute
(
Qt
::
WA_LayoutUsesWidgetRect
,
true
);
if
(
qobject_cast
<
QToolButton
*>
(
widget
))
{
widget
->
setAttribute
(
Qt
::
WA_Hover
);
widget
->
setMaximumHeight
(
StyleHelper
::
navigationWidgetHeight
()
-
2
);
widget
->
setAttribute
(
Qt
::
WA_Hover
);
}
else
if
(
qobject_cast
<
QLineEdit
*>
(
widget
))
{
widget
->
setAttribute
(
Qt
::
WA_Hover
);
...
...
@@ -325,8 +325,8 @@ void ManhattanStyle::polish(QWidget *widget)
}
else
if
(
qobject_cast
<
QLabel
*>
(
widget
))
widget
->
setPalette
(
panelPalette
(
widget
->
palette
()));
else
if
(
qobject_cast
<
QToolBar
*>
(
widget
))
widget
->
set
Minimum
Height
(
StyleHelper
::
navigationWidgetHeight
());
else
if
(
qobject_cast
<
QToolBar
*>
(
widget
)
||
widget
->
property
(
"panelwidget_singlerow"
).
toBool
()
)
widget
->
set
Fixed
Height
(
StyleHelper
::
navigationWidgetHeight
());
else
if
(
qobject_cast
<
QStatusBar
*>
(
widget
))
widget
->
setFixedHeight
(
StyleHelper
::
navigationWidgetHeight
()
+
2
);
else
if
(
qobject_cast
<
QComboBox
*>
(
widget
))
{
...
...
@@ -340,6 +340,7 @@ void ManhattanStyle::unpolish(QWidget *widget)
{
d
->
style
->
unpolish
(
widget
);
if
(
panelWidget
(
widget
))
{
widget
->
setAttribute
(
Qt
::
WA_LayoutUsesWidgetRect
,
false
);
if
(
qobject_cast
<
QTabBar
*>
(
widget
))
widget
->
setAttribute
(
Qt
::
WA_Hover
,
false
);
else
if
(
qobject_cast
<
QToolBar
*>
(
widget
))
...
...
src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp
View file @
baaf7b1d
...
...
@@ -346,7 +346,7 @@ Core::IFile *EditorPrototype::file() const
return
callee
()
->
file
();
}
Q
ToolBar
*
EditorPrototype
::
toolBar
()
const
Q
Widget
*
EditorPrototype
::
toolBar
()
const
{
return
callee
()
->
toolBar
();
}
...
...
src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h
View file @
baaf7b1d
...
...
@@ -198,7 +198,7 @@ class EditorPrototype : public QObject, public QScriptable
Q_PROPERTY
(
QString
kind
READ
kind
DESIGNABLE
false
SCRIPTABLE
true
STORED
false
)
Q_PROPERTY
(
bool
duplicateSupported
READ
duplicateSupported
DESIGNABLE
false
SCRIPTABLE
true
STORED
false
)
Q_PROPERTY
(
Core
::
IFile
*
file
READ
file
DESIGNABLE
false
SCRIPTABLE
true
STORED
false
)
Q_PROPERTY
(
Q
ToolBar
*
toolBar
READ
toolBar
DESIGNABLE
false
SCRIPTABLE
true
STORED
false
)
Q_PROPERTY
(
Q
Widget
*
toolBar
READ
toolBar
DESIGNABLE
false
SCRIPTABLE
true
STORED
false
)
public:
EditorPrototype
(
QObject
*
parent
=
0
);
...
...
@@ -210,7 +210,7 @@ public:
bool
duplicateSupported
()
const
;
Core
::
IFile
*
file
()
const
;
Q
ToolBar
*
toolBar
()
const
;
Q
Widget
*
toolBar
()
const
;
public
slots
:
bool
createNew
(
const
QString
&
contents
);
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
baaf7b1d
...
...
@@ -640,7 +640,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
connect
(
m_semanticHighlighter
,
SIGNAL
(
changed
(
SemanticInfo
)),
this
,
SLOT
(
updateSemanticInfo
(
SemanticInfo
)));
QToolBar
*
toolBar
=
editable
->
toolBar
();
QToolBar
*
toolBar
=
static_cast
<
QToolBar
*>
(
editable
->
toolBar
()
)
;
QList
<
QAction
*>
actions
=
toolBar
->
actions
();
QWidget
*
w
=
toolBar
->
widgetForAction
(
actions
.
first
());
static_cast
<
QHBoxLayout
*>
(
w
->
layout
())
->
insertWidget
(
0
,
m_methodCombo
,
1
);
...
...
src/plugins/designer/formeditorw.cpp
View file @
baaf7b1d
...
...
@@ -467,8 +467,8 @@ void FormEditorW::setupActions()
QToolBar
*
FormEditorW
::
createEditorToolBar
()
const
{
QToolBar
*
r
c
=
new
QToolBar
;
r
c
->
addSeparator
();
QToolBar
*
toolBa
r
=
new
QToolBar
;
toolBa
r
->
addSeparator
();
Core
::
ActionManager
*
am
=
m_core
->
actionManager
();
const
QStringList
::
const_iterator
cend
=
m_toolActionIds
.
constEnd
();
for
(
QStringList
::
const_iterator
it
=
m_toolActionIds
.
constBegin
();
it
!=
cend
;
++
it
)
{
...
...
@@ -476,11 +476,12 @@ QToolBar *FormEditorW::createEditorToolBar() const
QTC_ASSERT
(
cmd
,
continue
);
QAction
*
action
=
cmd
->
action
();
if
(
!
action
->
icon
().
isNull
())
// Simplify grid has no action yet
r
c
->
addAction
(
action
);
toolBa
r
->
addAction
(
action
);
}
int
size
=
rc
->
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
);
rc
->
setIconSize
(
QSize
(
size
,
size
));
return
rc
;
int
size
=
toolBar
->
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
);
toolBar
->
setIconSize
(
QSize
(
size
,
size
));
toolBar
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
return
toolBar
;
}
Core
::
ActionContainer
*
FormEditorW
::
createPreviewStyleMenu
(
Core
::
ActionManager
*
am
,
...
...
src/plugins/designer/formwindoweditor.cpp
View file @
baaf7b1d
...
...
@@ -274,7 +274,7 @@ void FormWindowEditor::setDisplayName(const QString &title)
m_displayName
=
title
;
}
Q
ToolBar
*
FormWindowEditor
::
toolBar
()
Q
Widget
*
FormWindowEditor
::
toolBar
()
{
if
(
!
m_toolBar
)
m_toolBar
=
FormEditorW
::
instance
()
->
createEditorToolBar
();
...
...
src/plugins/designer/formwindoweditor.h
View file @
baaf7b1d
...
...
@@ -76,7 +76,7 @@ public:
const
char
*
kind
()
const
;
QString
displayName
()
const
;
void
setDisplayName
(
const
QString
&
title
);
Q
ToolBar
*
toolBar
();
Q
Widget
*
toolBar
();
QByteArray
saveState
()
const
;
bool
restoreState
(
const
QByteArray
&
state
);
virtual
bool
isTemporary
()
const
{
return
false
;
}
...
...
src/plugins/duieditor/duieditor.cpp
View file @
baaf7b1d
...
...
@@ -677,7 +677,7 @@ void ScriptEditor::createToolBar(ScriptEditorEditable *editable)
connect
(
file
(),
SIGNAL
(
changed
()),
this
,
SLOT
(
updateFileName
()));
QToolBar
*
toolBar
=
editable
->
toolBar
();
QToolBar
*
toolBar
=
static_cast
<
QToolBar
*>
(
editable
->
toolBar
()
)
;
QList
<
QAction
*>
actions
=
toolBar
->
actions
();
toolBar
->
insertWidget
(
actions
.
first
(),
m_methodCombo
);
...
...
src/plugins/find/findtoolbar.cpp
View file @
baaf7b1d
...
...
@@ -76,6 +76,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_ui
.
setupUi
(
this
);
setFocusProxy
(
m_ui
.
findEdit
);
setProperty
(
"topBorder"
,
true
);
setSingleRow
(
false
);
m_ui
.
findEdit
->
setAttribute
(
Qt
::
WA_MacShowFocusRect
,
false
);
m_ui
.
replaceEdit
->
setAttribute
(
Qt
::
WA_MacShowFocusRect
,
false
);
...
...
src/plugins/qtscripteditor/qtscripteditor.cpp
View file @
baaf7b1d
...
...
@@ -384,7 +384,7 @@ void ScriptEditor::createToolBar(ScriptEditorEditable *editable)
connect
(
file
(),
SIGNAL
(
changed
()),
this
,
SLOT
(
updateFileName
()));
QToolBar
*
toolBar
=
editable
->
toolBar
();
QToolBar
*
toolBar
=
static_cast
<
QToolBar
*>
(
editable
->
toolBar
()
)
;
QList
<
QAction
*>
actions
=
toolBar
->
actions
();
QWidget
*
w
=
toolBar
->
widgetForAction
(
actions
.
first
());
...
...
src/plugins/resourceeditor/resourceeditorw.h
View file @
baaf7b1d
...
...
@@ -96,7 +96,7 @@ public:
const
char
*
kind
()
const
;
QString
displayName
()
const
{
return
m_displayName
;
}
void
setDisplayName
(
const
QString
&
title
)
{
m_displayName
=
title
;
}
Q
ToolBar
*
toolBar
()
{
return
0
;
}
Q
Widget
*
toolBar
()
{
return
0
;
}
QByteArray
saveState
()
const
{
return
QByteArray
();
}
bool
restoreState
(
const
QByteArray
&
/*state*/
)
{
return
true
;
}
...
...
src/plugins/texteditor/basetexteditor.cpp
View file @
baaf7b1d
...
...
@@ -4143,7 +4143,7 @@ BaseTextEditorEditable::~BaseTextEditorEditable()
delete
e
;
}
Q
ToolBar
*
BaseTextEditorEditable
::
toolBar
()
Q
Widget
*
BaseTextEditorEditable
::
toolBar
()
{
return
m_toolBar
;
}
...
...
src/plugins/texteditor/basetexteditor.h
View file @
baaf7b1d
...
...
@@ -573,7 +573,7 @@ public:
inline
QByteArray
saveState
()
const
{
return
e
->
saveState
();
}
inline
bool
restoreState
(
const
QByteArray
&
state
)
{
return
e
->
restoreState
(
state
);
}
Q
ToolBar
*
toolBar
();
Q
Widget
*
toolBar
();
// ITextEditor
int
find
(
const
QString
&
string
)
const
;
...
...
src/plugins/vcsbase/vcsbaseeditor.cpp
View file @
baaf7b1d
...
...
@@ -104,7 +104,7 @@ public:
VCSBaseDiffEditorEditable
(
VCSBaseEditor
*
,
const
VCSBaseEditorParameters
*
type
);
~
VCSBaseDiffEditorEditable
();
virtual
Q
ToolBar
*
toolBar
()
{
return
m_toolBar
;
}
virtual
Q
Widget
*
toolBar
()
{
return
m_toolBar
;
}
QComboBox
*
diffFileBrowseComboBox
()
const
{
return
m_diffFileBrowseComboBox
;
}
bool
isTemporary
()
const
{
return
true
;
}
...
...
Prev
1
2
Next
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