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
0943177d
Commit
0943177d
authored
Mar 04, 2010
by
Jörg Schummer
Committed by
Kai Koehne
Mar 05, 2010
Browse files
QmlDesigner.ItemLibrary: fixed: do not display non-visual components
Task-number: BAUHAUS-433 Reviewed-by: kkoehne
parent
b3a6fe13
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp
View file @
0943177d
...
...
@@ -435,49 +435,53 @@ void ItemLibraryModel::updateVisibility()
QList
<
ItemLibraryInfo
>
ItemLibraryModel
::
itemLibraryRepresentations
(
const
QString
&
type
)
{
QList
<
ItemLibraryInfo
>
itemLibraryRepresentationList
;
NodeMetaInfo
nodeInfo
=
m_metaInfo
->
nodeMetaInfo
(
type
);
QList
<
ItemLibraryInfo
>
itemLibraryRepresentationList
=
m_metaInfo
->
itemLibraryRepresentations
(
nodeInfo
);
QImage
dragImage
(
64
,
64
,
QImage
::
Format_RGB32
);
// TODO: draw item drag icon
dragImage
.
fill
(
0xffffffff
);
QPainter
p
(
&
dragImage
);
QPen
pen
(
Qt
::
gray
);
pen
.
setWidth
(
2
);
p
.
setPen
(
pen
);
p
.
drawRect
(
1
,
1
,
dragImage
.
width
()
-
2
,
dragImage
.
height
()
-
2
);
QPixmap
dragPixmap
(
QPixmap
::
fromImage
(
dragImage
));
if
(
!
m_metaInfo
->
hasNodeMetaInfo
(
type
))
qWarning
()
<<
"ItemLibrary: type not declared: "
<<
type
;
static
QIcon
defaultIcon
(
QLatin1String
(
":/ItemLibrary/images/item-default-icon.png"
));
if
(
itemLibraryRepresentationList
.
isEmpty
()
||
!
m_metaInfo
->
hasNodeMetaInfo
(
type
))
{
QIcon
icon
=
nodeInfo
.
icon
();
if
(
icon
.
isNull
())
icon
=
defaultIcon
;
ItemLibraryInfo
itemLibraryInfo
;
itemLibraryInfo
.
setName
(
type
);
itemLibraryInfo
.
setTypeName
(
nodeInfo
.
typeName
());
itemLibraryInfo
.
setCategory
(
nodeInfo
.
category
());
itemLibraryInfo
.
setIcon
(
icon
);
itemLibraryInfo
.
setDragIcon
(
dragPixmap
);
itemLibraryInfo
.
setMajorVersion
(
nodeInfo
.
majorVersion
());
itemLibraryInfo
.
setMinorVersion
(
nodeInfo
.
minorVersion
());
itemLibraryRepresentationList
.
append
(
itemLibraryInfo
);
}
else
{
foreach
(
ItemLibraryInfo
itemLibraryRepresentation
,
itemLibraryRepresentationList
)
{
QIcon
icon
=
itemLibraryRepresentation
.
icon
();
if
(
itemLibraryRepresentation
.
icon
().
isNull
())
itemLibraryRepresentation
.
setIcon
(
defaultIcon
);
if
(
itemLibraryRepresentation
.
dragIcon
().
isNull
())
itemLibraryRepresentation
.
setDragIcon
(
dragPixmap
);
if
(
nodeInfo
.
isQmlGraphicsItem
())
{
itemLibraryRepresentationList
=
m_metaInfo
->
itemLibraryRepresentations
(
nodeInfo
);
QImage
dragImage
(
64
,
64
,
QImage
::
Format_RGB32
);
// TODO: draw item drag icon
dragImage
.
fill
(
0xffffffff
);
QPainter
p
(
&
dragImage
);
QPen
pen
(
Qt
::
gray
);
pen
.
setWidth
(
2
);
p
.
setPen
(
pen
);
p
.
drawRect
(
1
,
1
,
dragImage
.
width
()
-
2
,
dragImage
.
height
()
-
2
);
QPixmap
dragPixmap
(
QPixmap
::
fromImage
(
dragImage
));
if
(
!
m_metaInfo
->
hasNodeMetaInfo
(
type
))
qWarning
()
<<
"ItemLibrary: type not declared: "
<<
type
;
static
QIcon
defaultIcon
(
QLatin1String
(
":/ItemLibrary/images/item-default-icon.png"
));
if
(
itemLibraryRepresentationList
.
isEmpty
()
||
!
m_metaInfo
->
hasNodeMetaInfo
(
type
))
{
QIcon
icon
=
nodeInfo
.
icon
();
if
(
icon
.
isNull
())
icon
=
defaultIcon
;
ItemLibraryInfo
itemLibraryInfo
;
itemLibraryInfo
.
setName
(
type
);
itemLibraryInfo
.
setTypeName
(
nodeInfo
.
typeName
());
itemLibraryInfo
.
setCategory
(
nodeInfo
.
category
());
itemLibraryInfo
.
setIcon
(
icon
);
itemLibraryInfo
.
setDragIcon
(
dragPixmap
);
itemLibraryInfo
.
setMajorVersion
(
nodeInfo
.
majorVersion
());
itemLibraryInfo
.
setMinorVersion
(
nodeInfo
.
minorVersion
());
itemLibraryRepresentationList
.
append
(
itemLibraryInfo
);
}
else
{
foreach
(
ItemLibraryInfo
itemLibraryRepresentation
,
itemLibraryRepresentationList
)
{
QIcon
icon
=
itemLibraryRepresentation
.
icon
();
if
(
itemLibraryRepresentation
.
icon
().
isNull
())
itemLibraryRepresentation
.
setIcon
(
defaultIcon
);
if
(
itemLibraryRepresentation
.
dragIcon
().
isNull
())
itemLibraryRepresentation
.
setDragIcon
(
dragPixmap
);
if
(
itemLibraryRepresentation
.
category
().
isEmpty
())
itemLibraryRepresentation
.
setCategory
(
nodeInfo
.
category
());
if
(
itemLibraryRepresentation
.
category
().
isEmpty
())
itemLibraryRepresentation
.
setCategory
(
nodeInfo
.
category
());
}
}
}
...
...
Write
Preview
Supports
Markdown
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