• 3999阅读
  • 5回复

请问一下关于按钮和对话框连接的问题! [复制链接]

上一主题 下一主题
离线wangbenqq
 

只看楼主 倒序阅读 楼主  发表于: 2008-03-25
— 本帖被 XChinux 执行加亮操作(2008-07-17) —
我用QTDesigner设计了一个界面和一个对话框。我怎么把界面上的一个按钮和对话框连接起来呢?
也就是当点击按钮的时候,要弹出我设计的对话框!!
谢谢!
我是新手,希望赐教!!
离线wangbenqq

只看该作者 1楼 发表于: 2008-03-26
是不是得用一个SLOT来连接它们阿?怎么连接阿?用什么SLOT阿??
谢谢赐教!
离线zncggaofei
只看该作者 2楼 发表于: 2008-03-26
接收按钮的clicked()信号,然后new dialog

MainWindow::on_pushbutton_clicked()
{
      QDialog *dialog = new QDialog();
}
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线zncggaofei
只看该作者 3楼 发表于: 2008-03-26
忘了dialog->exec()了
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线wangbenqq

只看该作者 4楼 发表于: 2008-03-26
谢谢!刚搞会了,其实很简单
只要把自己做的DIALOG的文件都拷到文件夹下面,然后在主界面的CPP文件里声明DIALOG,就可以了
然后用信号槽机制,地DIALOG,SLOTS(show())
就可以了
呵呵,搞了一上午,走了好多复杂的弯路!搞了好多代码!
原来这么简单!
唉!
不过学习了好多别的东西,呵呵,但是效率好低阿!
离线wangbenqq

只看该作者 5楼 发表于: 2008-03-26
3楼的同学,留个联系方式吧?方便交流!谢谢!我的QQ是:164989426。你的呢?
快速回复
限100 字节
 
上一个 下一个