Fix compile with -DQT_NO_DRAGANDDROP

Change-Id: Ic7b42ae164f913f270c8350c2de6ce35f0be8c2a
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Montel Laurent 2012-12-05 11:43:14 +01:00 committed by The Qt Project
parent 4d178743e4
commit 422b8dd24e
3 changed files with 8 additions and 0 deletions

View File

@ -52,12 +52,14 @@ class TorrentView : public QTreeWidget
public: public:
TorrentView(QWidget *parent = 0); TorrentView(QWidget *parent = 0);
#ifndef QT_NO_DRAGANDDROP
signals: signals:
void fileDropped(const QString &fileName); void fileDropped(const QString &fileName);
protected: protected:
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event);
#endif
}; };
// TorrentViewDelegate is used to draw the progress bars. // TorrentViewDelegate is used to draw the progress bars.
@ -688,9 +690,12 @@ void MainWindow::closeEvent(QCloseEvent *)
TorrentView::TorrentView(QWidget *parent) TorrentView::TorrentView(QWidget *parent)
: QTreeWidget(parent) : QTreeWidget(parent)
{ {
#ifndef QT_NO_DRAGANDDROP
setAcceptDrops(true); setAcceptDrops(true);
#endif
} }
#ifndef QT_NO_DRAGANDDROP
void TorrentView::dragMoveEvent(QDragMoveEvent *event) void TorrentView::dragMoveEvent(QDragMoveEvent *event)
{ {
// Accept file actions with a '.torrent' extension. // Accept file actions with a '.torrent' extension.
@ -708,5 +713,6 @@ void TorrentView::dropEvent(QDropEvent *event)
if (QFile::exists(fileName) && fileName.toLower().endsWith(".torrent")) if (QFile::exists(fileName) && fileName.toLower().endsWith(".torrent"))
emit fileDropped(fileName); emit fileDropped(fileName);
} }
#endif
#include "mainwindow.moc" #include "mainwindow.moc"

View File

@ -20,3 +20,4 @@ SUBDIRS = addressbook \
stardelegate stardelegate
QT += widgets QT += widgets
contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= puzzle

View File

@ -20,3 +20,4 @@ SUBDIRS = \
widgets widgets
contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows
contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= draganddrop