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. How to check if there is something in the clipboard
QtWS25 Last Chance

How to check if there is something in the clipboard

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.8k Views
  • 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.
  • B Offline
    B Offline
    brlebtag
    wrote on last edited by
    #1

    How do i check if there is something in the clipboard? i mean if there is something to paste...

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      QClipboard has the mimeData() method. It can tell you what is on the clipboard.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        steno
        wrote on last edited by
        #3

        The documentation has an example of this.

        "Documentation":http://qt-project.org/doc/qt-5/qclipboard.html

        1 Reply Last reply
        0
        • B Offline
          B Offline
          brlebtag
          wrote on last edited by
          #4

          i dont want to know what is on the clipboard but if there is something there...

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            [quote author="brlebtag" date="1391639035"]i dont want to know what is on the clipboard but if there is something there...[/quote]

            The hint I gave you before will tell you that too... Note at quite often, the answer will be "yes, there is". Whether it is something you can paste is another matter.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              brlebtag
              wrote on last edited by
              #6

              do i have to do mimeData().text().isEmpty() to check if clipboard is empty ?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                I'd just take the count of formats... Or, you just take the data, and check its size. Or, you use the hasText(), hasHtml, etc. functions to see if the formats you support are on the clipboard.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  brlebtag
                  wrote on last edited by
                  #8

                  I got it now.. Thx a lot!...

                  1 Reply Last reply
                  0

                  • Login

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