我已经下载并安装了QT。我还下载并解压了Qyoto,我现在该怎么办?我如何将两者集成在一起。
发布于 2013-09-24 11:58:11
此示例说明了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()我建议你在进入C++之前花一些时间学习Qt的使用方法,因为它没有官方文档。
https://stackoverflow.com/questions/18972683
复制相似问题