Diffstat (limited to 'libopie2/opieui/opopupmenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/opopupmenu.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp index 50c613f..5ce048e 100644 --- a/libopie2/opieui/opopupmenu.cpp +++ b/libopie2/opieui/opopupmenu.cpp @@ -64,49 +64,49 @@ void OPopupTitle::setTitle(const QString &text, const QPixmap *icon) int h = QMAX( fontMetrics().height(), miniicon.height() ); setMinimumSize( w+16, h+8 ); } void OPopupTitle::setText( const QString &text ) { titleStr = text; int w = miniicon.width()+fontMetrics().width(titleStr); int h = QMAX( fontMetrics().height(), miniicon.height() ); setMinimumSize( w+16, h+8 ); } void OPopupTitle::setIcon( const QPixmap &pix ) { miniicon = pix; int w = miniicon.width()+fontMetrics().width(titleStr); int h = QMAX( fontMetrics().height(), miniicon.height() ); setMinimumSize( w+16, h+8 ); } void OPopupTitle::paintEvent(QPaintEvent *) { QRect r(rect()); QPainter p(this); - #if QT_VERSION > 290 + #if QT_VERSION >= 0x030000 qApp->style().drawPrimitive(QStyle::PE_HeaderSection, &p, r, palette().active()); #else #warning OPopupMenu is not fully functional on Qt2 #endif if (!miniicon.isNull()) p.drawPixmap(4, (r.height()-miniicon.height())/2, miniicon); if (!titleStr.isNull()) { p.setPen(palette().active().text()); QFont f = p.font(); f.setBold(true); p.setFont(f); if(!miniicon.isNull()) { p.drawText(miniicon.width()+8, 0, width()-(miniicon.width()+8), height(), AlignLeft | AlignVCenter | SingleLine, titleStr); } else { p.drawText(0, 0, width(), height(), AlignCenter | SingleLine, titleStr); @@ -528,49 +528,49 @@ void OPopupMenu::showCtxMenu(QPoint pos) } OPopupMenuPrivate::s_contextedMenu = this; d->m_ctxMenu->popup(this->mapToGlobal(pos)); connect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int))); } void OPopupMenu::ctxMenuHiding() { disconnect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int))); OPopupMenuPrivate::s_continueCtxMenuShow = true; } bool OPopupMenu::eventFilter(QObject* obj, QEvent* event) { if (d->m_ctxMenu && obj == this) { if (event->type() == QEvent::MouseButtonRelease) { if (d->m_ctxMenu->isVisible()) { return true; } } - #if QT_VERSION > 290 + #if QT_VERSION >= 0x030000 else if (event->type() == QEvent::ContextMenu) #else else if ( (event->type() == QEvent::MouseButtonPress) && ( (QMouseEvent*) event )->button() == QMouseEvent::RightButton ) #endif { showCtxMenu(mapFromGlobal(QCursor::pos())); return true; } } return QWidget::eventFilter(obj, event); } void OPopupMenu::hideEvent(QHideEvent*) { if (d->m_ctxMenu) { d->m_ctxMenu->hide(); } } /** * end of RMB menus on menus support */ |