forked from qt-creator/qt-creator
Editor: Fix completion tooltip width calculation
Take the offset of the geometry into account when calculating the
available with for the tooltip. This can happen if you have multiple
monitors and the tooltip is positioned on the right monitor.
amends 30cdae912f
Fixes: QTCREATORBUG-26053
Change-Id: I4116547279f3c6708f55a1e1cf7d4ceb76028f9a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -143,12 +143,13 @@ public:
|
||||
// Workaround QTCREATORBUG-11653
|
||||
void calculateMaximumWidth()
|
||||
{
|
||||
const int desktopWidth = screen()->availableGeometry().width();
|
||||
const QRect screenGeometry = screen()->availableGeometry();
|
||||
const int xOnScreen = this->pos().x() - screenGeometry.x();
|
||||
const QMargins widgetMargins = contentsMargins();
|
||||
const QMargins layoutMargins = layout()->contentsMargins();
|
||||
const int margins = widgetMargins.left() + widgetMargins.right()
|
||||
+ layoutMargins.left() + layoutMargins.right();
|
||||
m_label->setMaximumWidth(desktopWidth - this->pos().x() - margins);
|
||||
m_label->setMaximumWidth(qMax(0, screenGeometry.width() - xOnScreen - margins));
|
||||
}
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user