Code Monkey home page Code Monkey logo

qyoto's Introduction

README
------

Qyoto comprises of set of C# classes wrapping the Qt 4.3 library for
use with Mono/.NET, along with a runtime that interfaces with the
language independent Smoke library that was originally designed for
PerlQt and is currently also used for QtRuby.

The API is pretty much the same as the C++ one, the main differences
being the following:

 - Method names begin with a capital letter

 - Q_PROPERTYs are mapped onto .NET properties and, for example, the
property 'windowTitle' with the accessors 'setWindowTitle()'
and 'windowTitle()' becomes just a 'WindowTitle' property
in .NET/Mono.

 - The declaration of signals/slots is slightly different, although
the QMetaObject created at runtime for QObject subclasses is
identical to the equivalent C++ class:

To mark methods as slots, just add a Q_SLOT attribute to them.
For example:

[Q_SLOT]
void ButtonClicked() {
    // do something
}


Each QObject subclass with signals, has a signals interface with the
method signatures of all the signals for that class. To create custom
signals, you first have to create an interface which inherits from
the signals interface of the parent class. In this interface you
declare your signals, all marked with the Q_SIGNAL attribute. Then
you need to override the Property 'Emit' of the class for which you
want to emit the custom signals. The return value of 'Emit' is the
protected variable Q_EMIT (actually a transparent proxy), casted to
the type of the class's signals interface.

To emit a signal, use 'Emit.SignalName(<an optional arg list>)'

For example:

class Test : QWidget {
    // some code
    
    protected ITestSignals Emit { get { return (ITestSignals)
Q_EMIT; } }
    
    public void MyMethod() {
        // here we emit our custom signal
        Emit.TestSignal(5);
    }
    
    // some code
}

interface ITestSignals {
    [Q_SIGNAL]
    void TestSignal(int arg1);
}


Signals and slots are connected in the same way as for C++, except
that the signal and slot signatures are strings. For instance:

Connect(qApp, SIGNAL("aboutToQuit()"), this, SLOT("quit()"));

Qyoto also provides a set of tools for use with Qt Designer .ui files
and resources in .rcc files, uics and csrcc (ports of uic and rcc to
produce C# code). Invocation from the command line is the same as for
the C++ tools. To use your generated GUI code, first create an
instance of the Ui class, then call SetupUi() with the current widget
as parameter and your GUI will be set up, just like in C++.

For example:

class Test : QWidget {
    Ui.Form ui;
    
    public Test() {
        ui = new Ui.Form(),
        ui.SetupUi(this);
    }
}

To use resources, just compile the generated code into your
application and then call Q_INIT_RESOURCE() in Main().
Excerpt from the simpletreeview example:

public static int Main(string[] args) {
    Q_INIT_RESOURCE("simpletreemodel");
    new QApplication(args);
    QFile file = new QFile(":/default.txt");
    
    // more code...
}

qyoto's People

Contributors

bcooksley avatar cfeck avatar dfaure avatar eean avatar ereslibre avatar fundawang avatar heliocastro avatar montel avatar pumphaus avatar rdale avatar reavertm avatar sedwards2009 avatar tittiatcoke avatar winterz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.