hopefully fixed CardInfoPopup freeze

This commit is contained in:
Max-Wilhelm Bruker 2011-05-30 15:54:33 +02:00
parent 04a96be84a
commit 15ca28bf37
3 changed files with 6 additions and 3 deletions

View file

@ -212,6 +212,9 @@ void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
void AbstractCardItem::mouseReleaseEvent(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. // This function ensures the parent function doesn't mess around with our selection.
event->accept(); event->accept();
} }

View file

@ -572,6 +572,7 @@ void MessageLogWidget::mousePressEvent(QMouseEvent *event)
void MessageLogWidget::mouseReleaseEvent(QMouseEvent *event) void MessageLogWidget::mouseReleaseEvent(QMouseEvent *event)
{ {
if (event->button() == Qt::MidButton)
emit deleteCardInfoPopup(); emit deleteCardInfoPopup();
QTextEdit::mouseReleaseEvent(event); QTextEdit::mouseReleaseEvent(event);

View file

@ -783,7 +783,7 @@ Player *TabGame::getActiveLocalPlayer() const
void TabGame::showCardInfoPopup(const QPoint &pos, const QString &cardName) void TabGame::showCardInfoPopup(const QPoint &pos, const QString &cardName)
{ {
infoPopup = new CardInfoWidget(CardInfoWidget::ModePopUp, 0, Qt::Widget | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); 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); infoPopup->setCard(cardName);
QRect screenRect = qApp->desktop()->screenGeometry(this); QRect screenRect = qApp->desktop()->screenGeometry(this);
infoPopup->show(); 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.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())) qMax(screenRect.top(), qMin(pos.y() - infoPopup->height() / 2, screenRect.top() + screenRect.height() - infoPopup->height()))
); );
infoPopup->grabMouse();
} }
void TabGame::deleteCardInfoPopup() void TabGame::deleteCardInfoPopup()