[SOLVED][Drag'n Drop] QMainWindow and linking error
-
Hi,
I've let the implementation away, I was testing.
Because I've noticed that GCC can complain about missing definition, but not for missing implementation.Isn't it? =P
-
You must at least have empty functions.
They needn't be filled but the function body is a must. -
Ok, I'll do it.
BTW, do you know if the implementation explained in the FAQ, if I Want to be able to drag-n-drop from the desktop to my app? (since it's not a part of my app =/ )?
Thanks for tour help! -
Hi,
I did that once and could dig a bit for it, but that takes time.
In general, you have to do it like in the docs, I never used this faq, only the online docs.You can start at the "examples for drag'n'drop":http://doc.qt.nokia.com/4.7/examples-draganddrop.html
-
Hi,
I created a small wiki article on how to open files from drag operations inside a QMainWindow:
"wiki article":http://developer.qt.nokia.com/wiki/Drag_and_Drop_of_files
On windows, I would connect that with the "assignment of file types":http://developer.qt.nokia.com/wiki/Assigning_a_file_type_to_an_Application_on_Windows
Hope that helps a bit.
Have fun.
-
Hi,
Thank you a lot !
I've added empty functions, and it worked (:/).Thank, I saw your Wiki, GREAT !
But something wrong (perhaps from me, perhaps from Qt)@void MainWindow::dropEvent(QDropEvent *de)
{
const QMimeData * mimeData = de->mimeData();if (mimeData->hasUrls())
{
qDebug() << mimeData->urls(); // Line 10
}
}@I have tons of errors :/
Line 10 above is line 10 here: http://pastebin.com/89k8G0aqThank you for your help anyway :)
-
Hi Max,
I'm not sure, whether QList<QUrls> is able to be streamed to qDebug.
If you read the wiki, you will find I use the local paths of the urls, so like this:@
void DocumentWindow::dropEvent(QDropEvent* event)
{
const QMimeData* mimeData = event->mimeData();// check for our needed mime type, here a file or a list of files if (mimeData->hasUrls()) { QList<QUrl> urlList = mimeData->urls(); // extract the local paths of the files for (int i = 0; i < urlList.size() && i < 32; ++i) { qDebug() << urlList.at(i).toLocalFile(); } }
}
@ -
Sorry...
Usually, i'm less dumb ^^
I have the same errors with this line: @QList<QUrl> urlList = mimeData->urls();@
So:
@void MainWindow::dropEvent(QDropEvent *de)
{
const QMimeData * mimeData = de->mimeData();if (mimeData->hasUrls())
{
QList<QUrl> urlList = mimeData->urls();
}
}@Is the error between my chair and my computer ? =P
-
[quote author="Max13" date="1302617263"]Is the error between my chair and my computer ? =P[/quote]
Perhaps :-)
I saw you are using Qt 4.7.3?
I only tried with 4.7.2... on windows
There I had no problems.Are you missing some includes? The error talks about forward declarations...
@
#include <QtCore/QUrl>
#include <QtCore/QList>@
-
Hi !
Sorry for having made the dead.I've reinstalled the libs, did everything you explained, and...
IT WORKS GREAT !!
Thank you a lot for you patience.
I'm done now :)