Open files when they are dropped on the main window.
This commit is contained in:
@@ -60,7 +60,8 @@ lcMainWindow::~lcMainWindow()
|
||||
|
||||
void lcMainWindow::CreateWidgets()
|
||||
{
|
||||
setWindowIcon(QIcon(":/resources/leocad.png"));
|
||||
setAcceptDrops(true);
|
||||
setWindowIcon(QIcon(":/resources/icon64.png"));
|
||||
setWindowFilePath(QString());
|
||||
|
||||
CreateActions();
|
||||
@@ -687,6 +688,20 @@ void lcMainWindow::closeEvent(QCloseEvent *event)
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void lcMainWindow::dragEnterEvent(QDragEnterEvent* Event)
|
||||
{
|
||||
if (Event->mimeData()->hasUrls())
|
||||
Event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void lcMainWindow::dropEvent(QDropEvent* Event)
|
||||
{
|
||||
const QMimeData* MimeData = Event->mimeData();
|
||||
foreach (const QUrl &Url, MimeData->urls())
|
||||
if (OpenProject(Url.toLocalFile()))
|
||||
break;
|
||||
}
|
||||
|
||||
QMenu* lcMainWindow::createPopupMenu()
|
||||
{
|
||||
QMenu* Menu = new QMenu(this);
|
||||
|
||||
@@ -275,6 +275,8 @@ protected slots:
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent* Event);
|
||||
void dropEvent(QDropEvent* Event);
|
||||
QMenu* createPopupMenu();
|
||||
|
||||
void CreateActions();
|
||||
|
||||
Reference in New Issue
Block a user