straight copy of qt4 branch over to trunk, merge refused to work
git-svn-id: svn://svn.code.sf.net/p/qjoypad/code/trunk@95 c05e91a0-76c8-4ec0-b377-ef19ce7cc080
This commit is contained in:
committed by
virtuoussin13
parent
c1ef3fa0b7
commit
345bb5748e
41
src/icon.cpp
41
src/icon.cpp
@ -1,30 +1,33 @@
|
||||
#include "icon.h"
|
||||
|
||||
#include <qpopupmenu.h>
|
||||
|
||||
FloatingIcon::FloatingIcon( const QPixmap &icon, QPopupMenu *popup, QWidget *parent, const char *name)
|
||||
: QDialog( parent, name ) {
|
||||
setCaption(NAME);
|
||||
setPaletteBackgroundPixmap(icon);
|
||||
pop = popup;
|
||||
FloatingIcon::FloatingIcon( const QPixmap &icon, QMenu *popup, QWidget *parent, const char *name)
|
||||
: QDialog( parent ) {
|
||||
this->setObjectName(name);
|
||||
setWindowTitle(NAME);
|
||||
QPalette palette;
|
||||
palette.setBrush(backgroundRole(), QBrush(icon));
|
||||
setPalette(palette);
|
||||
//setPaletteBackgroundPixmap(icon);
|
||||
pop = popup;
|
||||
|
||||
setFixedSize(64,64);
|
||||
setFixedSize(64,64);
|
||||
}
|
||||
|
||||
void FloatingIcon::mousePressEvent( QMouseEvent* e ) {
|
||||
//if it was the right mouse button,
|
||||
if (e->button() == RightButton) {
|
||||
//bring up the popup menu.
|
||||
pop->popup( e->globalPos() );
|
||||
e->accept();
|
||||
}
|
||||
else {
|
||||
//otherwise, treat it as a regular click.
|
||||
emit clicked();
|
||||
}
|
||||
//if it was the right mouse button,
|
||||
if (e->button() == Qt::RightButton) {
|
||||
//bring up the popup menu.
|
||||
pop->popup( e->globalPos() );
|
||||
e->accept();
|
||||
}
|
||||
else {
|
||||
//otherwise, treat it as a regular click.
|
||||
emit clicked();
|
||||
}
|
||||
}
|
||||
|
||||
void FloatingIcon::closeEvent( QCloseEvent* e ) {
|
||||
emit closed();
|
||||
e->accept();
|
||||
emit closed();
|
||||
e->accept();
|
||||
}
|
||||
|
Reference in New Issue
Block a user