138 |
144 |
139 /*! |
145 /*! |
140 \overload |
146 \overload |
141 |
147 |
142 Creates a new action with the given \a icon and \a text. This |
148 Creates a new action with the given \a icon and \a text. This |
143 action is added to the end of the toolbar. |
149 action is added to the end of the toolbar. Toolbar retains ownership of the action. |
144 */ |
150 */ |
145 HbAction *HbToolBar::addAction( const HbIcon &icon, const QString &text ) |
151 HbAction *HbToolBar::addAction( const HbIcon &icon, const QString &text ) |
146 { |
152 { |
147 HbAction *action = new HbAction(icon, text, this); |
153 HbAction *action = new HbAction(icon, text, this); |
148 addAction(action); |
154 addAction(action); |
153 \overload |
159 \overload |
154 |
160 |
155 Creates a new action with the given \a text. This action is added to |
161 Creates a new action with the given \a text. This action is added to |
156 the end of the toolbar. The action's \link HbAction::triggered() |
162 the end of the toolbar. The action's \link HbAction::triggered() |
157 triggered()\endlink signal is connected to \a member in \a |
163 triggered()\endlink signal is connected to \a member in \a |
158 receiver. |
164 receiver. Toolbar retains ownership of the action. |
159 */ |
165 */ |
160 HbAction *HbToolBar::addAction( const QString &text, const QObject *receiver, const char *member ) |
166 HbAction *HbToolBar::addAction( const QString &text, const QObject *receiver, const char *member ) |
161 { |
167 { |
162 HbAction *action = new HbAction(text, this); |
168 HbAction *action = new HbAction(text, this); |
163 QObject::connect(action, SIGNAL(triggered(bool)), receiver, member); |
169 QObject::connect(action, SIGNAL(triggered(bool)), receiver, member); |
169 \overload |
175 \overload |
170 |
176 |
171 Creates a new action with the icon \a icon and text \a text. This |
177 Creates a new action with the icon \a icon and text \a text. This |
172 action is added to the end of the toolbar. The action's \link |
178 action is added to the end of the toolbar. The action's \link |
173 HbAction::triggered() triggered()\endlink signal is connected to \a |
179 HbAction::triggered() triggered()\endlink signal is connected to \a |
174 member in \a receiver. |
180 member in \a receiver. Toolbar retains ownership of the action. |
175 */ |
181 */ |
176 HbAction *HbToolBar::addAction( const HbIcon &icon, const QString &text, const QObject *receiver, const char *member ) |
182 HbAction *HbToolBar::addAction( const HbIcon &icon, const QString &text, const QObject *receiver, const char *member ) |
177 { |
183 { |
178 HbAction *action = new HbAction(icon, text, this); |
184 HbAction *action = new HbAction(icon, text, this); |
179 QObject::connect(action, SIGNAL(triggered(bool)), receiver, member); |
185 QObject::connect(action, SIGNAL(triggered(bool)), receiver, member); |
232 d->setOrientation ( orientation ); |
238 d->setOrientation ( orientation ); |
233 d->minimumToolButtonSize = QSizeF(); |
239 d->minimumToolButtonSize = QSizeF(); |
234 } |
240 } |
235 |
241 |
236 /*! |
242 /*! |
237 \deprecated HbToolBar::unsetOrientation() |
|
238 is deprecated. |
|
239 */ |
|
240 void HbToolBar::unsetOrientation() |
|
241 { |
|
242 //Q_D(HbToolBar); |
|
243 |
|
244 } |
|
245 |
|
246 /*! |
|
247 Emits areaChanged() whenever the tool bar's visibility or position changes. |
243 Emits areaChanged() whenever the tool bar's visibility or position changes. |
248 */ |
244 */ |
249 QVariant HbToolBar::itemChange( GraphicsItemChange change, const QVariant &value ) |
245 QVariant HbToolBar::itemChange( GraphicsItemChange change, const QVariant &value ) |
250 { |
246 { |
251 Q_D(HbToolBar); |
247 Q_D(HbToolBar); |
252 QVariant result = HbWidget::itemChange(change, value); |
248 QVariant result = HbWidget::itemChange(change, value); |
253 |
249 |
254 switch (change) { |
250 switch (change) { |
|
251 case ItemVisibleHasChanged: |
|
252 if (d->emitVisibilityChangeSignal && value.toBool()) { |
|
253 QMetaObject::invokeMethod(&d->core, "visibilityChanged", Qt::DirectConnection); |
|
254 d->emitVisibilityChangeSignal = false; |
|
255 } |
|
256 break; |
255 case ItemVisibleChange: |
257 case ItemVisibleChange: |
256 if (d->mOrientationEffectsRunning) |
258 if (d->mOrientationEffectsRunning) |
257 return result; |
259 return result; |
258 if (value.toBool()) { |
260 if (value.toBool()) { |
259 if (d->mDoLayout && d->mDoLayoutPending) { |
261 if (d->mDoLayout && d->mDoLayoutPending) { |
260 d->doLayout(); |
262 d->doLayout(); |
261 } |
|
262 if (d->emitVisibilityChangeSignal && value.toBool()) { |
|
263 QMetaObject::invokeMethod(&d->core, "visibilityChanged", Qt::QueuedConnection); |
|
264 d->emitVisibilityChangeSignal = false; |
|
265 } |
263 } |
266 if (!d->mDialogToolBar) { |
264 if (!d->mDialogToolBar) { |
267 d->doLazyInit(); |
265 d->doLazyInit(); |
268 d->delayedStartEffects = d->mDoLayoutPending && !d->mSuppressNextAppearEffect; |
266 d->delayedStartEffects = d->mDoLayoutPending && !d->mSuppressNextAppearEffect; |
269 if (!d->delayedStartEffects && d->hasEffects && !d->mSuppressNextAppearEffect) { |
267 if (!d->delayedStartEffects && d->hasEffects && !d->mSuppressNextAppearEffect) { |
310 { |
308 { |
311 Q_D(HbToolBar); |
309 Q_D(HbToolBar); |
312 if (event->type() == QEvent::LayoutDirectionChange) { |
310 if (event->type() == QEvent::LayoutDirectionChange) { |
313 d->updateToolBarExtensions(); |
311 d->updateToolBarExtensions(); |
314 d->updateButtonsLayoutDirection(); |
312 d->updateButtonsLayoutDirection(); |
315 } |
|
316 |
|
317 if (event->type() == QEvent::ParentChange && parentItem()) { |
|
318 setPos(-1000, -1000); // Not very nice workaround to toolbar flicker problem. |
|
319 // We will find a better solution later. |
|
320 } |
313 } |
321 |
314 |
322 QGraphicsWidget::changeEvent(event); |
315 QGraphicsWidget::changeEvent(event); |
323 } |
316 } |
324 |
317 |