• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • util
kpassivepopup.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2001-2006 by Richard Moore <rich@kde.org>
3  * Copyright (C) 2004-2005 by Sascha Cunz <sascha.cunz@tiscali.de>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  */
19 
20 #include "kpassivepopup.h"
21 #include "kpassivepopup.moc"
22 
23 // Qt
24 #include <QApplication>
25 #include <QBitmap>
26 #include <QLabel>
27 #include <QLayout>
28 #include <QMouseEvent>
29 #include <QPainter>
30 #include <QPainterPath>
31 #include <QPolygonF>
32 #include <QTimer>
33 #include <QToolTip>
34 #include <QSystemTrayIcon>
35 
36 #include <kvbox.h>
37 #include <kdebug.h>
38 #include <kdialog.h>
39 #include <kglobalsettings.h>
40 
41 #include <kconfig.h>
42 
43 #ifdef Q_WS_X11
44 #include <qx11info_x11.h>
45 #include <netwm.h>
46 #endif
47 
48 #include <config.h>
49 
50 static const int DEFAULT_POPUP_TYPE = KPassivePopup::Boxed;
51 static const int DEFAULT_POPUP_TIME = 6*1000;
52 static const Qt::WindowFlags POPUP_FLAGS = Qt::Tool | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint;
53 
54 class KPassivePopup::Private
55 {
56 public:
57  Private()
58  : popupStyle( DEFAULT_POPUP_TYPE ),
59  msgView(0),
60  topLayout(0),
61  hideDelay( DEFAULT_POPUP_TIME ),
62  hideTimer(0),
63  autoDelete( false )
64  {
65 
66  }
67 
68  int popupStyle;
69  QPolygon surround;
70  QPoint anchor;
71  QPoint fixedPosition;
72 
73  WId window;
74  QWidget *msgView;
75  QBoxLayout *topLayout;
76  int hideDelay;
77  QTimer *hideTimer;
78 
79  QLabel *ttlIcon;
80  QLabel *ttl;
81  QLabel *msg;
82 
83  bool autoDelete;
84 };
85 
86 KPassivePopup::KPassivePopup( QWidget *parent, Qt::WindowFlags f )
87  : QFrame( 0, f ? f : POPUP_FLAGS ),
88  d(new Private())
89 {
90  init( parent ? parent->effectiveWinId() : 0L );
91 }
92 
93 KPassivePopup::KPassivePopup( WId win )
94  : QFrame( 0 ),
95  d(new Private())
96 {
97  init( win );
98 }
99 
100 #if 0 // These break macos and win32 where the definition of WId makes them ambiguous
101 KPassivePopup::KPassivePopup( int popupStyle, QWidget *parent, Qt::WindowFlags f )
102  : QFrame( 0, f ? f : POPUP_FLAGS ),
103  d(new Private())
104 {
105  init( parent ? parent->winId() : 0L );
106  setPopupStyle( popupStyle );
107 }
108 
109 KPassivePopup::KPassivePopup( int popupStyle, WId win, Qt::WindowFlags f )
110  : QFrame( 0, f ? f : POPUP_FLAGS ),
111  d(new Private())
112 {
113  init( win );
114  setPopupStyle( popupStyle );
115 }
116 #endif
117 
118 void KPassivePopup::init( WId window )
119 {
120  d->window = window;
121  d->hideTimer = new QTimer( this );
122 
123  setWindowFlags( POPUP_FLAGS );
124  setFrameStyle( QFrame::Box| QFrame::Plain );
125  setLineWidth( 2 );
126 
127  if( d->popupStyle == Boxed )
128  {
129  setFrameStyle( QFrame::Box| QFrame::Plain );
130  setLineWidth( 2 );
131  }
132  else if( d->popupStyle == Balloon )
133  {
134  setPalette(QToolTip::palette());
135  //XXX dead ? setAutoMask(true);
136  }
137  connect( d->hideTimer, SIGNAL(timeout()), SLOT(hide()) );
138  connect( this, SIGNAL(clicked()), SLOT(hide()) );
139 }
140 
141 KPassivePopup::~KPassivePopup()
142 {
143  delete d;
144 }
145 
146 void KPassivePopup::setPopupStyle( int popupstyle )
147 {
148  if ( d->popupStyle == popupstyle )
149  return;
150 
151  d->popupStyle = popupstyle;
152  if( d->popupStyle == Boxed )
153  {
154  setFrameStyle( QFrame::Box| QFrame::Plain );
155  setLineWidth( 2 );
156  }
157  else if( d->popupStyle == Balloon )
158  {
159  setPalette(QToolTip::palette());
160  //XXX dead ? setAutoMask(true);
161  }
162 }
163 
164 void KPassivePopup::setView( QWidget *child )
165 {
166  delete d->msgView;
167  d->msgView = child;
168 
169  delete d->topLayout;
170  d->topLayout = new QVBoxLayout( this );
171  if ( d->popupStyle == Balloon ) {
172  d->topLayout->setMargin( 2 * KDialog::marginHint() );
173  }
174  d->topLayout->addWidget( d->msgView );
175  d->topLayout->activate();
176 }
177 
178 void KPassivePopup::setView( const QString &caption, const QString &text,
179  const QPixmap &icon )
180 {
181  // kDebug() << "KPassivePopup::setView " << caption << ", " << text;
182  setView( standardView( caption, text, icon, this ) );
183 }
184 
185 
186 KVBox * KPassivePopup::standardView( const QString& caption,
187  const QString& text,
188  const QPixmap& icon,
189  QWidget *parent )
190 {
191  KVBox *vb = new KVBox( parent ? parent : this );
192  vb->setSpacing( -1 );
193 
194  KHBox *hb=0;
195  if ( !icon.isNull() ) {
196  hb = new KHBox( vb );
197  hb->setMargin( 0 );
198  hb->setSpacing( -1 );
199  d->ttlIcon = new QLabel( hb );
200  d->ttlIcon->setPixmap( icon );
201  d->ttlIcon->setAlignment( Qt::AlignLeft );
202  }
203 
204  if ( !caption.isEmpty() ) {
205  d->ttl = new QLabel( caption, hb ? hb : vb );
206  QFont fnt = d->ttl->font();
207  fnt.setBold( true );
208  d->ttl->setFont( fnt );
209  d->ttl->setAlignment( Qt::AlignHCenter );
210 
211  if ( hb )
212  hb->setStretchFactor( d->ttl, 10 ); // enforce centering
213  }
214 
215  if ( !text.isEmpty() ) {
216  d->msg = new QLabel( text, vb );
217  d->msg->setAlignment( Qt::AlignLeft );
218  d->msg->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
219  d->msg->setOpenExternalLinks(true);
220  }
221 
222  return vb;
223 }
224 
225 void KPassivePopup::setView( const QString &caption, const QString &text )
226 {
227  setView( caption, text, QPixmap() );
228 }
229 
230 QWidget *KPassivePopup::view() const
231 {
232  return d->msgView;
233 }
234 
235 int KPassivePopup::timeout() const
236 {
237  return d->hideDelay;
238 }
239 
240 void KPassivePopup::setTimeout( int delay )
241 {
242  d->hideDelay = delay;
243  if( d->hideTimer->isActive() )
244  {
245  if( delay ) {
246  d->hideTimer->start( delay );
247  } else {
248  d->hideTimer->stop();
249  }
250  }
251 }
252 
253 bool KPassivePopup::autoDelete() const
254 {
255  return d->autoDelete;
256 }
257 
258 void KPassivePopup::setAutoDelete( bool autoDelete )
259 {
260  d->autoDelete = autoDelete;
261 }
262 
263 void KPassivePopup::mouseReleaseEvent( QMouseEvent *e )
264 {
265  emit clicked();
266  emit clicked( e->pos() );
267 }
268 
269 //
270 // Main Implementation
271 //
272 
273 void KPassivePopup::setVisible( bool visible )
274 {
275  if (! visible ) {
276  QFrame::setVisible( visible );
277  return;
278  }
279 
280  if ( size() != sizeHint() )
281  resize( sizeHint() );
282 
283  if ( d->fixedPosition.isNull() )
284  positionSelf();
285  else {
286  if( d->popupStyle == Balloon )
287  setAnchor( d->fixedPosition );
288  else
289  move( d->fixedPosition );
290  }
291  QFrame::setVisible( /*visible=*/ true );
292 
293  int delay = d->hideDelay;
294  if ( delay < 0 ) {
295  delay = DEFAULT_POPUP_TIME;
296  }
297 
298  if ( delay > 0 ) {
299  d->hideTimer->start( delay );
300  }
301 }
302 
303 void KPassivePopup::show()
304 {
305  QFrame::show();
306 }
307 
308 void KPassivePopup::show(const QPoint &p)
309 {
310  d->fixedPosition = p;
311  show();
312 }
313 
314 void KPassivePopup::hideEvent( QHideEvent * )
315 {
316  d->hideTimer->stop();
317  if ( d->autoDelete )
318  deleteLater();
319 }
320 
321 QRect KPassivePopup::defaultArea() const
322 {
323 #ifdef Q_WS_X11
324  NETRootInfo info( QX11Info::display(),
325  NET::NumberOfDesktops |
326  NET::CurrentDesktop |
327  NET::WorkArea,
328  -1, false );
329  info.activate();
330  NETRect workArea = info.workArea( info.currentDesktop() );
331  QRect r;
332  r.setRect( workArea.pos.x, workArea.pos.y, 0, 0 ); // top left
333 #else
334  // FIX IT
335  QRect r;
336  r.setRect( 100, 100, 200, 200 ); // top left
337 #endif
338  return r;
339 }
340 
341 void KPassivePopup::positionSelf()
342 {
343  QRect target;
344 
345 #ifdef Q_WS_X11
346  if ( !d->window ) {
347  target = defaultArea();
348  }
349 
350  else {
351  NETWinInfo ni( QX11Info::display(), d->window, QX11Info::appRootWindow(),
352  NET::WMIconGeometry );
353 
354  // Figure out where to put the popup. Note that we must handle
355  // windows that skip the taskbar cleanly
356  if ( ni.state() & NET::SkipTaskbar ) {
357  target = defaultArea();
358  }
359  else {
360  NETRect r = ni.iconGeometry();
361  target.setRect( r.pos.x, r.pos.y, r.size.width, r.size.height );
362  if ( target.isNull() ) { // bogus value, use the exact position
363  NETRect dummy;
364  ni.kdeGeometry( dummy, r );
365  target.setRect( r.pos.x, r.pos.y,
366  r.size.width, r.size.height);
367  }
368  }
369  }
370 #else
371  target = defaultArea();
372 #endif
373  moveNear( target );
374 }
375 
376 void KPassivePopup::moveNear( const QRect &target )
377 {
378  QPoint pos = calculateNearbyPoint(target);
379  if( d->popupStyle == Balloon )
380  setAnchor( pos );
381  else
382  move( pos.x(), pos.y() );
383 }
384 
385 QPoint KPassivePopup::calculateNearbyPoint( const QRect &target) {
386  QPoint pos = target.topLeft();
387  int x = pos.x();
388  int y = pos.y();
389  int w = minimumSizeHint().width();
390  int h = minimumSizeHint().height();
391 
392  QRect r = KGlobalSettings::desktopGeometry(QPoint(x+w/2,y+h/2));
393 
394  if( d->popupStyle == Balloon )
395  {
396  // find a point to anchor to
397  if( x + w > r.width() ){
398  x = x + target.width();
399  }
400 
401  if( y + h > r.height() ){
402  y = y + target.height();
403  }
404  } else
405  {
406  if ( x < r.center().x() )
407  x = x + target.width();
408  else
409  x = x - w;
410 
411  // It's apparently trying to go off screen, so display it ALL at the bottom.
412  if ( (y + h) > r.bottom() )
413  y = r.bottom() - h;
414 
415  if ( (x + w) > r.right() )
416  x = r.right() - w;
417  }
418  if ( y < r.top() )
419  y = r.top();
420 
421  if ( x < r.left() )
422  x = r.left();
423 
424  return QPoint( x, y );
425 }
426 
427 QPoint KPassivePopup::anchor() const
428 {
429  return d->anchor;
430 }
431 
432 void KPassivePopup::setAnchor(const QPoint &anchor)
433 {
434  d->anchor = anchor;
435  updateMask();
436 }
437 
438 void KPassivePopup::paintEvent( QPaintEvent* pe )
439 {
440  if( d->popupStyle == Balloon )
441  {
442  QPainter p;
443  p.begin( this );
444  p.drawPolygon( d->surround );
445  } else
446  QFrame::paintEvent( pe );
447 }
448 
449 void KPassivePopup::updateMask()
450 {
451  // get screen-geometry for screen our anchor is on
452  // (geometry can differ from screen to screen!
453  QRect deskRect = KGlobalSettings::desktopGeometry(d->anchor);
454 
455  int xh = 70, xl = 40;
456  if( width() < 80 )
457  xh = xl = 40;
458  else if( width() < 110 )
459  xh = width() - 40;
460 
461  bool bottom = (d->anchor.y() + height()) > ((deskRect.y() + deskRect.height()-48));
462  bool right = (d->anchor.x() + width()) > ((deskRect.x() + deskRect.width()-48));
463 
464  QPoint corners[4] = {
465  QPoint( width() - 50, 10 ),
466  QPoint( 10, 10 ),
467  QPoint( 10, height() - 50 ),
468  QPoint( width() - 50, height() - 50 )
469  };
470 
471  QBitmap mask( width(), height() );
472  mask.clear();
473  QPainter p( &mask );
474  QBrush brush( Qt::color1, Qt::SolidPattern );
475  p.setBrush( brush );
476 
477  int i = 0, z = 0;
478  for (; i < 4; ++i) {
479  QPainterPath path;
480  path.moveTo(corners[i].x(),corners[i].y());
481  path.arcTo(corners[i].x(),corners[i].y(),40,40, i * 90 , 90);
482  QPolygon corner = path.toFillPolygon().toPolygon();
483 
484  d->surround.resize( z + corner.count() - 1 );
485  for (int s = 1; s < corner.count() - 1; s++, z++) {
486  d->surround.setPoint( z, corner[s] );
487  }
488 
489  if (bottom && i == 2) {
490  if (right) {
491  d->surround.resize( z + 3 );
492  d->surround.setPoint( z++, QPoint( width() - xh, height() - 10 ) );
493  d->surround.setPoint( z++, QPoint( width() - 20, height() ) );
494  d->surround.setPoint( z++, QPoint( width() - xl, height() - 10 ) );
495  } else {
496  d->surround.resize( z + 3 );
497  d->surround.setPoint( z++, QPoint( xl, height() - 10 ) );
498  d->surround.setPoint( z++, QPoint( 20, height() ) );
499  d->surround.setPoint( z++, QPoint( xh, height() - 10 ) );
500  }
501  } else if (!bottom && i == 0) {
502  if (right) {
503  d->surround.resize( z + 3 );
504  d->surround.setPoint( z++, QPoint( width() - xl, 10 ) );
505  d->surround.setPoint( z++, QPoint( width() - 20, 0 ) );
506  d->surround.setPoint( z++, QPoint( width() - xh, 10 ) );
507  } else {
508  d->surround.resize( z + 3 );
509  d->surround.setPoint( z++, QPoint( xh, 10 ) );
510  d->surround.setPoint( z++, QPoint( 20, 0 ) );
511  d->surround.setPoint( z++, QPoint( xl, 10 ) );
512  }
513  }
514  }
515 
516  d->surround.resize( z + 1 );
517  d->surround.setPoint( z, d->surround[0] );
518  p.drawPolygon( d->surround );
519  setMask(mask);
520 
521  move( right ? d->anchor.x() - width() + 20 : ( d->anchor.x() < 11 ? 11 : d->anchor.x() - 20 ),
522  bottom ? d->anchor.y() - height() : ( d->anchor.y() < 11 ? 11 : d->anchor.y() ) );
523 
524  update();
525 }
526 
527 //
528 // Convenience Methods
529 //
530 
531 KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
532  const QPixmap &icon,
533  QWidget *parent, int timeout )
534 {
535  return message( DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout );
536 }
537 
538 KPassivePopup *KPassivePopup::message( const QString &text, QWidget *parent )
539 {
540  return message( DEFAULT_POPUP_TYPE, QString(), text, QPixmap(), parent );
541 }
542 
543 KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
544  QWidget *parent )
545 {
546  return message( DEFAULT_POPUP_TYPE, caption, text, QPixmap(), parent );
547 }
548 
549 KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
550  const QPixmap &icon, WId parent, int timeout )
551 {
552  return message( DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout );
553 }
554 
555 KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
556  const QPixmap &icon,
557  QSystemTrayIcon *parent, int timeout )
558 {
559  return message( DEFAULT_POPUP_TYPE, caption, text, icon, parent, timeout );
560 }
561 
562 KPassivePopup *KPassivePopup::message( const QString &text, QSystemTrayIcon *parent )
563 {
564  return message( DEFAULT_POPUP_TYPE, QString(), text, QPixmap(), parent );
565 }
566 
567 KPassivePopup *KPassivePopup::message( const QString &caption, const QString &text,
568  QSystemTrayIcon *parent )
569 {
570  return message( DEFAULT_POPUP_TYPE, caption, text, QPixmap(), parent );
571 }
572 
573 
574 KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
575  const QPixmap &icon,
576  QWidget *parent, int timeout )
577 {
578  KPassivePopup *pop = new KPassivePopup( parent );
579  pop->setPopupStyle( popupStyle );
580  pop->setAutoDelete( true );
581  pop->setView( caption, text, icon );
582  pop->d->hideDelay = timeout;
583  pop->show();
584 
585  return pop;
586 }
587 
588 KPassivePopup *KPassivePopup::message( int popupStyle, const QString &text, QWidget *parent )
589 {
590  return message( popupStyle, QString(), text, QPixmap(), parent );
591 }
592 
593 KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
594  QWidget *parent )
595 {
596  return message( popupStyle, caption, text, QPixmap(), parent );
597 }
598 
599 KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
600  const QPixmap &icon, WId parent, int timeout )
601 {
602  KPassivePopup *pop = new KPassivePopup( parent );
603  pop->setPopupStyle( popupStyle );
604  pop->setAutoDelete( true );
605  pop->setView( caption, text, icon );
606  pop->d->hideDelay = timeout;
607  pop->show();
608 
609  return pop;
610 }
611 
612 KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
613  const QPixmap &icon,
614  QSystemTrayIcon *parent, int timeout )
615 {
616  KPassivePopup *pop = new KPassivePopup( );
617  pop->setPopupStyle( popupStyle );
618  pop->setAutoDelete( true );
619  pop->setView( caption, text, icon );
620  pop->d->hideDelay = timeout;
621  QPoint pos = pop->calculateNearbyPoint(parent->geometry());
622  pop->show(pos);
623  pop->moveNear(parent->geometry());
624 
625  return pop;
626 }
627 
628 KPassivePopup *KPassivePopup::message( int popupStyle, const QString &text, QSystemTrayIcon *parent )
629 {
630  return message( popupStyle, QString(), text, QPixmap(), parent );
631 }
632 
633 KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text,
634  QSystemTrayIcon *parent )
635 {
636  return message( popupStyle, caption, text, QPixmap(), parent );
637 }
638 
639 
640 // Local Variables:
641 // c-basic-offset: 4
642 // End:
QHideEvent
QObject::child
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
KDialog::marginHint
static int marginHint()
Returns the number of pixels that should be used between a dialog edge and the outermost widget(s) ac...
Definition: kdialog.cpp:427
kdialog.h
KPassivePopup::calculateNearbyPoint
QPoint calculateNearbyPoint(const QRect &target)
Calculates the position to place the popup near the specified rectangle.
Definition: kpassivepopup.cpp:385
NET::WorkArea
Definition: netwm_def.h:623
QWidget
QPolygonF::toPolygon
QPolygon toPolygon() const
KPassivePopup::clicked
void clicked()
Emitted when the popup is clicked.
QWidget::setPalette
void setPalette(const QPalette &)
KPassivePopup::setTimeout
void setTimeout(int delay)
Sets the delay for the popup is removed automatically.
Definition: kpassivepopup.cpp:240
KVBox
A container widget which arranges its children vertically.
Definition: kvbox.h:36
NET::SkipTaskbar
indicates that a window should not be included on a taskbar.
Definition: netwm_def.h:457
KPassivePopup::KPassivePopup
KPassivePopup(QWidget *parent=0, Qt::WindowFlags f=0)
Creates a popup for the specified widget.
Definition: kpassivepopup.cpp:86
QSize::width
int width() const
kdebug.h
NET::CurrentDesktop
Definition: netwm_def.h:620
KPassivePopup::moveNear
void moveNear(const QRect &target)
Moves the popup to be adjacent to the icon of the specified rectangle.
Definition: kpassivepopup.cpp:376
QWidget::window
QWidget * window() const
QRect::right
int right() const
KPassivePopup::setAnchor
void setAnchor(const QPoint &anchor)
Sets the anchor of this popup.
Definition: kpassivepopup.cpp:432
kglobalsettings.h
QX11Info::appRootWindow
Qt::HANDLE appRootWindow(int screen)
QX11Info::display
Display * display()
QFont
NETPoint::y
int y
y coordinate
Definition: netwm_def.h:52
kconfig.h
KPassivePopup::message
static KPassivePopup * message(const QString &text, QWidget *parent)
Convenience method that displays popup with the specified message beside the icon of the specified wi...
Definition: kpassivepopup.cpp:538
KPassivePopup::standardView
KVBox * standardView(const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent=0L)
Returns a widget that is used as standard view if one of the setView() methods taking the QString arg...
Definition: kpassivepopup.cpp:186
QWidget::y
int y() const
QWidget::setVisible
virtual void setVisible(bool visible)
QPainter::drawPolygon
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
KPassivePopup::Balloon
Information will appear in a comic-alike balloon.
Definition: kpassivepopup.h:93
QPainterPath::moveTo
void moveTo(const QPointF &point)
QRect::height
int height() const
KGlobalSettings::desktopGeometry
static QRect desktopGeometry(const QPoint &point)
This function returns the desktop geometry for an application that needs to set the geometry of a wid...
Definition: kglobalsettings.cpp:732
QBrush
QWidget::minimumSizeHint
virtual QSize minimumSizeHint() const
KPassivePopup::autoDelete
bool autoDelete() const
QRect::x
int x() const
QRect::y
int y() const
QPoint
QPainterPath::toFillPolygon
QPolygonF toFillPolygon(const QMatrix &matrix) const
QMouseEvent
KPassivePopup::setView
void setView(QWidget *child)
Sets the main view to be the specified widget (which must be a child of the popup).
Definition: kpassivepopup.cpp:164
QFrame::setFrameStyle
void setFrameStyle(int style)
QFrame::setLineWidth
void setLineWidth(int)
QFrame::sizeHint
virtual QSize sizeHint() const
NETRootInfo
Common API for root window properties/protocols.
Definition: netwm.h:58
QWidget::update
void update()
QPoint::x
int x() const
QPoint::y
int y() const
QPolygon
DEFAULT_POPUP_TYPE
static const int DEFAULT_POPUP_TYPE
Definition: kpassivepopup.cpp:50
kpassivepopup.h
QWidget::width
int width() const
QBitmap
QFont::setBold
void setBold(bool enable)
QWidget::size
QSize size() const
KPassivePopup::defaultArea
QRect defaultArea() const
If no relative window (eg taskbar button, system tray window) is available, use this rectangle (pass ...
KPassivePopup::setPopupStyle
void setPopupStyle(int popupstyle)
Sets the visual appearance of the popup.
Definition: kpassivepopup.cpp:146
NETWinInfo::kdeGeometry
void kdeGeometry(NETRect &frame, NETRect &window)
Places the window frame geometry in frame, and the application window geometry in window...
Definition: netwm.cpp:3605
QRect
NETRect::size
NETSize size
Size of the rectangle.
Definition: netwm_def.h:106
NETWinInfo::state
unsigned long state() const
Returns the state of the window (see the NET base class documentation for a description of the variou...
Definition: netwm.cpp:4558
netwm.h
QTimer
QWidget::x
int x() const
QFrame::paintEvent
virtual void paintEvent(QPaintEvent *)
QRect::top
int top() const
NETPoint::x
int x
x coordinate.
Definition: netwm_def.h:52
QRect::left
int left() const
QWidget::setMask
void setMask(const QBitmap &bitmap)
QPainter
KPassivePopup::anchor
QPoint anchor() const
Returns the position to which this popup is anchored.
Definition: kpassivepopup.cpp:427
QString::isEmpty
bool isEmpty() const
NETRect::pos
NETPoint pos
Position of the rectangle.
Definition: netwm_def.h:99
QWidget::move
void move(int x, int y)
QPainter::setBrush
void setBrush(const QBrush &brush)
QVBoxLayout
QRect::center
QPoint center() const
KPassivePopup::timeout
int timeout() const
Returns the delay before the popup is removed automatically.
KHBox::setMargin
void setMargin(int margin)
Sets the margin of the hbox.
Definition: khbox.cpp:108
QWidget::winId
WId winId() const
QObject::deleteLater
void deleteLater()
KPassivePopup::setAutoDelete
virtual void setAutoDelete(bool autoDelete)
Enables / disables auto-deletion of this widget when the timeout occurs.
Definition: kpassivepopup.cpp:258
QString
QWidget::hide
void hide()
kvbox.h
KPassivePopup
A dialog-like popup that displays messages without interrupting the user.
Definition: kpassivepopup.h:79
QPixmap
QPixmap::isNull
bool isNull() const
QFrame
KPassivePopup::~KPassivePopup
virtual ~KPassivePopup()
Cleans up.
Definition: kpassivepopup.cpp:141
KPassivePopup::view
QWidget * view() const
Returns the main view.
Definition: kpassivepopup.cpp:230
NETRect
Simple rectangle class for NET classes.
Definition: netwm_def.h:93
QRect::isNull
bool isNull() const
KHBox::setStretchFactor
void setStretchFactor(QWidget *widget, int stretch)
Sets the stretch factor of widget to stretch.
Definition: khbox.cpp:103
QWidget::setWindowFlags
void setWindowFlags(QFlags< Qt::WindowType > type)
QPainterPath
QRect::width
int width() const
QSystemTrayIcon::geometry
QRect geometry() const
DEFAULT_POPUP_TIME
static const int DEFAULT_POPUP_TIME
Definition: kpassivepopup.cpp:51
QRect::setRect
void setRect(int x, int y, int width, int height)
QToolTip::palette
QPalette palette()
POPUP_FLAGS
static const Qt::WindowFlags POPUP_FLAGS
Definition: kpassivepopup.cpp:52
KPassivePopup::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *e)
Reimplemented to detect mouse clicks.
Definition: kpassivepopup.cpp:263
KPassivePopup::positionSelf
virtual void positionSelf()
This method positions the popup.
Definition: kpassivepopup.cpp:341
NETSize::width
int width
Width.
Definition: netwm_def.h:79
NET::WMIconGeometry
Definition: netwm_def.h:637
QSize::height
int height() const
QVector::count
int count(const T &value) const
KHBox::setSpacing
void setSpacing(int space)
Sets the spacing between the child widgets to space.
Definition: khbox.cpp:98
QBitmap::clear
void clear()
QRect::bottom
int bottom() const
QRect::topLeft
QPoint topLeft() const
KPassivePopup::setVisible
virtual void setVisible(bool visible)
Definition: kpassivepopup.cpp:273
Qt::WindowFlags
typedef WindowFlags
NETWinInfo
Common API for application window properties/protocols.
Definition: netwm.h:829
NETSize::height
int height
Height.
Definition: netwm_def.h:79
KHBox
A container widget which arranges its children horizontally.
Definition: khbox.h:40
QWidget::show
void show()
KPassivePopup::Boxed
Information will appear in a framed box (default)
Definition: kpassivepopup.h:92
QMouseEvent::pos
const QPoint & pos() const
QPaintEvent
QSystemTrayIcon
KPassivePopup::hideEvent
virtual void hideEvent(QHideEvent *)
Reimplemented to destroy the object when autoDelete() is enabled.
Definition: kpassivepopup.cpp:314
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QWidget::effectiveWinId
WId effectiveWinId() const
NET::NumberOfDesktops
Definition: netwm_def.h:617
QLabel
QPainter::begin
bool begin(QPaintDevice *device)
NETWinInfo::iconGeometry
NETRect iconGeometry() const
Returns the icon geometry.
Definition: netwm.cpp:4553
QPainterPath::arcTo
void arcTo(const QRectF &rectangle, qreal startAngle, qreal sweepLength)
KPassivePopup::show
void show()
Reimplemented to reposition the popup.
Definition: kpassivepopup.cpp:303
QBoxLayout
QWidget::height
int height() const
QWidget::mask
QRegion mask() const
KPassivePopup::paintEvent
virtual void paintEvent(QPaintEvent *pe)
Overwrite to paint the border when PopupStyle == Balloon.
Definition: kpassivepopup.cpp:438
KPassivePopup::updateMask
void updateMask()
Updates the transparency mask.
Definition: kpassivepopup.cpp:449
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal