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

List:       kde-commits
Subject:    [kmymoney/4.8] kmymoney/widgets: Fix 'when using the "amount entry widget" in the ledger view, it ha
From:       Ralf Habacker <null () kde ! org>
Date:       2018-05-31 20:44:31
Message-ID: E1fOUQx-0000Eo-FP () code ! kde ! org
[Download RAW message or body]

Git commit 6a221524755177087fb1dcd110af1bc5f592f61a by Ralf Habacker.
Committed on 31/05/2018 at 20:44.
Pushed by habacker into branch '4.8'.

Fix 'when using the "amount entry widget" in the ledger view, it hangs off the screen'

BUG:283784
FIXED-IN:4.8.3

M  +16   -1    kmymoney/widgets/kmymoneyedit.cpp

https://commits.kde.org/kmymoney/6a221524755177087fb1dcd110af1bc5f592f61a

diff --git a/kmymoney/widgets/kmymoneyedit.cpp b/kmymoney/widgets/kmymoneyedit.cpp
index ac79db71..61eebc42 100644
--- a/kmymoney/widgets/kmymoneyedit.cpp
+++ b/kmymoney/widgets/kmymoneyedit.cpp
@@ -206,6 +206,21 @@ static const uchar resetButtonImage[] = {
   0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82
 };
 
+/**
+ * Force geometry update of a hidden widget,
+ * see https://stackoverflow.com/a/3996525 for details
+ *
+ * @parem widget widget to force update
+ */
+void forceUpdate(QWidget *widget)
+{
+    widget->setAttribute(Qt::WA_DontShowOnScreen);
+    widget->show();
+    widget->updateGeometry();
+    widget->hide();
+    widget->setAttribute(Qt::WA_DontShowOnScreen, false);
+}
+
 void kMyMoneyEdit::init()
 {
   allowEmpty = false;
@@ -225,7 +240,7 @@ void kMyMoneyEdit::init()
   m_calculatorFrame->setLineWidth(3);
 
   m_calculator = new kMyMoneyCalculator(m_calculatorFrame);
-  m_calculatorFrame->hide();
+  forceUpdate(m_calculatorFrame);
 
   m_calcButton = new KPushButton(KIcon("accessories-calculator"), QString(""), this);
   m_calcButton->setFocusProxy(m_edit);
[prev in list] [next in list] [prev in thread] [next in thread] 

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