コード例 #1
0
void CanvasTabBar::dropEvent(QDropEvent *event)
{
	auto mimeData = event->mimeData();
	
	if (mimeData->hasUrls())
	{
		_tabWidget->addCanvasesFromUrls(mimeData->urls());
		event->acceptProposedAction();
	}
}
コード例 #2
0
/**
 * @brief haven't done yet
 */
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
    qDebug()<<"drag enter event";
    auto data = event->mimeData();
    qDebug()<<"has image : "<<data->hasImage();
    qDebug()<<"has text : "<<data->hasText();
    qDebug()<<"has urls : "<<data->hasUrls();
    //if (event->mimeData()->hasImage()){
    event->acceptProposedAction();
    //}
}
コード例 #3
0
void FilePropertyWidgetQt::dropEvent(QDropEvent* drop) {
    auto data = drop->mimeData();
    if (data->hasUrls()) {
        if(data->urls().size()>0) {
            auto url = data->urls().first();
            property_->set(url.toLocalFile().toStdString());

            drop->accept();
        }
    }
}
コード例 #4
0
ファイル: launcherdata.cpp プロジェクト: KDE/kde-workspace
bool LauncherData::canDecode(const QMimeData *mimeData)
{
    if (KBookmark::List::canDecode(mimeData)) {

        QDomDocument tempDoc;
        return hasUrls(
            KBookmark::List::fromMimeData(mimeData, tempDoc));
    }

    // TODO: Maybe allow text/plain as well if it looks like a URL
    return false;
}
コード例 #5
0
ファイル: main_window.cpp プロジェクト: zsy056/imgresize
void MainWindow::dropEvent(QDropEvent* event)
{
    qDebug() << "Drop event";
    auto mimeData = event->mimeData();
    if (mimeData->hasUrls()) {
        QStringList pathList;
        auto urlList = mimeData->urls();
        for (int i=0; i<urlList.size(); ++i) {
            pathList.append(urlList.at(i).toLocalFile());
        }
        addTabs(pathList);
    }
}
コード例 #6
0
void FilePropertyWidgetQt::dragEnterEvent(QDragEnterEvent* event) {
    switch (property_->getAcceptMode()) {
        case FileProperty::AcceptMode::Save: {
            event->ignore();
            return;
        }
        case FileProperty::AcceptMode::Open: {
            if (event->mimeData()->hasUrls()) {
                auto data = event->mimeData();
                if (data->hasUrls()) {
                    if (data->urls().size() > 0) {
                        auto url = data->urls().first();
                        auto file = url.toLocalFile().toStdString();
                        
                        switch (property_->getFileMode()) {
                            case FileProperty::FileMode::AnyFile:
                            case FileProperty::FileMode::ExistingFile:
                            case FileProperty::FileMode::ExistingFiles: {
                                auto ext = toLower(filesystem::getFileExtension(file));
                                for (const auto& filter : property_->getNameFilters()) {
                                    if (filter.extension_ == ext) {
                                        event->accept();
                                        return;
                                    }
                                }
                                break;
                            }
                        
                            case FileProperty::FileMode::Directory:
                            case FileProperty::FileMode::DirectoryOnly: {
                                if(filesystem::directoryExists(file)) {
                                    event->accept();
                                    return;
                                }
                                break;
                            }
                        }
                    }
                }
            }
            event->ignore();
            return;
        }      
    }
}
コード例 #7
0
ファイル: mainwindow.cpp プロジェクト: equation314/CCR-Plus
void MainWindow::dropEvent(QDropEvent* event)
{
    auto data = event->mimeData();
    if (data->hasUrls() && data->urls().size() == 1)
    {
        QString path = data->urls().first().toLocalFile();
        if (path.size() >= 2 && path[0] == '/' && path[1] == '/') path.remove(0, 1);
        if (QDir(path).exists())
        {
            if (is_locked)
            {
                StopJudging();
                QMessageBox::warning(this, "", QString("测评被终止!"));
            }
            LoadContest(path);
        }
    }
}
コード例 #8
0
ファイル: mainwindow.cpp プロジェクト: equation314/CCR-Plus
void MainWindow::dragEnterEvent(QDragEnterEvent* event)
{
    auto data = event->mimeData();
    if (data->hasUrls() && data->urls().size() == 1 && QDir(data->urls().at(0).toLocalFile()).exists()) event->acceptProposedAction();
    else event->ignore();
}
コード例 #9
0
ファイル: mainwindow.cpp プロジェクト: yjdwbj/convertav
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    layout_main(new QGridLayout),
    btn_OpenFile(new QPushButton(QStringLiteral("添加视频"))),
    btn_ConvertAll(new QPushButton()),
    btn_Settings(new QPushButton()),
    lwt_ConverFiles(new MyListWidget),
    m_PreViewPlay(new PreViewPlay),
    m_PrePlayProcess(new QProcess),
    m_ToolBoxSettings(new ToolBoxSettings),
    m_LastPath("")
{

    m_AppPath = qApp->applicationDirPath();
    m_mplayer=m_AppPath+("/mplayer.exe");
//    m_mencoder=m_AppPath+("/mencoder.exe");
    m_ffmpeg=m_AppPath+("/ffmpeg.exe");
    setWindowTitle(QString("视频转换工具")+version);

    QPixmap pixmap("::/lcy/image/bg-sel.png");
    m_brush.setTexture(pixmap);
    m_palette.setBrush(backgroundRole(), QBrush(pixmap));
    this->setStyleSheet("QListWidget::item::selected{"
                        "background-color: beige;}");



    this->setWindowFlags(Qt::WindowMinimizeButtonHint|
                         Qt::WindowCloseButtonHint);

    m_configfile = QDir::homePath()+"/Application Data/ConvertToMJPEG/convert_to_mjeg.ini";
    if(!QFileInfo(m_configfile).exists())
    {
        QDir(QDir::root()).mkpath(QFileInfo(m_configfile).absolutePath());
    }
    if(!QFileInfo(m_mplayer).exists())
    {
        FilesOrDirNoExists(m_mplayer);
    }

    if(!QFileInfo(m_ffmpeg).exists())
    {
        FilesOrDirNoExists(m_ffmpeg);
    }

    lwt_ConverFiles->setFixedWidth(600);
    lwt_ConverFiles->setObjectName("mainList");

    connect(lwt_ConverFiles,SIGNAL(deleteAllItems(QAction*)),SLOT(slot_removeAllItem(QAction*)));
    connect(lwt_ConverFiles,SIGNAL(itemClicked(QListWidgetItem*)),SLOT(slot_ClickToSetCurrentRow(QListWidgetItem*)));
    connect(lwt_ConverFiles,SIGNAL(hasUrls(QList<QUrl>)),SLOT(slot_GotUrls(QList<QUrl>)));
    //    lwt_ConverFiles->setAlternatingRowColors(true);
    lwt_ConverFiles->setResizeMode(QListView::Fixed);


    btn_ConvertAll->setFixedSize(201,56);
    btn_ConvertAll->setIconSize(btn_ConvertAll->size());
    btn_ConvertAll->setIcon(QPixmap(":/lcy/image/convertall-1.png").copy(2,56,203,56));
    btn_ConvertAll->setToolTip(QStringLiteral("全部转换"));
    connect(btn_ConvertAll,SIGNAL(clicked()),SLOT(slot_ConvertAll()));


    btn_OpenFile->setFixedSize(112,26);
    btn_OpenFile->setIconSize(btn_OpenFile->size());
//    btn_OpenFile->setIcon(QPixmap(":/lcy/image/video+.png").copy(0,0,112,26));
    QPalette palette;
    palette.setBrush(QPalette::All,QPalette::Button,QBrush(QPixmap(":/lcy/image/video+.png").copy(0,0,112,26)));
    btn_OpenFile->setPalette(palette);

    connect(btn_OpenFile,SIGNAL(clicked()),SLOT(slot_openfiles()));
    layout_main->addWidget(btn_OpenFile,0,0);
    layout_main->addWidget(btn_ConvertAll,0,1,Qt::AlignLeft);

    btn_Settings->setFixedSize(106,56);
    btn_Settings->setIconSize(btn_Settings->size());
    btn_Settings->setIcon(QPixmap(":/lcy/image/preset-1.png").copy(2,56,108,56));
    btn_Settings->setToolTip(QStringLiteral("系统设置"));
    layout_main->addWidget(btn_Settings,0,3,Qt::AlignRight);
    connect(btn_Settings,SIGNAL(clicked()),SLOT(slot_Settings()));


//    layout_main->addWidget(lwt_ConverFiles,1,0,2,2);
    m_guide = new MyFrame;
    connect(m_guide,SIGNAL(GotStringList(QStringList)),SLOT(slot_GotFileListFromGuide(QStringList)));
    m_guide->setFixedWidth(600);
    layout_main->addWidget(m_guide,1,0,2,2);
    layout_main->addWidget(m_PreViewPlay,1,3);
    layout_main->addWidget(m_ToolBoxSettings,2,3);

    QWidget *w = new QWidget(parent);
    w->setLayout(layout_main);
    setCentralWidget(w);
}