首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Qt和QYoto:如何将它们放在一起?

Qt和QYoto:如何将它们放在一起?
EN

Stack Overflow用户
提问于 2013-09-24 11:52:15
回答 1查看 159关注 0票数 0

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

EN

回答 1

Stack Overflow用户

发布于 2013-09-24 11:58:11

此示例说明了Qt/Qyoto的用法

代码语言:javascript
复制
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的使用方法,因为它没有官方文档。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18972683

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档