From 15ca28bf370a4bed1c67c2b71bc17b92354f9f96 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Mon, 30 May 2011 15:54:33 +0200 Subject: [PATCH] hopefully fixed CardInfoPopup freeze --- cockatrice/src/abstractcarditem.cpp | 3 +++ cockatrice/src/messagelogwidget.cpp | 3 ++- cockatrice/src/tab_game.cpp | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/abstractcarditem.cpp b/cockatrice/src/abstractcarditem.cpp index 0deed4ea..020b6dfc 100644 --- a/cockatrice/src/abstractcarditem.cpp +++ b/cockatrice/src/abstractcarditem.cpp @@ -212,6 +212,9 @@ void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event) void AbstractCardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { + if (event->button() == Qt::MidButton) + emit deleteCardInfoPopup(); + // This function ensures the parent function doesn't mess around with our selection. event->accept(); } diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp index a7ab151b..deafc175 100644 --- a/cockatrice/src/messagelogwidget.cpp +++ b/cockatrice/src/messagelogwidget.cpp @@ -572,7 +572,8 @@ void MessageLogWidget::mousePressEvent(QMouseEvent *event) void MessageLogWidget::mouseReleaseEvent(QMouseEvent *event) { - emit deleteCardInfoPopup(); + if (event->button() == Qt::MidButton) + emit deleteCardInfoPopup(); QTextEdit::mouseReleaseEvent(event); } diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index fd6c76f0..d4aa7b45 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -783,7 +783,7 @@ Player *TabGame::getActiveLocalPlayer() const void TabGame::showCardInfoPopup(const QPoint &pos, const QString &cardName) { infoPopup = new CardInfoWidget(CardInfoWidget::ModePopUp, 0, Qt::Widget | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); - connect(infoPopup, SIGNAL(mouseReleased()), this, SLOT(deleteCardInfoPopup())); + infoPopup->setAttribute(Qt::WA_TransparentForMouseEvents); infoPopup->setCard(cardName); QRect screenRect = qApp->desktop()->screenGeometry(this); infoPopup->show(); @@ -791,7 +791,6 @@ void TabGame::showCardInfoPopup(const QPoint &pos, const QString &cardName) qMax(screenRect.left(), qMin(pos.x() - infoPopup->width() / 2, screenRect.left() + screenRect.width() - infoPopup->width())), qMax(screenRect.top(), qMin(pos.y() - infoPopup->height() / 2, screenRect.top() + screenRect.height() - infoPopup->height())) ); - infoPopup->grabMouse(); } void TabGame::deleteCardInfoPopup()