vcl/CustomTarget_qt5_moc.mk          |    1 +
 vcl/CustomTarget_qt6_moc.mk          |    1 +
 vcl/inc/qt5/QtInstanceSpinButton.hxx |    9 ++++++++-
 vcl/qt5/QtInstanceEntry.cxx          |    5 ++++-
 vcl/qt5/QtInstanceSpinButton.cxx     |   10 ++++++++++
 5 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 68203597e1e2fe2525dc2a8dbced468070ee7074
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Nov 27 23:26:04 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 28 08:38:02 2024 +0100

    tdf#130857 qt weld: Handle special value -1 for cursor pos
    
    Implement special handling for cursor position value
    of -1 according to the comment above weld::Entry::set_position
    in include/vcl/weld.hxx:
    
        // nCursorPos can be -1 to set to the end
    
    Change-Id: I078d2123f391cf1fcab6f40d26309e2a2eb2315f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177448
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceEntry.cxx b/vcl/qt5/QtInstanceEntry.cxx
index 1a39769cbecb..cb5cecb80c85 100644
--- a/vcl/qt5/QtInstanceEntry.cxx
+++ b/vcl/qt5/QtInstanceEntry.cxx
@@ -89,6 +89,9 @@ void QtInstanceEntry::replace_selection(const OUString& rText)
 void QtInstanceEntry::set_position(int nCursorPos)
 {
     SolarMutexGuard g;
+    if (nCursorPos == -1)
+        nCursorPos = m_pLineEdit->text().length();
+
     GetQtInstance().RunInMainThread([&] { 
m_pLineEdit->setCursorPosition(nCursorPos); });
 }
 
commit 83ec1e723061dcbb8a35c9fb28d698c3fcb3cce6
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Nov 27 22:53:55 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 28 08:37:56 2024 +0100

    tdf#130857 qt weld: Also notify about programmatic text changes
    
    Connect to the QLineEdit::textChanged [1] signal instead
    of QLineEdit::textEdited [2].
    
    As the doc of the latter says:
    
    > Unlike textChanged(), this signal is not emitted when the text is
    > changed programmatically, for example, by calling setText().
    
    Programmatic changes are of interest, however, e.g.
    GotoPageDlg::GotoPageDlg connects to the changed signal
    of the weld::SpinButton and expects to be notified
    when the text is changed by using the spin button
    buttons to change the value (and thus the text).
    
    [1] https://doc.qt.io/qt-6/qlineedit.html#textChanged
    [2] https://doc.qt.io/qt-6/qlineedit.html#textEdited
    
    Change-Id: Ie19bc852f4ceed0fa79565302975376db7126ea4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177447
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtInstanceEntry.cxx b/vcl/qt5/QtInstanceEntry.cxx
index 55dbfd0f964f..1a39769cbecb 100644
--- a/vcl/qt5/QtInstanceEntry.cxx
+++ b/vcl/qt5/QtInstanceEntry.cxx
@@ -22,7 +22,7 @@ QtInstanceEntry::QtInstanceEntry(QLineEdit* pLineEdit)
 
     QObject::connect(m_pLineEdit, &QLineEdit::cursorPositionChanged, this,
                      [&] { signal_cursor_position(); });
-    QObject::connect(m_pLineEdit, &QLineEdit::textEdited, this, [&] { 
signal_changed(); });
+    QObject::connect(m_pLineEdit, &QLineEdit::textChanged, this, [&] { 
signal_changed(); });
 }
 
 void QtInstanceEntry::set_text(const OUString& rText)
commit df32eb6023d874574accde09adb9b92c15023fca
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Nov 27 22:38:22 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 28 08:37:49 2024 +0100

    tdf#130857 qt weld: Call spinbutton value changed handler
    
    Change-Id: I435ed112469b58cec191badaf98e7f019381707b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177446
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index f948d5699ec1..3b7c6165e5ae 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -29,6 +29,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceNotebook.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceProgressBar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceRadioButton.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceSpinButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTreeView.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtMainWindow.moc \
diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk
index 4853d0a5b1bb..63d90a3905e0 100644
--- a/vcl/CustomTarget_qt6_moc.mk
+++ b/vcl/CustomTarget_qt6_moc.mk
@@ -29,6 +29,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceNotebook.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceProgressBar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceRadioButton.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceSpinButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTreeView.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtMainWindow.moc \
diff --git a/vcl/inc/qt5/QtInstanceSpinButton.hxx 
b/vcl/inc/qt5/QtInstanceSpinButton.hxx
index 716d4e0e3808..1f2fde540d95 100644
--- a/vcl/inc/qt5/QtInstanceSpinButton.hxx
+++ b/vcl/inc/qt5/QtInstanceSpinButton.hxx
@@ -14,8 +14,12 @@
 
 #include <QtWidgets/QSpinBox>
 
-class QtInstanceSpinButton : public QtInstanceWidget, public virtual 
weld::SpinButton
+class QtInstanceSpinButton : public QObject,
+                             public QtInstanceWidget,
+                             public virtual weld::SpinButton
 {
+    Q_OBJECT
+
     QtDoubleSpinBox* m_pSpinBox;
 
 public:
@@ -57,6 +61,9 @@ public:
     virtual void get_increments(sal_Int64& rStep, sal_Int64& rPage) const 
override;
     virtual void set_digits(unsigned int nDigits) override;
     virtual unsigned int get_digits() const override;
+
+private Q_SLOTS:
+    void handleValueChanged();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qt5/QtInstanceSpinButton.cxx b/vcl/qt5/QtInstanceSpinButton.cxx
index 4f51cd8694ce..e720caca9099 100644
--- a/vcl/qt5/QtInstanceSpinButton.cxx
+++ b/vcl/qt5/QtInstanceSpinButton.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <QtInstanceSpinButton.hxx>
+#include <QtInstanceSpinButton.moc>
 
 #include <vcl/qt/QtUtils.hxx>
 
@@ -16,6 +17,9 @@ QtInstanceSpinButton::QtInstanceSpinButton(QtDoubleSpinBox* 
pSpinBox)
     , m_pSpinBox(pSpinBox)
 {
     assert(pSpinBox);
+
+    connect(m_pSpinBox, QOverload<double>::of(&QtDoubleSpinBox::valueChanged), 
this,
+            &QtInstanceSpinButton::handleValueChanged);
 }
 
 void QtInstanceSpinButton::set_text(const OUString&) { assert(false && "Not 
implemented yet"); }
@@ -187,4 +191,10 @@ unsigned int QtInstanceSpinButton::get_digits() const
     return nDigits;
 }
 
+void QtInstanceSpinButton::handleValueChanged()
+{
+    SolarMutexGuard aGuard;
+    signal_value_changed();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to