Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
29b7594b
Commit
29b7594b
authored
Jan 18, 2010
by
Marco Bubke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add toogle button for bounding rects
parent
7b9e8b31
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
3 deletions
+38
-3
src/plugins/qmldesigner/components/formeditor/boundingrect.png
...lugins/qmldesigner/components/formeditor/boundingrect.png
+0
-0
src/plugins/qmldesigner/components/formeditor/formeditor.qrc
src/plugins/qmldesigner/components/formeditor/formeditor.qrc
+1
-0
src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
...gins/qmldesigner/components/formeditor/formeditoritem.cpp
+3
-1
src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp
...ins/qmldesigner/components/formeditor/formeditorscene.cpp
+13
-2
src/plugins/qmldesigner/components/formeditor/formeditorscene.h
...ugins/qmldesigner/components/formeditor/formeditorscene.h
+5
-0
src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
...gins/qmldesigner/components/formeditor/formeditorview.cpp
+1
-0
src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
...ns/qmldesigner/components/formeditor/formeditorwidget.cpp
+13
-0
src/plugins/qmldesigner/components/formeditor/formeditorwidget.h
...gins/qmldesigner/components/formeditor/formeditorwidget.h
+2
-0
No files found.
src/plugins/qmldesigner/components/formeditor/boundingrect.png
0 → 100644
View file @
29b7594b
345 Bytes
src/plugins/qmldesigner/components/formeditor/formeditor.qrc
View file @
29b7594b
...
...
@@ -8,5 +8,6 @@
</qresource>
<qresource prefix="/icon/layout">
<file>snapping.png</file>
<file>boundingrect.png</file>
</qresource>
</RCC>
src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
View file @
29b7594b
...
...
@@ -231,7 +231,9 @@ void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
qmlItemNode
().
paintInstance
(
painter
);
painter
->
setRenderHint
(
QPainter
::
Antialiasing
,
false
);
paintBoundingRect
(
painter
);
if
(
scene
()
->
showBoundingRects
())
paintBoundingRect
(
painter
);
painter
->
restore
();
}
...
...
src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp
View file @
29b7594b
...
...
@@ -58,8 +58,8 @@ FormEditorScene::FormEditorScene(FormEditorWidget *view, FormEditorView *editorV
m_editorView
(
editorView
),
m_formLayerItem
(
new
LayerItem
(
this
)),
m_manipulatorLayerItem
(
new
LayerItem
(
this
)),
m_paintMode
(
NormalMode
)
m_paintMode
(
NormalMode
)
,
m_showBoundingRects
(
true
)
{
setSceneRect
(
0
,
0
,
1
,
1
);
// prevent automatic calculation (causing a recursion), right size will be set later
...
...
@@ -360,5 +360,16 @@ void FormEditorScene::clearFormEditorItems()
}
}
void
FormEditorScene
::
setShowBoundingRects
(
bool
show
)
{
m_showBoundingRects
=
show
;
updateAllFormEditorItems
();
}
bool
FormEditorScene
::
showBoundingRects
()
const
{
return
m_showBoundingRects
;
}
}
src/plugins/qmldesigner/components/formeditor/formeditorscene.h
View file @
29b7594b
...
...
@@ -93,6 +93,10 @@ public:
void
clearFormEditorItems
();
public
slots
:
void
setShowBoundingRects
(
bool
show
);
bool
showBoundingRects
()
const
;
protected:
void
dropEvent
(
QGraphicsSceneDragDropEvent
*
event
);
void
dragEnterEvent
(
QGraphicsSceneDragDropEvent
*
event
);
...
...
@@ -123,6 +127,7 @@ private:
QWeakPointer
<
LayerItem
>
m_manipulatorLayerItem
;
ModelNode
m_dragNode
;
PaintMode
m_paintMode
;
bool
m_showBoundingRects
;
};
...
...
src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
View file @
29b7594b
...
...
@@ -67,6 +67,7 @@ FormEditorView::FormEditorView(QObject *parent)
m_currentTool
(
m_selectionTool
)
{
connect
(
widget
()
->
zoomAction
(),
SIGNAL
(
zoomLevelChanged
(
double
)),
SLOT
(
updateGraphicsIndicators
()));
connect
(
widget
()
->
showBoundingRectAction
(),
SIGNAL
(
toggled
(
bool
)),
scene
(),
SLOT
(
setShowBoundingRects
(
bool
)));
}
FormEditorScene
*
FormEditorView
::
scene
()
const
...
...
src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
View file @
29b7594b
...
...
@@ -90,6 +90,14 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
m_snappingToolAction
->
setIcon
(
QPixmap
(
":/icon/layout/snapping.png"
));
connect
(
m_snappingToolAction
.
data
(),
SIGNAL
(
triggered
(
bool
)),
SLOT
(
changeSnappingTool
(
bool
)));
m_showBoundingRectAction
=
layoutActionGroup
->
addAction
(
"Toogle Bounding Rectangles (Press Key R)"
);
m_showBoundingRectAction
->
setShortcut
(
Qt
::
Key_R
);
m_showBoundingRectAction
->
setShortcutContext
(
Qt
::
WidgetWithChildrenShortcut
);
m_showBoundingRectAction
->
setCheckable
(
true
);
m_showBoundingRectAction
->
setChecked
(
true
);
m_showBoundingRectAction
->
setIcon
(
QPixmap
(
":/icon/layout/boundingrect.png"
));
m_snappingMarginAction
=
new
NumberSeriesAction
(
layoutActionGroup
);
m_snappingMarginAction
->
addEntry
(
"no margins (0)"
,
0
);
m_snappingMarginAction
->
addEntry
(
"small margin (2)"
,
2
);
...
...
@@ -179,6 +187,11 @@ QAction *FormEditorWidget::transformToolAction() const
return
m_transformToolAction
.
data
();
}
QAction
*
FormEditorWidget
::
showBoundingRectAction
()
const
{
return
m_showBoundingRectAction
.
data
();
}
void
FormEditorWidget
::
setZoomLevel
(
double
zoomLevel
)
{
m_graphicsView
->
resetTransform
();
...
...
src/plugins/qmldesigner/components/formeditor/formeditorwidget.h
View file @
29b7594b
...
...
@@ -53,6 +53,7 @@ public:
ZoomAction
*
zoomAction
()
const
;
QAction
*
anchorToolAction
()
const
;
QAction
*
transformToolAction
()
const
;
QAction
*
showBoundingRectAction
()
const
;
void
setScene
(
FormEditorScene
*
scene
);
ToolBox
*
toolBox
()
const
;
...
...
@@ -83,6 +84,7 @@ private:
QWeakPointer
<
QAction
>
m_snappingToolAction
;
QWeakPointer
<
NumberSeriesAction
>
m_snappingMarginAction
;
QWeakPointer
<
NumberSeriesAction
>
m_snappingSpacingAction
;
QWeakPointer
<
QAction
>
m_showBoundingRectAction
;
};
...
...
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