mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdeui: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4c5361d34d
commit
673a5e02bd
2 changed files with 302 additions and 304 deletions
|
@ -51,20 +51,19 @@ class KPassivePopup::Private
|
|||
{
|
||||
public:
|
||||
Private()
|
||||
: popupStyle( DEFAULT_POPUP_TYPE ),
|
||||
msgView(0),
|
||||
topLayout(0),
|
||||
hideDelay( DEFAULT_POPUP_TIME ),
|
||||
hideTimer(0),
|
||||
autoDelete( false )
|
||||
: popupStyle(DEFAULT_POPUP_TYPE),
|
||||
msgView(0),
|
||||
topLayout(0),
|
||||
hideDelay(DEFAULT_POPUP_TIME),
|
||||
hideTimer(0),
|
||||
autoDelete(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int popupStyle;
|
||||
QPolygon surround;
|
||||
QPoint anchor;
|
||||
QPoint fixedPosition;
|
||||
QPoint anchor;
|
||||
QPoint fixedPosition;
|
||||
|
||||
WId window;
|
||||
QWidget *msgView;
|
||||
|
@ -79,41 +78,38 @@ public:
|
|||
bool autoDelete;
|
||||
};
|
||||
|
||||
KPassivePopup::KPassivePopup( QWidget *parent, Qt::WindowFlags f )
|
||||
: QFrame( 0, f ? f : POPUP_FLAGS ),
|
||||
KPassivePopup::KPassivePopup(QWidget *parent, Qt::WindowFlags f)
|
||||
: QFrame(nullptr, f ? f : POPUP_FLAGS),
|
||||
d(new Private())
|
||||
{
|
||||
init( parent ? parent->effectiveWinId() : 0L );
|
||||
init(parent ? parent->effectiveWinId() : 0);
|
||||
}
|
||||
|
||||
KPassivePopup::KPassivePopup( WId win )
|
||||
: QFrame( 0 ),
|
||||
d(new Private())
|
||||
KPassivePopup::KPassivePopup(WId win)
|
||||
: QFrame(nullptr),
|
||||
d(new Private())
|
||||
{
|
||||
init( win );
|
||||
init(win);
|
||||
}
|
||||
|
||||
void KPassivePopup::init( WId window )
|
||||
void KPassivePopup::init(WId window)
|
||||
{
|
||||
d->window = window;
|
||||
d->hideTimer = new QTimer( this );
|
||||
d->hideTimer = new QTimer(this);
|
||||
|
||||
setWindowFlags( POPUP_FLAGS );
|
||||
setFrameStyle( QFrame::Box| QFrame::Plain );
|
||||
setLineWidth( 2 );
|
||||
setWindowFlags(POPUP_FLAGS);
|
||||
setFrameStyle(QFrame::Box| QFrame::Plain);
|
||||
setLineWidth(2);
|
||||
|
||||
if( d->popupStyle == Boxed )
|
||||
{
|
||||
setFrameStyle( QFrame::Box| QFrame::Plain );
|
||||
setLineWidth( 2 );
|
||||
}
|
||||
else if( d->popupStyle == Balloon )
|
||||
{
|
||||
if (d->popupStyle == KPassivePopup::Boxed) {
|
||||
setFrameStyle(QFrame::Box| QFrame::Plain);
|
||||
setLineWidth(2);
|
||||
} else if(d->popupStyle == KPassivePopup::Balloon) {
|
||||
setPalette(QToolTip::palette());
|
||||
//XXX dead ? setAutoMask(true);
|
||||
// XXX dead ? setAutoMask(true);
|
||||
}
|
||||
connect( d->hideTimer, SIGNAL(timeout()), SLOT(hide()) );
|
||||
connect( this, SIGNAL(clicked()), SLOT(hide()) );
|
||||
connect(d->hideTimer, SIGNAL(timeout()), this, SLOT(hide()));
|
||||
connect(this, SIGNAL(clicked()), this, SLOT(hide()));
|
||||
}
|
||||
|
||||
KPassivePopup::~KPassivePopup()
|
||||
|
@ -121,78 +117,77 @@ KPassivePopup::~KPassivePopup()
|
|||
delete d;
|
||||
}
|
||||
|
||||
void KPassivePopup::setPopupStyle( int popupstyle )
|
||||
void KPassivePopup::setPopupStyle(int popupstyle)
|
||||
{
|
||||
if ( d->popupStyle == popupstyle )
|
||||
if (d->popupStyle == popupstyle) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->popupStyle = popupstyle;
|
||||
if( d->popupStyle == Boxed )
|
||||
{
|
||||
setFrameStyle( QFrame::Box| QFrame::Plain );
|
||||
setLineWidth( 2 );
|
||||
}
|
||||
else if( d->popupStyle == Balloon )
|
||||
{
|
||||
if (d->popupStyle == KPassivePopup::Boxed) {
|
||||
setFrameStyle(QFrame::Box| QFrame::Plain);
|
||||
setLineWidth(2);
|
||||
} else if(d->popupStyle == KPassivePopup::Balloon) {
|
||||
setPalette(QToolTip::palette());
|
||||
//XXX dead ? setAutoMask(true);
|
||||
// XXX dead ? setAutoMask(true);
|
||||
}
|
||||
}
|
||||
|
||||
void KPassivePopup::setView( QWidget *child )
|
||||
void KPassivePopup::setView(QWidget *child)
|
||||
{
|
||||
delete d->msgView;
|
||||
d->msgView = child;
|
||||
|
||||
delete d->topLayout;
|
||||
d->topLayout = new QVBoxLayout( this );
|
||||
if ( d->popupStyle == Balloon ) {
|
||||
d->topLayout->setMargin( 2 * KDialog::marginHint() );
|
||||
d->topLayout = new QVBoxLayout(this);
|
||||
if (d->popupStyle == KPassivePopup::Balloon) {
|
||||
d->topLayout->setMargin(2 * KDialog::marginHint());
|
||||
}
|
||||
d->topLayout->addWidget( d->msgView );
|
||||
d->topLayout->addWidget(d->msgView);
|
||||
d->topLayout->activate();
|
||||
}
|
||||
|
||||
void KPassivePopup::setView( const QString &caption, const QString &text,
|
||||
const QPixmap &icon )
|
||||
void KPassivePopup::setView(const QString &caption, const QString &text,
|
||||
const QPixmap &icon)
|
||||
{
|
||||
// kDebug() << "KPassivePopup::setView " << caption << ", " << text;
|
||||
setView( standardView( caption, text, icon, this ) );
|
||||
setView(standardView(caption, text, icon, this));
|
||||
}
|
||||
|
||||
|
||||
KVBox * KPassivePopup::standardView( const QString& caption,
|
||||
const QString& text,
|
||||
const QPixmap& icon,
|
||||
QWidget *parent )
|
||||
KVBox* KPassivePopup::standardView(const QString &caption,
|
||||
const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent)
|
||||
{
|
||||
KVBox *vb = new KVBox( parent ? parent : this );
|
||||
vb->setSpacing( -1 );
|
||||
KVBox *vb = new KVBox(parent ? parent : this);
|
||||
vb->setSpacing(-1);
|
||||
|
||||
KHBox *hb=0;
|
||||
if ( !icon.isNull() ) {
|
||||
hb = new KHBox( vb );
|
||||
hb->setMargin( 0 );
|
||||
hb->setSpacing( -1 );
|
||||
d->ttlIcon = new QLabel( hb );
|
||||
d->ttlIcon->setPixmap( icon );
|
||||
d->ttlIcon->setAlignment( Qt::AlignLeft );
|
||||
if (!icon.isNull()) {
|
||||
hb = new KHBox(vb);
|
||||
hb->setMargin(0);
|
||||
hb->setSpacing(-1);
|
||||
d->ttlIcon = new QLabel(hb);
|
||||
d->ttlIcon->setPixmap(icon);
|
||||
d->ttlIcon->setAlignment(Qt::AlignLeft);
|
||||
}
|
||||
|
||||
if ( !caption.isEmpty() ) {
|
||||
d->ttl = new QLabel( caption, hb ? hb : vb );
|
||||
QFont fnt = d->ttl->font();
|
||||
fnt.setBold( true );
|
||||
d->ttl->setFont( fnt );
|
||||
d->ttl->setAlignment( Qt::AlignHCenter );
|
||||
if (!caption.isEmpty()) {
|
||||
d->ttl = new QLabel(caption, hb ? hb : vb);
|
||||
QFont fnt = d->ttl->font();
|
||||
fnt.setBold(true);
|
||||
d->ttl->setFont(fnt);
|
||||
d->ttl->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
if ( hb )
|
||||
hb->setStretchFactor( d->ttl, 10 ); // enforce centering
|
||||
if (hb) {
|
||||
hb->setStretchFactor(d->ttl, 10); // enforce centering
|
||||
}
|
||||
}
|
||||
|
||||
if ( !text.isEmpty() ) {
|
||||
d->msg = new QLabel( text, vb );
|
||||
d->msg->setAlignment( Qt::AlignLeft );
|
||||
if (!text.isEmpty()) {
|
||||
d->msg = new QLabel(text, vb);
|
||||
d->msg->setAlignment(Qt::AlignLeft);
|
||||
d->msg->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||
d->msg->setOpenExternalLinks(true);
|
||||
}
|
||||
|
@ -200,12 +195,12 @@ KVBox * KPassivePopup::standardView( const QString& caption,
|
|||
return vb;
|
||||
}
|
||||
|
||||
void KPassivePopup::setView( const QString &caption, const QString &text )
|
||||
void KPassivePopup::setView(const QString &caption, const QString &text)
|
||||
{
|
||||
setView( caption, text, QPixmap() );
|
||||
setView(caption, text, QPixmap());
|
||||
}
|
||||
|
||||
QWidget *KPassivePopup::view() const
|
||||
QWidget* KPassivePopup::view() const
|
||||
{
|
||||
return d->msgView;
|
||||
}
|
||||
|
@ -215,13 +210,12 @@ int KPassivePopup::timeout() const
|
|||
return d->hideDelay;
|
||||
}
|
||||
|
||||
void KPassivePopup::setTimeout( int delay )
|
||||
void KPassivePopup::setTimeout(int delay)
|
||||
{
|
||||
d->hideDelay = delay;
|
||||
if( d->hideTimer->isActive() )
|
||||
{
|
||||
if( delay ) {
|
||||
d->hideTimer->start( delay );
|
||||
if (d->hideTimer->isActive()) {
|
||||
if (delay) {
|
||||
d->hideTimer->start(delay);
|
||||
} else {
|
||||
d->hideTimer->stop();
|
||||
}
|
||||
|
@ -233,48 +227,50 @@ bool KPassivePopup::autoDelete() const
|
|||
return d->autoDelete;
|
||||
}
|
||||
|
||||
void KPassivePopup::setAutoDelete( bool autoDelete )
|
||||
void KPassivePopup::setAutoDelete(bool autoDelete)
|
||||
{
|
||||
d->autoDelete = autoDelete;
|
||||
}
|
||||
|
||||
void KPassivePopup::mouseReleaseEvent( QMouseEvent *e )
|
||||
void KPassivePopup::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
emit clicked();
|
||||
emit clicked( e->pos() );
|
||||
emit clicked(e->pos());
|
||||
}
|
||||
|
||||
//
|
||||
// Main Implementation
|
||||
//
|
||||
|
||||
void KPassivePopup::setVisible( bool visible )
|
||||
void KPassivePopup::setVisible(bool visible)
|
||||
{
|
||||
if (! visible ) {
|
||||
QFrame::setVisible( visible );
|
||||
if (!visible) {
|
||||
QFrame::setVisible(visible);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( size() != sizeHint() )
|
||||
resize( sizeHint() );
|
||||
|
||||
if ( d->fixedPosition.isNull() )
|
||||
positionSelf();
|
||||
else {
|
||||
if( d->popupStyle == Balloon )
|
||||
setAnchor( d->fixedPosition );
|
||||
else
|
||||
move( d->fixedPosition );
|
||||
if (size() != sizeHint()) {
|
||||
resize(sizeHint());
|
||||
}
|
||||
QFrame::setVisible( /*visible=*/ true );
|
||||
|
||||
if (d->fixedPosition.isNull()) {
|
||||
positionSelf();
|
||||
} else {
|
||||
if (d->popupStyle == KPassivePopup::Balloon) {
|
||||
setAnchor(d->fixedPosition);
|
||||
} else {
|
||||
move(d->fixedPosition);
|
||||
}
|
||||
}
|
||||
QFrame::setVisible(/*visible=*/ true );
|
||||
|
||||
int delay = d->hideDelay;
|
||||
if ( delay < 0 ) {
|
||||
if (delay < 0) {
|
||||
delay = DEFAULT_POPUP_TIME;
|
||||
}
|
||||
|
||||
if ( delay > 0 ) {
|
||||
d->hideTimer->start( delay );
|
||||
if (delay > 0) {
|
||||
d->hideTimer->start(delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,101 +285,110 @@ void KPassivePopup::show(const QPoint &p)
|
|||
show();
|
||||
}
|
||||
|
||||
void KPassivePopup::hideEvent( QHideEvent * )
|
||||
void KPassivePopup::hideEvent(QHideEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
d->hideTimer->stop();
|
||||
if ( d->autoDelete )
|
||||
if (d->autoDelete) {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
QRect KPassivePopup::defaultArea() const
|
||||
{
|
||||
NETRootInfo info( QX11Info::display(),
|
||||
NET::NumberOfDesktops |
|
||||
NET::CurrentDesktop |
|
||||
NET::WorkArea,
|
||||
-1, false );
|
||||
NETRootInfo info(
|
||||
QX11Info::display(),
|
||||
NET::NumberOfDesktops | NET::CurrentDesktop | NET::WorkArea,
|
||||
-1, false
|
||||
);
|
||||
info.activate();
|
||||
NETRect workArea = info.workArea( info.currentDesktop() );
|
||||
return QRect( workArea.pos.x, workArea.pos.y, 0, 0 ); // top left
|
||||
NETRect workArea = info.workArea(info.currentDesktop());
|
||||
return QRect(workArea.pos.x, workArea.pos.y, 0, 0); // top left
|
||||
}
|
||||
|
||||
void KPassivePopup::positionSelf()
|
||||
{
|
||||
QRect target;
|
||||
if ( !d->window ) {
|
||||
if (!d->window) {
|
||||
target = defaultArea();
|
||||
} else {
|
||||
NETWinInfo ni( QX11Info::display(), d->window, QX11Info::appRootWindow(),
|
||||
NET::WMIconGeometry );
|
||||
NETWinInfo info(
|
||||
QX11Info::display(), d->window, QX11Info::appRootWindow(),
|
||||
NET::WMIconGeometry
|
||||
);
|
||||
|
||||
// Figure out where to put the popup. Note that we must handle
|
||||
// windows that skip the taskbar cleanly
|
||||
if ( ni.state() & NET::SkipTaskbar ) {
|
||||
if (info.state() & NET::SkipTaskbar) {
|
||||
target = defaultArea();
|
||||
} else {
|
||||
NETRect r = ni.iconGeometry();
|
||||
target.setRect( r.pos.x, r.pos.y, r.size.width, r.size.height );
|
||||
if ( target.isNull() ) { // bogus value, use the exact position
|
||||
NETRect dummy;
|
||||
ni.kdeGeometry( dummy, r );
|
||||
target.setRect( r.pos.x, r.pos.y,
|
||||
r.size.width, r.size.height);
|
||||
}
|
||||
NETRect r = info.iconGeometry();
|
||||
target.setRect(r.pos.x, r.pos.y, r.size.width, r.size.height);
|
||||
if (target.isNull()) {
|
||||
// bogus value, use the exact position
|
||||
NETRect dummy;
|
||||
info.kdeGeometry(dummy, r);
|
||||
target.setRect(r.pos.x, r.pos.y, r.size.width, r.size.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
moveNear( target );
|
||||
moveNear(target);
|
||||
}
|
||||
|
||||
void KPassivePopup::moveNear( const QRect &target )
|
||||
void KPassivePopup::moveNear(const QRect &target)
|
||||
{
|
||||
QPoint pos = calculateNearbyPoint(target);
|
||||
if( d->popupStyle == Balloon )
|
||||
setAnchor( pos );
|
||||
else
|
||||
move( pos.x(), pos.y() );
|
||||
if (d->popupStyle == KPassivePopup::Balloon) {
|
||||
setAnchor(pos);
|
||||
} else {
|
||||
move(pos.x(), pos.y());
|
||||
}
|
||||
}
|
||||
|
||||
QPoint KPassivePopup::calculateNearbyPoint( const QRect &target) {
|
||||
QPoint KPassivePopup::calculateNearbyPoint(const QRect &target)
|
||||
{
|
||||
QPoint pos = target.topLeft();
|
||||
int x = pos.x();
|
||||
int y = pos.y();
|
||||
int w = minimumSizeHint().width();
|
||||
int h = minimumSizeHint().height();
|
||||
|
||||
QRect r = KGlobalSettings::desktopGeometry(QPoint(x+w/2,y+h/2));
|
||||
QRect r = KGlobalSettings::desktopGeometry(QPoint(x + w / 2,y + h / 2));
|
||||
|
||||
if( d->popupStyle == Balloon )
|
||||
{
|
||||
if (d->popupStyle == KPassivePopup::Balloon) {
|
||||
// find a point to anchor to
|
||||
if( x + w > r.width() ){
|
||||
if (x + w > r.width()) {
|
||||
x = x + target.width();
|
||||
}
|
||||
|
||||
if( y + h > r.height() ){
|
||||
if (y + h > r.height()) {
|
||||
y = y + target.height();
|
||||
}
|
||||
} else
|
||||
{
|
||||
if ( x < r.center().x() )
|
||||
} else {
|
||||
if (x < r.center().x()) {
|
||||
x = x + target.width();
|
||||
else
|
||||
} else {
|
||||
x = x - w;
|
||||
}
|
||||
|
||||
// It's apparently trying to go off screen, so display it ALL at the bottom.
|
||||
if ( (y + h) > r.bottom() )
|
||||
if ((y + h) > r.bottom()) {
|
||||
y = r.bottom() - h;
|
||||
}
|
||||
|
||||
if ( (x + w) > r.right() )
|
||||
if ((x + w) > r.right()) {
|
||||
x = r.right() - w;
|
||||
}
|
||||
}
|
||||
if ( y < r.top() )
|
||||
if (y < r.top()) {
|
||||
y = r.top();
|
||||
}
|
||||
|
||||
if ( x < r.left() )
|
||||
if (x < r.left()) {
|
||||
x = r.left();
|
||||
}
|
||||
|
||||
return QPoint( x, y );
|
||||
return QPoint(x, y);
|
||||
}
|
||||
|
||||
QPoint KPassivePopup::anchor() const
|
||||
|
@ -397,15 +402,15 @@ void KPassivePopup::setAnchor(const QPoint &anchor)
|
|||
updateMask();
|
||||
}
|
||||
|
||||
void KPassivePopup::paintEvent( QPaintEvent* pe )
|
||||
void KPassivePopup::paintEvent(QPaintEvent* pe)
|
||||
{
|
||||
if( d->popupStyle == Balloon )
|
||||
{
|
||||
if (d->popupStyle == KPassivePopup::Balloon) {
|
||||
QPainter p;
|
||||
p.begin( this );
|
||||
p.drawPolygon( d->surround );
|
||||
} else
|
||||
QFrame::paintEvent( pe );
|
||||
p.begin(this);
|
||||
p.drawPolygon(d->surround);
|
||||
} else {
|
||||
QFrame::paintEvent(pe);
|
||||
}
|
||||
}
|
||||
|
||||
void KPassivePopup::updateMask()
|
||||
|
@ -415,73 +420,76 @@ void KPassivePopup::updateMask()
|
|||
QRect deskRect = KGlobalSettings::desktopGeometry(d->anchor);
|
||||
|
||||
int xh = 70, xl = 40;
|
||||
if( width() < 80 )
|
||||
if (width() < 80) {
|
||||
xh = xl = 40;
|
||||
else if( width() < 110 )
|
||||
} else if(width() < 110) {
|
||||
xh = width() - 40;
|
||||
}
|
||||
|
||||
bool bottom = (d->anchor.y() + height()) > ((deskRect.y() + deskRect.height()-48));
|
||||
bool right = (d->anchor.x() + width()) > ((deskRect.x() + deskRect.width()-48));
|
||||
|
||||
QPoint corners[4] = {
|
||||
QPoint( width() - 50, 10 ),
|
||||
QPoint( 10, 10 ),
|
||||
QPoint( 10, height() - 50 ),
|
||||
QPoint( width() - 50, height() - 50 )
|
||||
QPoint(width() - 50, 10),
|
||||
QPoint(10, 10),
|
||||
QPoint(10, height() - 50),
|
||||
QPoint(width() - 50, height() - 50)
|
||||
};
|
||||
|
||||
QBitmap mask( width(), height() );
|
||||
QBitmap mask(width(), height());
|
||||
mask.clear();
|
||||
QPainter p( &mask );
|
||||
QBrush brush( Qt::color1, Qt::SolidPattern );
|
||||
p.setBrush( brush );
|
||||
QPainter p(&mask);
|
||||
QBrush brush(Qt::color1, Qt::SolidPattern);
|
||||
p.setBrush(brush);
|
||||
|
||||
int i = 0, z = 0;
|
||||
for (; i < 4; ++i) {
|
||||
QPainterPath path;
|
||||
path.moveTo(corners[i].x(),corners[i].y());
|
||||
path.arcTo(corners[i].x(),corners[i].y(),40,40, i * 90 , 90);
|
||||
path.arcTo(corners[i].x(),corners[i].y(), 40, 40, i * 90 , 90);
|
||||
QPolygon corner = path.toFillPolygon().toPolygon();
|
||||
|
||||
d->surround.resize( z + corner.count() - 1 );
|
||||
d->surround.resize(z + corner.count() - 1);
|
||||
for (int s = 1; s < corner.count() - 1; s++, z++) {
|
||||
d->surround.setPoint( z, corner[s] );
|
||||
d->surround.setPoint(z, corner[s]);
|
||||
}
|
||||
|
||||
if (bottom && i == 2) {
|
||||
if (right) {
|
||||
d->surround.resize( z + 3 );
|
||||
d->surround.setPoint( z++, QPoint( width() - xh, height() - 10 ) );
|
||||
d->surround.setPoint( z++, QPoint( width() - 20, height() ) );
|
||||
d->surround.setPoint( z++, QPoint( width() - xl, height() - 10 ) );
|
||||
d->surround.resize(z + 3);
|
||||
d->surround.setPoint(z++, QPoint(width() - xh, height() - 10));
|
||||
d->surround.setPoint(z++, QPoint(width() - 20, height()));
|
||||
d->surround.setPoint(z++, QPoint(width() - xl, height() - 10));
|
||||
} else {
|
||||
d->surround.resize( z + 3 );
|
||||
d->surround.setPoint( z++, QPoint( xl, height() - 10 ) );
|
||||
d->surround.setPoint( z++, QPoint( 20, height() ) );
|
||||
d->surround.setPoint( z++, QPoint( xh, height() - 10 ) );
|
||||
d->surround.resize(z + 3);
|
||||
d->surround.setPoint(z++, QPoint(xl, height() - 10));
|
||||
d->surround.setPoint(z++, QPoint(20, height()));
|
||||
d->surround.setPoint(z++, QPoint(xh, height() - 10));
|
||||
}
|
||||
} else if (!bottom && i == 0) {
|
||||
if (right) {
|
||||
d->surround.resize( z + 3 );
|
||||
d->surround.setPoint( z++, QPoint( width() - xl, 10 ) );
|
||||
d->surround.setPoint( z++, QPoint( width() - 20, 0 ) );
|
||||
d->surround.setPoint( z++, QPoint( width() - xh, 10 ) );
|
||||
d->surround.resize(z + 3 );
|
||||
d->surround.setPoint(z++, QPoint(width() - xl, 10));
|
||||
d->surround.setPoint(z++, QPoint(width() - 20, 0));
|
||||
d->surround.setPoint(z++, QPoint(width() - xh, 10));
|
||||
} else {
|
||||
d->surround.resize( z + 3 );
|
||||
d->surround.setPoint( z++, QPoint( xh, 10 ) );
|
||||
d->surround.setPoint( z++, QPoint( 20, 0 ) );
|
||||
d->surround.setPoint( z++, QPoint( xl, 10 ) );
|
||||
d->surround.resize(z + 3 );
|
||||
d->surround.setPoint(z++, QPoint( xh, 10));
|
||||
d->surround.setPoint(z++, QPoint( 20, 0));
|
||||
d->surround.setPoint(z++, QPoint( xl, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d->surround.resize( z + 1 );
|
||||
d->surround.setPoint( z, d->surround[0] );
|
||||
p.drawPolygon( d->surround );
|
||||
d->surround.resize(z + 1);
|
||||
d->surround.setPoint(z, d->surround[0]);
|
||||
p.drawPolygon(d->surround);
|
||||
setMask(mask);
|
||||
|
||||
move( right ? d->anchor.x() - width() + 20 : ( d->anchor.x() < 11 ? 11 : d->anchor.x() - 20 ),
|
||||
bottom ? d->anchor.y() - height() : ( d->anchor.y() < 11 ? 11 : d->anchor.y() ) );
|
||||
move(
|
||||
right ? d->anchor.x() - width() + 20 : (d->anchor.x() < 11 ? 11 : d->anchor.x() - 20),
|
||||
bottom ? d->anchor.y() - height() : (d->anchor.y() < 11 ? 11 : d->anchor.y())
|
||||
);
|
||||
|
||||
update();
|
||||
}
|
||||
|
@ -490,115 +498,107 @@ void KPassivePopup::updateMask()
|
|||
// Convenience Methods
|
||||
//
|
||||
|
||||
KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout )
|
||||
KPassivePopup *KPassivePopup::message(const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout)
|
||||
{
|
||||
return message( DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout );
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( const QString &text, QWidget *parent )
|
||||
KPassivePopup *KPassivePopup::message( const QString &text, QWidget *parent)
|
||||
{
|
||||
return message( DEFAULT_POPUP_TYPE, QString(), text, QPixmap(), parent );
|
||||
return message(DEFAULT_POPUP_TYPE, QString(), text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
|
||||
QWidget *parent )
|
||||
KPassivePopup *KPassivePopup::message(const QString &caption, const QString &text,
|
||||
QWidget *parent)
|
||||
{
|
||||
return message( DEFAULT_POPUP_TYPE, caption, text, QPixmap(), parent );
|
||||
return message(DEFAULT_POPUP_TYPE, caption, text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
|
||||
const QPixmap &icon, WId parent, int timeout )
|
||||
KPassivePopup *KPassivePopup::message(const QString &caption, const QString &text,
|
||||
const QPixmap &icon, WId parent, int timeout)
|
||||
{
|
||||
return message( DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout );
|
||||
return message(DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout )
|
||||
KPassivePopup *KPassivePopup::message(const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout)
|
||||
{
|
||||
return message( DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout );
|
||||
return message(DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( const QString &text, QSystemTrayIcon *parent )
|
||||
KPassivePopup *KPassivePopup::message(const QString &text, QSystemTrayIcon *parent)
|
||||
{
|
||||
return message( DEFAULT_POPUP_TYPE, QString(), text, QPixmap(), parent );
|
||||
return message(DEFAULT_POPUP_TYPE, QString(), text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent )
|
||||
KPassivePopup *KPassivePopup::message(const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent)
|
||||
{
|
||||
return message( DEFAULT_POPUP_TYPE, caption, text, QPixmap(), parent );
|
||||
return message(DEFAULT_POPUP_TYPE, caption, text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
|
||||
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout )
|
||||
KPassivePopup *KPassivePopup::message(int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout)
|
||||
{
|
||||
KPassivePopup *pop = new KPassivePopup( parent );
|
||||
pop->setPopupStyle( popupStyle );
|
||||
pop->setAutoDelete( true );
|
||||
pop->setView( caption, text, icon );
|
||||
KPassivePopup *pop = new KPassivePopup(parent);
|
||||
pop->setPopupStyle(popupStyle);
|
||||
pop->setAutoDelete(true);
|
||||
pop->setView(caption, text, icon);
|
||||
pop->d->hideDelay = timeout;
|
||||
pop->show();
|
||||
|
||||
return pop;
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &text, QWidget *parent )
|
||||
KPassivePopup *KPassivePopup::message(int popupStyle, const QString &text, QWidget *parent)
|
||||
{
|
||||
return message( popupStyle, QString(), text, QPixmap(), parent );
|
||||
return message(popupStyle, QString(), text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
|
||||
QWidget *parent )
|
||||
KPassivePopup *KPassivePopup::message(int popupStyle, const QString &caption, const QString &text,
|
||||
QWidget *parent)
|
||||
{
|
||||
return message( popupStyle, caption, text, QPixmap(), parent );
|
||||
return message(popupStyle, caption, text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon, WId parent, int timeout )
|
||||
KPassivePopup *KPassivePopup::message(int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon, WId parent, int timeout)
|
||||
{
|
||||
KPassivePopup *pop = new KPassivePopup( parent );
|
||||
pop->setPopupStyle( popupStyle );
|
||||
pop->setAutoDelete( true );
|
||||
pop->setView( caption, text, icon );
|
||||
KPassivePopup *pop = new KPassivePopup(parent);
|
||||
pop->setPopupStyle(popupStyle);
|
||||
pop->setAutoDelete(true);
|
||||
pop->setView(caption, text, icon);
|
||||
pop->d->hideDelay = timeout;
|
||||
pop->show();
|
||||
|
||||
return pop;
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout )
|
||||
KPassivePopup *KPassivePopup::message(int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout)
|
||||
{
|
||||
KPassivePopup *pop = new KPassivePopup( );
|
||||
pop->setPopupStyle( popupStyle );
|
||||
pop->setAutoDelete( true );
|
||||
pop->setView( caption, text, icon );
|
||||
KPassivePopup *pop = new KPassivePopup();
|
||||
pop->setPopupStyle(popupStyle);
|
||||
pop->setAutoDelete(true);
|
||||
pop->setView(caption, text, icon);
|
||||
pop->d->hideDelay = timeout;
|
||||
QPoint pos = pop->calculateNearbyPoint(parent->geometry());
|
||||
pop->show(pos);
|
||||
pop->moveNear(parent->geometry());
|
||||
|
||||
return pop;
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &text, QSystemTrayIcon *parent )
|
||||
KPassivePopup *KPassivePopup::message(int popupStyle, const QString &text, QSystemTrayIcon *parent)
|
||||
{
|
||||
return message( popupStyle, QString(), text, QPixmap(), parent );
|
||||
return message(popupStyle, QString(), text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent )
|
||||
KPassivePopup *KPassivePopup::message(int popupStyle, const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent)
|
||||
{
|
||||
return message( popupStyle, caption, text, QPixmap(), parent );
|
||||
return message(popupStyle, caption, text, QPixmap(), parent);
|
||||
}
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// c-basic-offset: 4
|
||||
// End:
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// -*- c++ -*-
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2006 by Richard Moore <rich@kde.org>
|
||||
* Copyright (C) 2004-2005 by Sascha Cunz <sascha.cunz@tiscali.de>
|
||||
|
@ -45,13 +43,13 @@ class KVBox;
|
|||
*
|
||||
* The most basic use of KPassivePopup displays a popup containing a piece of text:
|
||||
* \code
|
||||
* KPassivePopup::message( "This is the message", this );
|
||||
* KPassivePopup::message("This is the message", this);
|
||||
* \endcode
|
||||
* We can create popups with titles and icons too, as this example shows:
|
||||
* \code
|
||||
* QPixmap px;
|
||||
* px.load( "hi32-app-logtracker.png" );
|
||||
* KPassivePopup::message( "Some title", "This is the main text", px, this );
|
||||
* px.load("hi32-app-logtracker.png");
|
||||
* KPassivePopup::message("Some title", "This is the main text", px, this);
|
||||
* \endcode
|
||||
* This screenshot shows a popup with both a caption and a main text which is
|
||||
* being displayed next to the toolbar icon of the window that triggered it:
|
||||
|
@ -60,14 +58,14 @@ class KVBox;
|
|||
* For more control over the popup, you can use the setView(QWidget *) method
|
||||
* to create a custom popup.
|
||||
* \code
|
||||
* KPassivePopup *pop = new KPassivePopup( parent );
|
||||
* KPassivePopup *pop = new KPassivePopup(parent);
|
||||
*
|
||||
* KVBox *vb = new KVBox( pop );
|
||||
* (void) new QLabel( "<b>Isn't this great?</b>", vb);
|
||||
* (void) new QLabel("<b>Isn't this great?</b>", vb);
|
||||
*
|
||||
* KHBox *box = new KHBox( vb );
|
||||
* (void) new QPushButton( "Yes", box );
|
||||
* (void) new QPushButton( "No", box );
|
||||
* KHBox *box = new KHBox(vb );
|
||||
* (void) new QPushButton("Yes", box);
|
||||
* (void) new QPushButton("No", box);
|
||||
*
|
||||
* pop->setView( vb );
|
||||
* pop->show();
|
||||
|
@ -79,9 +77,9 @@ class KVBox;
|
|||
class KDEUI_EXPORT KPassivePopup : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY (bool autoDelete READ autoDelete WRITE setAutoDelete )
|
||||
Q_PROPERTY (int timeout READ timeout WRITE setTimeout )
|
||||
Q_PROPERTY (QRect defaultArea READ defaultArea )
|
||||
Q_PROPERTY(bool autoDelete READ autoDelete WRITE setAutoDelete)
|
||||
Q_PROPERTY(int timeout READ timeout WRITE setTimeout)
|
||||
Q_PROPERTY(QRect defaultArea READ defaultArea)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -97,12 +95,12 @@ public:
|
|||
/**
|
||||
* Creates a popup for the specified widget.
|
||||
*/
|
||||
explicit KPassivePopup( QWidget *parent=0, Qt::WindowFlags f = 0 );
|
||||
explicit KPassivePopup(QWidget *parent = nullptr, Qt::WindowFlags f = 0 );
|
||||
|
||||
/**
|
||||
* Creates a popup for the specified window.
|
||||
*/
|
||||
explicit KPassivePopup( WId parent );
|
||||
explicit KPassivePopup(WId parent);
|
||||
|
||||
/**
|
||||
* Cleans up.
|
||||
|
@ -112,17 +110,17 @@ public:
|
|||
/**
|
||||
* Sets the main view to be the specified widget (which must be a child of the popup).
|
||||
*/
|
||||
void setView( QWidget *child );
|
||||
void setView(QWidget *child);
|
||||
|
||||
/**
|
||||
* Creates a standard view then calls setView(QWidget*) .
|
||||
*/
|
||||
void setView( const QString &caption, const QString &text = QString() );
|
||||
void setView(const QString &caption, const QString &text = QString());
|
||||
|
||||
/**
|
||||
* Creates a standard view then calls setView(QWidget*) .
|
||||
*/
|
||||
virtual void setView( const QString &caption, const QString &text, const QPixmap &icon );
|
||||
virtual void setView(const QString &caption, const QString &text, const QPixmap &icon);
|
||||
|
||||
/**
|
||||
* Returns a widget that is used as standard view if one of the
|
||||
|
@ -144,13 +142,13 @@ public:
|
|||
* @see setView( const QString&, const QString& )
|
||||
* @see setView( const QString&, const QString&, const QPixmap& )
|
||||
*/
|
||||
KVBox * standardView( const QString& caption, const QString& text,
|
||||
const QPixmap& icon, QWidget *parent = 0L );
|
||||
KVBox* standardView(const QString &caption, const QString &text,
|
||||
const QPixmap &icon, QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Returns the main view.
|
||||
*/
|
||||
QWidget *view() const;
|
||||
QWidget* view() const;
|
||||
|
||||
/**
|
||||
* Returns the delay before the popup is removed automatically.
|
||||
|
@ -163,7 +161,7 @@ public:
|
|||
* The default is false. If you use the class-methods message(),
|
||||
* auto-deletion is turned on by default.
|
||||
*/
|
||||
virtual void setAutoDelete( bool autoDelete );
|
||||
virtual void setAutoDelete(bool autoDelete);
|
||||
|
||||
/**
|
||||
* @returns true if the widget auto-deletes itself when the timeout occurs.
|
||||
|
@ -190,7 +188,7 @@ public:
|
|||
* Sets the anchor of this popup. The popup tries automatically to adjust
|
||||
* itself somehow around the point.
|
||||
*/
|
||||
void setAnchor( const QPoint& anchor );
|
||||
void setAnchor(const QPoint &anchor);
|
||||
|
||||
// TODO KDE4: give all the static methods a const QPoint p = QPoint() that in
|
||||
// case the point is not null calls the show(const QPoint &p) method instead
|
||||
|
@ -201,7 +199,7 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( const QString &text, QWidget *parent );
|
||||
static KPassivePopup* message(const QString &text, QWidget *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified message beside the
|
||||
|
@ -209,7 +207,7 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( const QString &text, QSystemTrayIcon *parent );
|
||||
static KPassivePopup* message(const QString &text, QSystemTrayIcon *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified caption and message
|
||||
|
@ -217,8 +215,8 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( const QString &caption, const QString &text,
|
||||
QWidget *parent );
|
||||
static KPassivePopup* message(const QString &caption, const QString &text,
|
||||
QWidget *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified caption and message
|
||||
|
@ -226,8 +224,8 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent );
|
||||
static KPassivePopup* message(const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified icon, caption and
|
||||
|
@ -235,9 +233,9 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout = -1 );
|
||||
static KPassivePopup* message(const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout = -1);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified icon, caption and
|
||||
|
@ -245,9 +243,9 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout = -1 );
|
||||
static KPassivePopup* message(const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout = -1);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified icon, caption and
|
||||
|
@ -255,9 +253,9 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
WId parent, int timeout = -1 );
|
||||
static KPassivePopup *message(const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
WId parent, int timeout = -1);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified popup-style and message beside the
|
||||
|
@ -265,7 +263,7 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( int popupStyle, const QString &text, QWidget *parent );
|
||||
static KPassivePopup* message(int popupStyle, const QString &text, QWidget *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified popup-style and message beside the
|
||||
|
@ -273,7 +271,7 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( int popupStyle, const QString &text, QSystemTrayIcon *parent );
|
||||
static KPassivePopup* message(int popupStyle, const QString &text, QSystemTrayIcon *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified popup-style, caption and message
|
||||
|
@ -281,8 +279,8 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent );
|
||||
static KPassivePopup* message(int popupStyle, const QString &caption, const QString &text,
|
||||
QSystemTrayIcon *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified popup-style, caption and message
|
||||
|
@ -290,8 +288,8 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
|
||||
QWidget *parent );
|
||||
static KPassivePopup* message(int popupStyle, const QString &caption, const QString &text,
|
||||
QWidget *parent);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified popup-style, icon, caption and
|
||||
|
@ -299,9 +297,9 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout = -1 );
|
||||
static KPassivePopup* message(int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QWidget *parent, int timeout = -1);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified popup-style, icon, caption and
|
||||
|
@ -309,9 +307,9 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout = -1 );
|
||||
static KPassivePopup* message(int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
QSystemTrayIcon *parent, int timeout = -1);
|
||||
|
||||
/**
|
||||
* Convenience method that displays popup with the specified popup-style, icon, caption and
|
||||
|
@ -319,9 +317,9 @@ public:
|
|||
* Note that the returned object is destroyed when it is hidden.
|
||||
* @see setAutoDelete
|
||||
*/
|
||||
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
WId parent, int timeout = -1 );
|
||||
static KPassivePopup* message(int popupStyle, const QString &caption, const QString &text,
|
||||
const QPixmap &icon,
|
||||
WId parent, int timeout = -1);
|
||||
|
||||
|
||||
public Q_SLOTS:
|
||||
|
@ -333,13 +331,13 @@ public Q_SLOTS:
|
|||
*
|
||||
* @see timeout
|
||||
*/
|
||||
void setTimeout( int delay );
|
||||
void setTimeout(int delay);
|
||||
|
||||
/**
|
||||
* Sets the visual appearance of the popup.
|
||||
* @see PopupStyle
|
||||
*/
|
||||
void setPopupStyle( int popupstyle );
|
||||
void setPopupStyle(int popupstyle);
|
||||
|
||||
/**
|
||||
* Reimplemented to reposition the popup.
|
||||
|
@ -362,7 +360,7 @@ Q_SIGNALS:
|
|||
/**
|
||||
* Emitted when the popup is clicked.
|
||||
*/
|
||||
void clicked( const QPoint &pos );
|
||||
void clicked(const QPoint &pos);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -374,22 +372,22 @@ protected:
|
|||
* Reimplemented to destroy the object when autoDelete() is
|
||||
* enabled.
|
||||
*/
|
||||
virtual void hideEvent( QHideEvent * );
|
||||
virtual void hideEvent(QHideEvent *e);
|
||||
|
||||
/**
|
||||
* Moves the popup to be adjacent to the icon of the specified rectangle.
|
||||
*/
|
||||
void moveNear( const QRect &target );
|
||||
void moveNear(const QRect &target);
|
||||
|
||||
/**
|
||||
* Calculates the position to place the popup near the specified rectangle.
|
||||
*/
|
||||
QPoint calculateNearbyPoint( const QRect &target);
|
||||
QPoint calculateNearbyPoint(const QRect &target);
|
||||
|
||||
/**
|
||||
* Reimplemented to detect mouse clicks.
|
||||
*/
|
||||
virtual void mouseReleaseEvent( QMouseEvent *e );
|
||||
virtual void mouseReleaseEvent(QMouseEvent *e);
|
||||
|
||||
/**
|
||||
* Updates the transparency mask. Unused if PopupStyle == Boxed
|
||||
|
@ -400,10 +398,10 @@ protected:
|
|||
* Overwrite to paint the border when PopupStyle == Balloon.
|
||||
* Unused if PopupStyle == Boxed
|
||||
*/
|
||||
virtual void paintEvent( QPaintEvent* pe );
|
||||
virtual void paintEvent(QPaintEvent* pe);
|
||||
|
||||
private:
|
||||
void init( WId window );
|
||||
void init(WId window);
|
||||
|
||||
/* @internal */
|
||||
class Private;
|
||||
|
|
Loading…
Add table
Reference in a new issue