QClipboard Class how to use ?

108 views
Skip to first unread message

stefano cerbioni

unread,
Jun 28, 2021, 3:58:28 PM6/28/21
to The Ring Programming Language
hi guys , anyone can explain me  with simple example how to use QClipboard Class ?

thanks at all

Mahmoud Fayed

unread,
Jun 30, 2021, 6:01:19 AM6/30/21
to The Ring Programming Language
Hello

>> "hi guys , anyone can explain me  with simple example how to use QClipboard Class ?"

We need to add the Clipboard() method to the QApplication class to be able to use the QClipboard class

For now, use the next code

shot1.png

load "guilib.ring"

oApp = new QApp {

   w = new QWidget() {

  setWindowTitle("Copy Text to Clipboard (Try Ctrl+V) ")

  resize(400,100)

  l = new MyClipboard(w) {

    setText("I Love Ring Programming!")

  }

  t = new QLineEdit(w)

  show()

  }

  exec()

}

class MyClipboard from QTextedit

  func init oParent

    super.init(oParent)

    hide()

    return self

  func setText cText

    super.setText(cText)

    selectall()

    copy()


Greetings,

Mahmoud

Mahmoud Fayed

unread,
Jun 30, 2021, 11:21:32 AM6/30/21
to The Ring Programming Language
Hello

Now, we can use the QClipboard class

(1) Update RingQt using the next command

ringpm update ringqt

(2) Try the next example

load "guilib.ring"

oApp = new qapp {

   w = new qWidget() {

     setWindowTitle("Using Clipboard - Press CTRL+V")

      resize(400,100)

      new qlineedit(w) {

        move(10,10)

        resize(200,30)

      }

      show()

    }

   oApp.clipboard().setText("I Love Ring Programming!",0)

   exec()

}


Greetings,

Mahmoud


On Monday, June 28, 2021 at 10:58:28 PM UTC+3 stf...@gmail.com wrote:

stefano cerbioni

unread,
Jul 2, 2021, 1:38:36 AM7/2/21
to Mahmoud Fayed, The Ring Programming Language
Many Thanks Mahmoud , for example , i going to study it , i try your
second example after update , but return me this error ,

Line 11700 Error (R3) : Calling Function without definition !: qapp_clipboard
In method clipboard() in file
/home/stefano/Documenti/ring/libraries/guilib/classes/ring_qt.ring
called from line 23 in file
/home/stefano/Documenti/ring/applications/TEST/clipboard/clipcopy.ring

thanks again bye
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "The Ring Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ring-lang+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ring-lang/8cac9720-85fc-4a7b-ac8a-a471f086f9dfn%40googlegroups.com.
>

Mahmoud Fayed

unread,
Jul 2, 2021, 2:54:39 AM7/2/21
to The Ring Programming Language
Hello

>> "Line 11700 Error (R3) : Calling Function without definition !: qapp_clipboard"

This means that the file (ringqt.dll) is not updated  (Maybe you tried ringpm update ringqt while Ring Notepad is running or while other RingQt application is running - this prevent updating the file because it's already opened)

Download the file, then copy it to ring/bin folder and accept replacing files

Greetings,
Mahmoud
Reply all
Reply to author
Forward
0 new messages