mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Open files when they are dropped on the main window.
This commit is contained in:
parent
ed0e3a252f
commit
7e7e562d45
2 changed files with 18 additions and 1 deletions
|
@ -60,7 +60,8 @@ lcMainWindow::~lcMainWindow()
|
||||||
|
|
||||||
void lcMainWindow::CreateWidgets()
|
void lcMainWindow::CreateWidgets()
|
||||||
{
|
{
|
||||||
setWindowIcon(QIcon(":/resources/leocad.png"));
|
setAcceptDrops(true);
|
||||||
|
setWindowIcon(QIcon(":/resources/icon64.png"));
|
||||||
setWindowFilePath(QString());
|
setWindowFilePath(QString());
|
||||||
|
|
||||||
CreateActions();
|
CreateActions();
|
||||||
|
@ -687,6 +688,20 @@ void lcMainWindow::closeEvent(QCloseEvent *event)
|
||||||
event->ignore();
|
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* lcMainWindow::createPopupMenu()
|
||||||
{
|
{
|
||||||
QMenu* Menu = new QMenu(this);
|
QMenu* Menu = new QMenu(this);
|
||||||
|
|
|
@ -275,6 +275,8 @@ protected slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
void dragEnterEvent(QDragEnterEvent* Event);
|
||||||
|
void dropEvent(QDropEvent* Event);
|
||||||
QMenu* createPopupMenu();
|
QMenu* createPopupMenu();
|
||||||
|
|
||||||
void CreateActions();
|
void CreateActions();
|
||||||
|
|
Loading…
Reference in a new issue