Skip to content
GitLab
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
64a167c2
Commit
64a167c2
authored
Jan 19, 2010
by
Marco Bubke
Browse files
Add option in the toolbar to toogle selection of items with no content
parent
4959230c
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/formeditor.qrc
View file @
64a167c2
...
...
@@ -10,4 +10,7 @@
<file>snapping.png</file>
<file>boundingrect.png</file>
</qresource>
<qresource prefix="/icon/selection">
<file>selectonlycontentitems.png</file>
</qresource>
</RCC>
src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
View file @
64a167c2
...
...
@@ -68,6 +68,8 @@ FormEditorView::FormEditorView(QObject *parent)
{
connect
(
widget
()
->
zoomAction
(),
SIGNAL
(
zoomLevelChanged
(
double
)),
SLOT
(
updateGraphicsIndicators
()));
connect
(
widget
()
->
showBoundingRectAction
(),
SIGNAL
(
toggled
(
bool
)),
scene
(),
SLOT
(
setShowBoundingRects
(
bool
)));
connect
(
widget
()
->
selectOnlyContentItemsAction
(),
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
setSelectOnlyContentItemsAction
(
bool
)));
}
FormEditorScene
*
FormEditorView
::
scene
()
const
...
...
@@ -519,6 +521,12 @@ void FormEditorView::updateGraphicsIndicators()
m_currentTool
->
formEditorItemsChanged
(
scene
()
->
allFormEditorItems
());
}
void
FormEditorView
::
setSelectOnlyContentItemsAction
(
bool
selectOnlyContentItems
)
{
m_selectionTool
->
setSelectOnlyContentItems
(
selectOnlyContentItems
);
}
void
FormEditorView
::
updateItem
(
const
QmlObjectNode
&
qmlObjectNode
)
{
...
...
src/plugins/qmldesigner/components/formeditor/formeditorview.h
View file @
64a167c2
...
...
@@ -118,6 +118,7 @@ protected:
protected
slots
:
QList
<
ModelNode
>
adjustStatesForModelNodes
(
const
QList
<
ModelNode
>
&
nodeList
)
const
;
void
updateGraphicsIndicators
();
void
setSelectOnlyContentItemsAction
(
bool
selectOnlyContentItems
);
private:
//functions
void
setupFormEditorItemTree
(
const
QmlItemNode
&
qmlItemNode
);
...
...
src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
View file @
64a167c2
...
...
@@ -121,7 +121,20 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
connect
(
m_zoomAction
.
data
(),
SIGNAL
(
zoomLevelChanged
(
double
)),
SLOT
(
setZoomLevel
(
double
)));
addAction
(
m_zoomAction
.
data
());
QAction
*
separatorAction
=
new
QAction
(
toolActionGroup
());
QAction
*
separatorAction
=
new
QAction
(
this
);
separatorAction
->
setSeparator
(
true
);
addAction
(
separatorAction
);
m_selectOnlyContentItemsAction
=
layoutActionGroup
->
addAction
(
"Select Only Items with Content (Press Key T)"
);
m_selectOnlyContentItemsAction
->
setShortcut
(
Qt
::
Key_T
);
m_selectOnlyContentItemsAction
->
setShortcutContext
(
Qt
::
WidgetWithChildrenShortcut
);
m_selectOnlyContentItemsAction
->
setCheckable
(
true
);
m_selectOnlyContentItemsAction
->
setChecked
(
true
);
m_selectOnlyContentItemsAction
->
setIcon
(
QPixmap
(
":/icon/selection/selectonlycontentitems.png"
));
addAction
(
m_selectOnlyContentItemsAction
.
data
());
separatorAction
=
new
QAction
(
toolActionGroup
());
separatorAction
->
setSeparator
(
true
);
addAction
(
separatorAction
);
...
...
@@ -192,6 +205,11 @@ QAction *FormEditorWidget::showBoundingRectAction() const
return
m_showBoundingRectAction
.
data
();
}
QAction
*
FormEditorWidget
::
selectOnlyContentItemsAction
()
const
{
return
m_selectOnlyContentItemsAction
.
data
();
}
void
FormEditorWidget
::
setZoomLevel
(
double
zoomLevel
)
{
m_graphicsView
->
resetTransform
();
...
...
src/plugins/qmldesigner/components/formeditor/formeditorwidget.h
View file @
64a167c2
...
...
@@ -54,6 +54,8 @@ public:
QAction
*
anchorToolAction
()
const
;
QAction
*
transformToolAction
()
const
;
QAction
*
showBoundingRectAction
()
const
;
QAction
*
selectOnlyContentItemsAction
()
const
;
void
setScene
(
FormEditorScene
*
scene
);
ToolBox
*
toolBox
()
const
;
...
...
@@ -85,6 +87,7 @@ private:
QWeakPointer
<
NumberSeriesAction
>
m_snappingMarginAction
;
QWeakPointer
<
NumberSeriesAction
>
m_snappingSpacingAction
;
QWeakPointer
<
QAction
>
m_showBoundingRectAction
;
QWeakPointer
<
QAction
>
m_selectOnlyContentItemsAction
;
};
...
...
src/plugins/qmldesigner/components/formeditor/selectiontool.cpp
View file @
64a167c2
...
...
@@ -49,8 +49,8 @@ SelectionTool::SelectionTool(FormEditorView *editorView)
m_rubberbandSelectionManipulator
(
editorView
->
scene
()
->
manipulatorLayerItem
(),
editorView
),
m_singleSelectionManipulator
(
editorView
),
m_selectionIndicator
(
editorView
->
scene
()
->
manipulatorLayerItem
()),
m_resizeIndicator
(
editorView
->
scene
()
->
manipulatorLayerItem
())
m_resizeIndicator
(
editorView
->
scene
()
->
manipulatorLayerItem
())
,
m_selectOnlyContentItems
(
true
)
{
// view()->setCursor(Qt::CrossCursor);
}
...
...
@@ -69,21 +69,21 @@ void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
m_singleSelectionManipulator
.
begin
(
event
->
scenePos
());
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ControlModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
,
m_selectOnlyContentItems
);
else
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ShiftModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
,
m_selectOnlyContentItems
);
else
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
,
m_selectOnlyContentItems
);
}
else
{
if
(
event
->
modifiers
().
testFlag
(
Qt
::
AltModifier
))
{
m_singleSelectionManipulator
.
begin
(
event
->
scenePos
());
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ControlModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
,
m_selectOnlyContentItems
);
else
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ShiftModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
,
m_selectOnlyContentItems
);
else
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
,
m_selectOnlyContentItems
);
m_singleSelectionManipulator
.
end
(
event
->
scenePos
());
view
()
->
changeToMoveTool
(
event
->
scenePos
());
...
...
@@ -149,11 +149,11 @@ void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
m_singleSelectionManipulator
.
begin
(
event
->
scenePos
());
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ControlModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
,
m_selectOnlyContentItems
);
else
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ShiftModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
,
m_selectOnlyContentItems
);
else
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
,
m_selectOnlyContentItems
);
m_singleSelectionManipulator
.
end
(
event
->
scenePos
());
}
else
{
...
...
@@ -226,6 +226,11 @@ void SelectionTool::pasteClipBoard()
// QClipboard *clipboard = QApplication::clipboard();
}
void
SelectionTool
::
setSelectOnlyContentItems
(
bool
selectOnlyContentItems
)
{
m_selectOnlyContentItems
=
selectOnlyContentItems
;
}
void
SelectionTool
::
itemsAboutToRemoved
(
const
QList
<
FormEditorItem
*>
&
/*itemList*/
)
{
...
...
@@ -270,11 +275,11 @@ void SelectionTool::selectUnderPoint(QGraphicsSceneMouseEvent *event)
m_singleSelectionManipulator
.
begin
(
event
->
scenePos
());
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ControlModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
RemoveFromSelection
,
m_selectOnlyContentItems
);
else
if
(
event
->
modifiers
().
testFlag
(
Qt
::
ShiftModifier
))
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
AddToSelection
,
m_selectOnlyContentItems
);
else
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
);
m_singleSelectionManipulator
.
select
(
SingleSelectionManipulator
::
InvertSelection
,
m_selectOnlyContentItems
);
m_singleSelectionManipulator
.
end
(
event
->
scenePos
());
}
...
...
src/plugins/qmldesigner/components/formeditor/selectiontool.h
View file @
64a167c2
...
...
@@ -81,12 +81,16 @@ public:
void
copySelectedNodeToClipBoard
();
void
cutSelectedNodeToClipBoard
();
void
pasteClipBoard
();
void
setSelectOnlyContentItems
(
bool
selectOnlyContentItems
);
private:
RubberBandSelectionManipulator
m_rubberbandSelectionManipulator
;
SingleSelectionManipulator
m_singleSelectionManipulator
;
SelectionIndicator
m_selectionIndicator
;
ResizeIndicator
m_resizeIndicator
;
QTime
m_mousePressTimer
;
bool
m_selectOnlyContentItems
;
};
}
...
...
src/plugins/qmldesigner/components/formeditor/selectonlycontentitems.png
0 → 100644
View file @
64a167c2
308 Bytes
src/plugins/qmldesigner/components/formeditor/singleselectionmanipulator.cpp
View file @
64a167c2
...
...
@@ -69,7 +69,7 @@ void SingleSelectionManipulator::end(const QPointF &/*updatePoint*/)
m_isActive
=
false
;
}
void
SingleSelectionManipulator
::
select
(
SelectionType
selectionType
)
void
SingleSelectionManipulator
::
select
(
SelectionType
selectionType
,
bool
selectOnlyContentItems
)
{
QList
<
QGraphicsItem
*>
itemList
=
m_editorView
->
scene
()
->
items
(
m_beginPoint
);
...
...
@@ -81,7 +81,7 @@ void SingleSelectionManipulator::select(SelectionType selectionType)
if
(
formEditorItem
&&
!
formEditorItem
->
qmlItemNode
().
isRootNode
()
&&
(
formEditorItem
->
qmlItemNode
().
hasShowContent
()))
&&
(
formEditorItem
->
qmlItemNode
().
hasShowContent
()
||
!
selectOnlyContentItems
))
{
selectedNode
=
formEditorItem
->
qmlItemNode
();
break
;
...
...
src/plugins/qmldesigner/components/formeditor/singleselectionmanipulator.h
View file @
64a167c2
...
...
@@ -53,7 +53,7 @@ public:
void
update
(
const
QPointF
&
updatePoint
);
void
end
(
const
QPointF
&
updatePoint
);
void
select
(
SelectionType
selectionType
);
void
select
(
SelectionType
selectionType
,
bool
selectOnlyContentItems
);
void
clear
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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