Made the icon property a QVariant.
If a string is passed a KIcon(string) object will be created. If a QIcon is passed that will be used. REVIEW: 103009
This commit is contained in:
parent
270b6296b9
commit
41bd519f43
@ -19,7 +19,7 @@ qt4_automoc(${qtextracomponents_SRCS})
|
||||
|
||||
|
||||
add_library(qtextracomponentsplugin SHARED ${qtextracomponents_SRCS})
|
||||
target_link_libraries(qtextracomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
||||
target_link_libraries(qtextracomponentsplugin ${KDE4_KDEUI_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
||||
|
||||
install(TARGETS qtextracomponentsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/qtextracomponents)
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "qiconitem.h"
|
||||
|
||||
#include <kicon.h>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
|
||||
@ -34,9 +35,14 @@ QIconItem::~QIconItem()
|
||||
{
|
||||
}
|
||||
|
||||
void QIconItem::setIcon(const QIcon &icon)
|
||||
void QIconItem::setIcon(QVariant &icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
if(icon.canConvert<QIcon>()) {
|
||||
m_icon = icon.value<QIcon>();
|
||||
}
|
||||
else if(icon.canConvert<QString>()) {
|
||||
m_icon = KIcon(icon.toString());
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -21,19 +21,20 @@
|
||||
|
||||
#include <QDeclarativeItem>
|
||||
#include <QPixmap>
|
||||
#include <QVariant>
|
||||
|
||||
class QIconItem : public QDeclarativeItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
|
||||
Q_PROPERTY(QVariant icon READ icon WRITE setIcon)
|
||||
Q_PROPERTY(bool smooth READ smooth WRITE setSmooth)
|
||||
|
||||
public:
|
||||
QIconItem(QDeclarativeItem *parent=0);
|
||||
~QIconItem();
|
||||
|
||||
void setIcon(const QIcon &icon);
|
||||
void setIcon(QVariant &icon);
|
||||
QIcon icon() const;
|
||||
|
||||
void setSmooth(const bool smooth);
|
||||
|
Loading…
Reference in New Issue
Block a user