src/hbcore/gui/hbpopupmanager.cpp
changeset 21 4633027730f5
parent 6 c3690ec91ef8
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    43 #include <QEvent>
    43 #include <QEvent>
    44 
    44 
    45 HbPopupLayoutSpacer::HbPopupLayoutSpacer( QGraphicsItem *parent )
    45 HbPopupLayoutSpacer::HbPopupLayoutSpacer( QGraphicsItem *parent )
    46 : HbWidgetBase( parent )
    46 : HbWidgetBase( parent )
    47 {
    47 {
    48 #if QT_VERSION >= 0x040600
       
    49     setFlag(QGraphicsItem::ItemHasNoContents, true);
    48     setFlag(QGraphicsItem::ItemHasNoContents, true);
    50 #endif
       
    51     setAcceptedMouseButtons(Qt::NoButton);
    49     setAcceptedMouseButtons(Qt::NoButton);
    52 }
    50 }
    53 
    51 
    54 QSizeF HbPopupLayoutSpacer::sizeHint(Qt::SizeHint which, const QSizeF &constraint ) const
    52 QSizeF HbPopupLayoutSpacer::sizeHint(Qt::SizeHint which, const QSizeF &constraint ) const
    55 {
    53 {
    59         return QSizeF( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX );
    57         return QSizeF( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX );
    60     }
    58     }
    61     return QSizeF(0.f,0.f);
    59     return QSizeF(0.f,0.f);
    62 }
    60 }
    63 
    61 
    64 /*
       
    65 \reimp
       
    66 */
       
    67 void HbPopupLayoutSpacer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
       
    68 {
       
    69     Q_UNUSED(option)
       
    70     Q_UNUSED(widget);
       
    71     Q_UNUSED(painter);
       
    72 }
       
    73 
       
    74 
       
    75 HbPopupLayoutProxy::HbPopupLayoutProxy( HbPopup *popup, QGraphicsItem *parent )
    62 HbPopupLayoutProxy::HbPopupLayoutProxy( HbPopup *popup, QGraphicsItem *parent )
    76 : HbWidgetBase(parent), mPopup(popup)
    63 : HbWidgetBase(parent), mPopup(popup)
    77 {
    64 {
    78 #if QT_VERSION >= 0x040600
       
    79     setFlag(QGraphicsItem::ItemHasNoContents, true);
    65     setFlag(QGraphicsItem::ItemHasNoContents, true);
    80 #endif
       
    81     setAcceptedMouseButtons(Qt::NoButton);
    66     setAcceptedMouseButtons(Qt::NoButton);
    82     popup->installEventFilter(this);
    67     popup->installEventFilter(this);
    83 }
    68 }
    84 
    69 
    85 QSizeF HbPopupLayoutProxy::sizeHint(Qt::SizeHint which, const QSizeF &constraint ) const
    70 QSizeF HbPopupLayoutProxy::sizeHint(Qt::SizeHint which, const QSizeF &constraint ) const
   193             break;
   178             break;
   194     }
   179     }
   195     return false;
   180     return false;
   196 }
   181 }
   197 
   182 
   198 
       
   199 /*
       
   200 \reimp
       
   201 */
       
   202 void HbPopupLayoutProxy::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
       
   203 {
       
   204     Q_UNUSED(option);
       
   205     Q_UNUSED(widget);
       
   206     Q_UNUSED(painter);
       
   207 }
       
   208 
       
   209 HbPopupLayoutManager::HbPopupLayoutManager( HbPopup *popup, QGraphicsScene *scene ) 
   183 HbPopupLayoutManager::HbPopupLayoutManager( HbPopup *popup, QGraphicsScene *scene ) 
   210 : HbWidget()
   184 : HbWidget()
   211 {        
   185 {        
   212 #if QT_VERSION >= 0x040600
       
   213     setFlag(QGraphicsItem::ItemHasNoContents, true);
   186     setFlag(QGraphicsItem::ItemHasNoContents, true);
   214 #endif
       
   215     setAcceptedMouseButtons(Qt::NoButton);
   187     setAcceptedMouseButtons(Qt::NoButton);
   216     scene->addItem( this );
   188     scene->addItem( this );
       
   189     //adjust the size of popuplayoutmanager to its preferredSize
       
   190     //since it defines the geometries of popups.
       
   191     adjustSize();
   217 
   192 
   218     // create proxy
   193     // create proxy
   219     HbPopupLayoutProxy *childItem = new HbPopupLayoutProxy( popup, this );
   194     HbPopupLayoutProxy *childItem = new HbPopupLayoutProxy( popup, this );
   220 
   195 
   221     // create spacers
   196     // create spacers
   272     HbWidget::changeEvent(event);
   247     HbWidget::changeEvent(event);
   273     if (event && event->type() == QEvent::LayoutDirectionChange) {
   248     if (event && event->type() == QEvent::LayoutDirectionChange) {
   274         repolish();
   249         repolish();
   275     }
   250     }
   276 
   251 
   277 }
       
   278 
       
   279 /*
       
   280 \reimp
       
   281 */
       
   282 void HbPopupLayoutManager::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
       
   283 {
       
   284     Q_UNUSED(option)
       
   285     Q_UNUSED(widget);
       
   286     Q_UNUSED(painter);
       
   287 }
   252 }
   288 
   253 
   289 
   254 
   290 /*
   255 /*
   291     \class HbPopupManagerPrivate
   256     \class HbPopupManagerPrivate