diff options
author | Alexis Menard <alexis.menard@openbossa.org> | 2012-06-19 10:27:13 -0300 |
---|---|---|
committer | Alexis Menard <alexis.menard@openbossa.org> | 2012-06-19 11:45:01 -0300 |
commit | 914604ef465e3548849ecef253d721bd9642eea1 (patch) | |
tree | 066d3821501f826d42eaad85165b529f87227c66 /src/desktop/BrowserWindow.cpp | |
parent | 922ec70059a94fd5b7119a45a85641cbf8275b8a (diff) | |
download | snowshoe-914604ef465e3548849ecef253d721bd9642eea1.tar.gz |
Implement drop down menu for comboboxes in Snowshoe desktop.
It has scrollbars and support sections. Note that the ItemSelector
is deleted by WebKit whenever the popup is hidden.
Reviewed-by: Caio Oliveira
Diffstat (limited to 'src/desktop/BrowserWindow.cpp')
-rw-r--r-- | src/desktop/BrowserWindow.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/desktop/BrowserWindow.cpp b/src/desktop/BrowserWindow.cpp index 710adfa..a29c528 100644 --- a/src/desktop/BrowserWindow.cpp +++ b/src/desktop/BrowserWindow.cpp @@ -50,6 +50,19 @@ BrowserWindow::BrowserWindow(const QStringList& arguments) Q_ASSERT(m_browserView); } +QPoint BrowserWindow::ensureInsideScreen(int x, int y, int width, int height) +{ + QPoint newPos(x, y); + QRect availableGeometry = screen()->availableGeometry(); + int right = x + width; + int bottom = y + height; + if (right > availableGeometry.width()) + newPos.setX(x - (right - availableGeometry.width())); + if (bottom > availableGeometry.height()) + newPos.setY(y - (bottom - availableGeometry.height())); + return newPos; +} + QPoint BrowserWindow::mapToGlobal(int x, int y) { return QWindow::mapToGlobal(QPoint(x, y)); |