QClipboard issues
-
-
Per doc I shlould have only ONE
QClipboard *clipboard = QGuiApplication::clipboard();
in my application.
My app is "subdirs" project , where should this line of code be ?
At present I need clipboard only in one subproject. -
The original MDI example has few preprocessor codes likes this one ,
#ifndef QT_NO_CLIPBOARD
......
#endifbut no
QClipboard *clipboard = QGuiApplication::clipboard();- AT present , when I move mouse into a text
I get this error just moving into the text , no mouse click
QXcbClipboard: SelectionRequest too old
QXcbClipboard: SelectionRequest too old- My test code - compiles at that is all I get now
QClipboard *clipboard = QGuiApplication::clipboard();
QString originalText = clipboard->text();
QString newText ="Clipboard text test ";
clipboard->setText(newText); -
-
-
Per doc I shlould have only ONE
QClipboard *clipboard = QGuiApplication::clipboard();
in my application.
My app is "subdirs" project , where should this line of code be ?
At present I need clipboard only in one subproject. -
The original MDI example has few preprocessor codes likes this one ,
#ifndef QT_NO_CLIPBOARD
......
#endifbut no
QClipboard *clipboard = QGuiApplication::clipboard();- AT present , when I move mouse into a text
I get this error just moving into the text , no mouse click
QXcbClipboard: SelectionRequest too old
QXcbClipboard: SelectionRequest too old- My test code - compiles at that is all I get now
QClipboard *clipboard = QGuiApplication::clipboard();
QString originalText = clipboard->text();
QString newText ="Clipboard text test ";
clipboard->setText(newText);@AnneRanch said in QClipboard issues:
My app is "subdirs" project , where should this line of code be ?
Everywhere where you need to access the clipboard. QGuiApplication is a singleton, which means that when you call
QGuiApplication::clipboard()you are always accessing one, single instance of QClipboard. So you don't need to worry here, you can call it as much as you like.- The original MDI example has few preprocessor codes likes this one ,
#ifndef QT_NO_CLIPBOARD
You can ignore it. Prebuilt Qt is always compiled with clipboard support enabled - so you don't need these ifdefs.
- AT present , when I move mouse into a text
I get this error just moving into the text , no mouse click
No idea, sorry.
- My test code - compiles at that is all I get now
Code looks good. I don't know why you read contents of the clipboard before setting them to something else, but I don't know your use case here.
-