equal
deleted
inserted
replaced
28 #include <QStyle> |
28 #include <QStyle> |
29 #include <QDebug> |
29 #include <QDebug> |
30 #include <QTextDocument> |
30 #include <QTextDocument> |
31 #include <QGraphicsSceneResizeEvent> |
31 #include <QGraphicsSceneResizeEvent> |
32 |
32 |
33 #include "hblabel.h" |
|
34 #include "hbiconitem.h" |
33 #include "hbiconitem.h" |
35 #include "hbinstance.h" |
34 #include "hbinstance.h" |
36 #include "hbcolorscheme.h" |
35 #include "hbcolorscheme.h" |
37 #include "hbwidget_p.h" |
36 #include "hbwidget_p.h" |
38 #include "hbstyleoptionlabel_p.h" |
37 #include "hbstyleoptionlabel_p.h" |
39 #include "hbwidgetbase.h" |
38 #include "hbwidgetbase.h" |
|
39 #include "hblabel.h" |
40 |
40 |
41 /*! |
41 /*! |
42 @alpha |
42 @alpha |
43 @hbcore |
43 @hbcore |
44 |
44 |
123 mAlignment(Qt::AlignLeft | Qt::AlignVCenter), |
123 mAlignment(Qt::AlignLeft | Qt::AlignVCenter), |
124 mText(QString()), |
124 mText(QString()), |
125 mElideMode(Qt::ElideRight), |
125 mElideMode(Qt::ElideRight), |
126 mTextWrapping(Hb::TextNoWrap), |
126 mTextWrapping(Hb::TextNoWrap), |
127 mAspectRatioMode(Qt::KeepAspectRatio), |
127 mAspectRatioMode(Qt::KeepAspectRatio), |
128 mPrimitiveItem(NULL), |
128 mPrimitiveItem(0), |
129 mActivePrimitive(HbStyle::P_None) |
129 mActivePrimitive(HbStyle::P_None) |
130 { |
130 { |
131 } |
131 } |
132 |
132 |
133 void HbLabelPrivate::clearAll() |
133 void HbLabelPrivate::clearAll() |
134 { |
134 { |
135 if (mPrimitiveItem) { |
135 if (mPrimitiveItem) { |
136 delete mPrimitiveItem; |
136 delete mPrimitiveItem; |
137 mPrimitiveItem = NULL; |
137 mPrimitiveItem = 0; |
138 mActivePrimitive = HbStyle::P_None; |
138 mActivePrimitive = HbStyle::P_None; |
139 } |
139 } |
140 |
140 |
141 mText.clear(); |
141 mText.clear(); |
142 mIcon.clear(); |
142 mIcon.clear(); |
197 |
197 |
198 void HbLabelPrivate::createPrimitives() |
198 void HbLabelPrivate::createPrimitives() |
199 { |
199 { |
200 Q_Q(HbLabel); |
200 Q_Q(HbLabel); |
201 |
201 |
202 Q_ASSERT(mPrimitiveItem==NULL); |
202 Q_ASSERT(mPrimitiveItem==0); |
203 |
203 |
204 if (mActivePrimitive != HbStyle::P_None) { |
204 if (mActivePrimitive != HbStyle::P_None) { |
205 mPrimitiveItem = q->style()->createPrimitive(mActivePrimitive, q); |
205 mPrimitiveItem = q->style()->createPrimitive(mActivePrimitive, q); |
206 } |
206 } |
207 } |
207 } |
542 option->icon = d->mIcon; |
542 option->icon = d->mIcon; |
543 option->aspectRatioMode = d->mAspectRatioMode; |
543 option->aspectRatioMode = d->mAspectRatioMode; |
544 } |
544 } |
545 } |
545 } |
546 |
546 |
|
547 QSizeF HbLabel::sizeHint ( Qt::SizeHint which, const QSizeF & constraint ) const |
|
548 { |
|
549 if (isEmpty()) { |
|
550 return QSizeF(0,0); |
|
551 } |
|
552 return HbWidget::sizeHint(which,constraint); |
|
553 } |
|
554 |
547 /*! |
555 /*! |
548 Slot to be called when the style primitives need to be updated. |
556 Slot to be called when the style primitives need to be updated. |
549 This function does not initiate redrawing this widget. |
557 This function does not initiate redrawing this widget. |
550 |
558 |
551 \reimp |
559 \reimp |