Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QClipboard issues
Qt 6.11 is out! See what's new in the release blog

QClipboard issues

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 443 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1
    1. 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.

    2. The original MDI example has few preprocessor codes likes this one ,

    #ifndef QT_NO_CLIPBOARD
    ......
    #endif

    but no
    QClipboard *clipboard = QGuiApplication::clipboard();

    1. 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

    1. 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);

    sierdzioS 1 Reply Last reply
    0
    • A Anonymous_Banned275
      1. 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.

      2. The original MDI example has few preprocessor codes likes this one ,

      #ifndef QT_NO_CLIPBOARD
      ......
      #endif

      but no
      QClipboard *clipboard = QGuiApplication::clipboard();

      1. 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

      1. 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);

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @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.

      1. 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.

      1. AT present , when I move mouse into a text
        I get this error just moving into the text , no mouse click

      No idea, sorry.

      1. 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.

      (Z(:^

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved