[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kexi] src/widget/tableview: Fix alignment of table view combo boxes when rows or columns are scroll
From:       Jaroslaw Staniek <staniek () kde ! org>
Date:       2016-02-29 23:12:21
Message-ID: E1aaWzF-0000sv-0j () scm ! kde ! org
[Download RAW message or body]

Git commit 93c018e8109c07ec457175275c71838cb1659a2d by Jaroslaw Staniek.
Committed on 29/02/2016 at 23:07.
Pushed by staniek into branch 'master'.

Fix alignment of table view combo boxes when rows or columns are scrolled

BUG:357655
FIXED-IN:2.9.11

(from calligra.git)

M  +12   -3    src/widget/tableview/kexicomboboxbase.cpp

http://commits.kde.org/kexi/93c018e8109c07ec457175275c71838cb1659a2d

diff --git a/src/widget/tableview/kexicomboboxbase.cpp b/src/widget/tableview/kexicomboboxbase.cpp
index 63ff688..4ac8490 100644
--- a/src/widget/tableview/kexicomboboxbase.cpp
+++ b/src/widget/tableview/kexicomboboxbase.cpp
@@ -1,6 +1,6 @@
 /* This file is part of the KDE project
    Copyright (C) 2002 Peter Simonsson <psn@linux.se>
-   Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org>
+   Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -19,17 +19,19 @@
  */
 
 
-#include <kexi_global.h>
 #include "kexicomboboxbase.h"
+#include <kexi_global.h>
 #include <widget/utils/kexicomboboxdropdownbutton.h>
 #include "kexicomboboxpopup.h"
 #include "KexiTableScrollArea.h"
 #include "kexi.h"
+#include "KexiTableScrollAreaWidget.h"
 
 #include <KDbTableSchema>
 
 #include <QScopedValueRollback>
 #include <QDebug>
+#include <QScrollBar>
 
 KexiComboBoxBase::KexiComboBoxBase()
 {
@@ -421,8 +423,15 @@ void KexiComboBoxBase::createPopup(bool show)
     QPoint posMappedToGlobal = mapFromParentToGlobal(thisWidget->pos());
     if (posMappedToGlobal != QPoint(-1, -1)) {
 //! todo alter the position to fit the popup within screen boundaries
+        QPoint pos = posMappedToGlobal + QPoint(0, thisWidget->height());
+        if (qobject_cast<KexiTableScrollAreaWidget*>(thisWidget->parentWidget())) {
+            KexiTableScrollArea* tableScroll
+                = qobject_cast<KexiTableScrollAreaWidget*>(thisWidget->parentWidget())->scrollArea;
+            pos -= QPoint(tableScroll->horizontalScrollBar()->value(),
+                          tableScroll->verticalScrollBar()->value());
+        }
         popup()->hide();
-        popup()->move(posMappedToGlobal + QPoint(0, thisWidget->height()));
+        popup()->move(pos);
         //qDebug() << "pos:" << posMappedToGlobal + QPoint(0, thisWidget->height());
         //to avoid flickering: first resize to 0-height, then show and resize back to prev. height
         const int w = popupWidthHint();

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic