我已经下载并安装了 QT。我也下载并解压了Qyoto,我现在该怎么办?我如何将两者整合在一起。
问问题
159 次
1 回答
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 之前花一些时间在 C++ 中学习 Qt,因为它没有官方文档。
于 2013-09-24T03:58:11.387 回答