[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    [Kde-perl] <kein Betreff>
From:       Torben Menke <Tokes () web ! de>
Date:       2007-07-22 12:05:27
Message-ID: 4176166 () web ! de
[Download RAW message or body]

Drag+Drop with Perl-Qt and QT Designer

Hi there, i recently started to use perl-qt for building guis. I looks like a prety \
nice way. At the moment I face the problem, that I want to enable Drag+Drop of files \
into a QTable, that is located into a QMainWindow. I am prety sure it is a quite \
stupid beginners question, but i just can't find a solution.

http://doc.trolltech.com/3.3/dnd.html says that:

"To be able to receive media dropped on a widget, call setAcceptDrops(TRUE) for the \
widget (e.g. in its constructor), and override the event handler methods \
dragEnterEvent() and dropEvent()."

The first part setAcceptDrops(TRUE) can easily done using the designer, but I don't \
understand how i can overrite the methods of my table. 

I tried putting the following into the header file of my project krenameit.ui.h:

void FileTable::dragEnterEvent(QDragEnterEvent* event)
{
    my $event = shift;
    if (Qt::TextDrag::canDecode($event)) {
	$event->accept(1);
    }
    else {
	$event->accept(0);
    }
}

But converting this into a module by using puic the .pm shows:

sub dragEnterEvent
{
    my $event = shift;
    if (Qt::TextDrag::canDecode($event)) {
	$event->accept(1);
    }
    else {
	$event->accept(0);
    }
}

Now dropping onto the QMainWindow works, but that is not what i want :-(

Thanks in advance

Torben
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066

_______________________________________________
Kde-perl mailing list
Kde-perl@kde.org
https://mail.kde.org/mailman/listinfo/kde-perl


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic