Qt和QYoto:怎么把它们放在一起?

时间:2013-09-24 03:52:15

标签: qt qyoto

我已经下载并安装了QT。我还下载并解压缩了Qyoto,我现在该怎么办?  我如何将两者结合在一起。

1 个答案:

答案 0 :(得分:0)

这个例子说明了Qt / Qyoto的使用

type MySpinner(parent : QWidget) =
    inherit QSpinBox(parent)
    override this.MouseReleaseEvent(e : QMouseEvent) =
        base.MouseReleaseEvent(e)
        printfn "spinner clicked! x: %i, y: %i" (e.X()) (e.Y())

type QyotoApp() as this = 
    inherit QWidget()

    let button, label, layout, spinner =
        new QPushButton("Count!", this),
        new QLabel("Enter a value to count to:", this),
        new QVBoxLayout(this),
        new MySpinner(this)

    do this.WindowTitle <- "F#/Qyoto Example"
       this.ToolTip <- "This is a QWidget"
       this.Resize(250, 75)
       this.Move(300, 300)
       layout.AddWidget(label)
       layout.AddWidget(spinner)
       layout.AddWidget(button)
       button.Checkable <- true
       spinner.SetRange(0, Int32.MaxValue)
       QObject.Connect(button, QObject.SIGNAL("clicked(bool)"), 
           this, QObject.SLOT("ButtonClicked(bool)")) |> ignore
       this.Show()

    [<Q_SLOT>]
    member this.ButtonClicked(toggled : bool) =      
        printfn "button checked: %b" toggled
        List.iter (printfn "%i") [1 .. spinner.Value]

[<EntryPoint>]
let main (args : string[]) =
    new QApplication(args) |> ignore
    new QyotoApp() |> ignore
    QApplication.Exec()

我建议您在跳入Qyoto之前花一些时间在Qt中学习Qt,因为它没有官方文档。