Using the cursor object

edited March 2014 in Ruby Scripting
Hi Matthias-

Maybe you could show a short example of how to use the cursor object.
Something like-
1.Changing the cursor to busy
2. wait some time
3. change back to arrow

Thanks, Itamar

Comments

  • edited November -1

    Hi Itamar,

    the Cursor class is part of the Plugin framework and it is not employed outside of it. So unless you plan to implement extensions based on that framework, that class will be of little use.

    If you have a build with "Qt binding" enabled (the Windows build has for example), you can use the Qt methods to manipulate the cursor:

    # Note that RBA::MainWindow is also a RBA::QWidget which offers the cursor= method
    RBA::Application::instance::main_window.cursor = RBA::QCursor::new(RBA::Qt_CursorShape::ClosedHandCursor)
    

    Matthias

  • edited November -1
    Thanks. I am using the windows build.
  • edited November -1
    Matthias-

    Caould you please give also example of how to use the QClipboard.
    I'm trying to have the code copying a string to the windows clipboard.

    Thanks,
  • edited October 2014

    Hi,

    as a general rule, you won't find a lot of documentation about Qt in KLayout. The documentation source is the official Qt documentation.

    The QClipboard documentation gives this C++ sample code:

    QClipboard *clipboard = QApplication::clipboard();
    clipboard->setText(newText);
    

    So we can use the following sample script to set the clipboard in Ruby:

    clipboard = RBA::QApplication::clipboard
    clipboard.setText("Hello, world!")
    

    Matthias

  • edited November -1
    Thanks, it works excellent
Sign In or Register to comment.