]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiClipboard.cpp
Add missing initialization
[lyx.git] / src / frontends / qt4 / GuiClipboard.cpp
index 1de945ed8e8ee99cc568da5daa122ad558e9aaf3..4c8d47e7f8c5eea6c3fb6a8b18acaeacd191f29c 100644 (file)
@@ -46,6 +46,7 @@
 #include <QString>
 #include <QStringList>
 #include <QTextDocument>
+#include <QTimer>
 
 #include <boost/crc.hpp>
 
@@ -112,7 +113,7 @@ GuiClipboard::GuiClipboard()
        connect(qApp->clipboard(), SIGNAL(dataChanged()),
                this, SLOT(on_dataChanged()));
        // initialize clipboard status.
-       on_dataChanged();
+       update();
 }
 
 
@@ -550,6 +551,17 @@ bool GuiClipboard::hasInternal() const
 
 
 void GuiClipboard::on_dataChanged()
+{
+       update();
+#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
+       // Retry on Windows (#10109)
+       if (cache_.formats().count() == 0) {
+               QTimer::singleShot(100, this, SLOT(update()));
+       }
+#endif
+}
+
+void GuiClipboard::update()
 {
        //Note: we do not really need to run cache_.update() unless the
        //data has been changed *and* the GuiClipboard has been queried.