如何在 perl 中使用 Qt GUI(用 Qt Designer 创建)?
我已经在 Qt Designer 中创建了 Qt GUI 并将其编译(使用 puic4)到 gui.pm。 现在,我想在我的 Perl 应用程序中使用它,但我陷入困境,因为我不知道如何创建窗口对象。
我在 start.pl 中有以下代码:
use strict;
use QtCore4;
use QtGui4;
use gui; #compiled gui ('Ui_MainWindow' package)
my $a = Qt::Application(\@ARGV);
my $w = ??? #assign window object to $w
$w->show();
exit $a->exec();
我只需要创建窗口对象,但我找不到任何用 perl 编写的示例。有人可以帮助我吗?
I have created Qt GUI in Qt Designer and compiled it (using puic4) to gui.pm.
Now, I'd like to use it in my Perl application, but I'm stuck because I don't know how to create window object.
I have following code in start.pl:
use strict;
use QtCore4;
use QtGui4;
use gui; #compiled gui ('Ui_MainWindow' package)
my $a = Qt::Application(\@ARGV);
my $w = ??? #assign window object to $w
$w->show();
exit $a->exec();
I just need to create window object, but I can't find any example written in perl. Anyone can help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在源存储库中找到了以下解决方案:
问候 huck
I found the following solution in the source repository:
regards huck
假装我不知道 QTDesigner ,该示例来自 http://search.cpan.org/ dist/Qt/MANIFEST 你会遵循吗?
我认为,您选择一个 .ui 示例,运行 makefile(或手动),然后您就有一个可以调用的模块(即 my $w = my $chat = ChatMainWindow(); ).
Pretend that I don't know about QTDesigner , which example from http://search.cpan.org/dist/Qt/MANIFEST would you follow?
I think , you pick one of the .ui examples, run the makefile (or by hand), and then you have a module you can call (ie
my $w = my $chat = ChatMainWindow();
).