Announcement

Collapse
No announcement yet.

Perl Qt bindings

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Perl Qt bindings

    The Perl Qt bindings are available for the Ubuntu 11.04 or later > libqtcore4-perl, > libqtgui4-perl.


    Installing the libqtgui4-perl and a short perl script:
    Code:
    #!/usr/bin/perl -w
    
    use strict;
    use warnings;
    use QtCore4;
    use QtGui4;
    
    
    my $app = Qt::Application(\@ARGV);
    
    my $window = Qt::Widget();
    $window->resize(200, 120);
    
    my $quit = Qt::PushButton(Qt::String("Click Me"), $window);
    $quit->setGeometry(10, 40, 180, 40);
    $app->connect($quit, SIGNAL('clicked()'), $app, SLOT('quit()'));
    
    $window->show();
    $app->exec();
    =>





    The KDE docs > Development/Languages/Perl
    Before you edit, BACKUP !

    Why there are dead links ?
    1. Thread: Please explain how to access old kubuntu forum posts
    2. Thread: Lost Information

    #2
    QML from a Perl script

    The QML interface can be called from the Perl or the Python scripts.

    From a Perl script:

    /media/sda3/QML/Perl-QML-ThumbFlow/thumbflow.pl
    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    use QtCore4;
    use QtGui4;
    use QtDeclarative4;
    
    
    my $app = Qt::Application(\@ARGV);
    
    my $window = Qt::DeclarativeView();
    $window->setSource(Qt::Url("/media/sda3/QML/Perl-QML-ThumbFlow/main.qml"));
    
    $window->show();
    $app->exec();

    Direct link: http://www.dailymotion.com/video/xsgx49_thumbflow_tech


    The QML (coverflow ~ thumbflow) code is from: http://projects.developer.nokia.com/QMLTemplates

    Dependencies: libqtgui4-perl, libqtdeclarative4-perl.
    Have you tried ?

    - How to Ask a Question on the Internet and Get It Answered
    - How To Ask Questions The Smart Way

    Comment


      #3
      @Rog131,
      I don't know perl, but pretty good with Qt. Normally you would have a layout in between your main widget and the button. Something like:
      Code:
      //sudo code
      button = new QPushButton(...)
      layout = new QHBoxLayout(...)
      widget = new QWidget(...)
      
      layout->addWidget(button)
      widget->setLayout(layout)
      widget->show()
      With this set up I think you can get rid of 1, and maybe both, of your geometry/resize calls. This will also allow the dynamic resizing to behave, which I am guessing right now doesn't behave.
      FKA: tanderson

      Comment

      Working...
      X