Révision d4b9f775 original.cpp
original.cpp | ||
---|---|---|
56 | 56 |
|
57 | 57 |
m_baseDir = QDir(QDir::homePath() + "/RyXeo-WebPhotoAlbum"); |
58 | 58 |
m_baseDir.setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot); |
59 |
QFileInfoList list = m_baseDir.entryInfoList(); |
|
59 |
QFileInfoList list = m_baseDir .entryInfoList();
|
|
60 | 60 |
for(int i = 0; i < list.count(); i++) { |
61 | 61 |
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeWidget); |
62 | 62 |
item->setText(0, list.at(i).fileName()); |
... | ... | |
81 | 81 |
|
82 | 82 |
actions << a_nouveau << a_renommer << a_supprimer; |
83 | 83 |
m_menu->addActions(actions); |
84 |
|
|
85 |
//============== le menu contextuel du treewidget (gauche) |
|
86 |
ui->lwPictures->setDragEnabled(true); |
|
87 |
ui->lwPictures->setDropIndicatorShown(true); |
|
84 | 88 |
} |
85 | 89 |
|
86 | 90 |
original::~original() |
... | ... | |
318 | 322 |
{ |
319 | 323 |
m_menu->exec(ui->treeWidget->mapToGlobal(pos)); |
320 | 324 |
} |
325 |
|
|
326 |
void original::dragEnterEvent(QDragEnterEvent *event) |
|
327 |
{ |
|
328 |
if (event->mimeData()->hasUrls()) |
|
329 |
{ |
|
330 |
event->acceptProposedAction(); |
|
331 |
} |
|
332 |
else |
|
333 |
{ |
|
334 |
event->ignore(); |
|
335 |
} |
|
336 |
} |
|
337 |
|
|
338 |
void original::dropEvent(QDropEvent *event) |
|
339 |
{ |
|
340 |
qDebug() << "Accepte le drop d'une image"; |
|
341 |
|
|
342 |
if(event->mimeData()->hasUrls()) |
|
343 |
{ |
|
344 |
for(int i = 0; i < event->mimeData()->urls().count(); i++) { |
|
345 |
//recopier l'image dans le projet |
|
346 |
qDebug() << "Windows d&drop : " << event->mimeData()->urls().at(i).toString(); |
|
347 |
/* |
|
348 |
//Attention sous windows le drag & drop est un file:/// sous linux file:// et osx ? |
|
349 |
#ifdef Q_OS_WIN32 |
|
350 |
addPictureToProject(event->mimeData()->urls().at(i).toString().remove("file:///")); |
|
351 |
#endif |
|
352 |
#ifdef Q_OS_LINUX |
|
353 |
QString f(event->mimeData()->urls().at(i).toString().remove("file://")); |
|
354 |
qDebug() << "On importe par d&d le fichier " << f; |
|
355 |
addPictureToProject(f); |
|
356 |
#endif |
|
357 |
*/ |
|
358 |
qDebug() << "Accepte le drop d'une image"; |
|
359 |
event->acceptProposedAction(); |
|
360 |
} |
|
361 |
} |
|
362 |
} |
Formats disponibles : Unified diff