File indexing completed on 2024-04-21 05:54:03
0001 /* 0002 SPDX-FileCopyrightText: 2005 Bram Schoenmakers <bramschoenmakers@kde.nl> 0003 SPDX-FileCopyrightText: 2005-2007 Tom Albers <toma@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #include "passivepopup.h" 0009 0010 #include <QGuiApplication> 0011 #include <QMouseEvent> 0012 #include <QScreen> 0013 0014 static const int MARGIN = 30; 0015 0016 PassivePopup::PassivePopup(QWidget *parent) 0017 : KPassivePopup(parent) 0018 { 0019 } 0020 0021 void PassivePopup::show() 0022 { 0023 // Hardcoded to show at bottom-center for now 0024 const QRect screenRect = QGuiApplication::primaryScreen()->availableGeometry(); 0025 const int posX = screenRect.left() + (screenRect.width() - sizeHint().width()) / 2; 0026 const int posY = screenRect.bottom() - sizeHint().height() - MARGIN; 0027 KPassivePopup::show(QPoint(posX, posY)); 0028 } 0029 0030 void PassivePopup::mouseReleaseEvent(QMouseEvent *event) 0031 { 0032 event->accept(); 0033 /* eat this! */ 0034 }