1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

CallConfirmWidget: don't overflow to the right

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2015-01-25 17:53:37 +01:00
parent 40478d6bac
commit b10edb9baf
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 11 additions and 3 deletions

View File

@ -41,12 +41,20 @@ CallConfirmWidget::CallConfirmWidget(QWidget *anchor) :
layout->addWidget(callLabel);
layout->addWidget(buttonBox);
QPoint pos = anchor->mapToGlobal({(anchor->width()-width())/2,anchor->height()})-w->mapToGlobal({0,0});
int xOverflow=0;
if (pos.x() + rectW > w->width())
xOverflow = pos.x() + rectW - w->width();
pos.rx() -= xOverflow;
mainRect = {0,spikeH,rectW,rectH};
brush = QBrush(QColor(65,65,65));
spikePoly = QPolygon({{(rectW-spikeW)/2,spikeH},{rectW/2,0},{(rectW+spikeW)/2,spikeH}});
spikePoly = QPolygon({{(rectW-spikeW+xOverflow)/2,spikeH},
{(rectW+xOverflow)/2,0},
{(rectW+spikeW+xOverflow)/2,spikeH}});
setFixedSize(rectW,rectH+spikeH);
move(anchor->mapToGlobal({(anchor->width()-width())/2,anchor->height()})-w->mapToGlobal({0,0}));
move(pos);
}
void CallConfirmWidget::paintEvent(QPaintEvent*)