Exemplo n.º 1
0
	QScriptValue Clipboard::setImage(const QScriptValue &data) const
	{
		QClipboard *clipboard = QApplication::clipboard();

		QObject *object = data.toQObject();
		if(Code::Image *image = qobject_cast<Code::Image*>(object))
			clipboard->setImage(image->image(), mMode);
		else
			clipboard->setImage(data.toVariant().value<QImage>(), mMode);
	
		return thisObject();
	}
Exemplo n.º 2
0
void ImageWindow::copyImage(){
    QImage img = _imageView->widget()->convertImage(_displayImg);
    QClipboard *clipboard = QApplication::clipboard();
    if(_selectButton->isChecked()){
        QRect rect(_selectWidget->getX()->value(),_selectWidget->getY()->value(),_selectWidget->getWidth()->value(),_selectWidget->getHeight()->value());
        QImage image = img.copy(rect);
        clipboard->setImage(image);
    }
    else
    {
        clipboard->setImage(img);
    }
}
Exemplo n.º 3
0
void locWmGlDisplay::snapshotToClipboard()
{
    paintGL(); // Redraw the scene in case it needs to be updated.
    QClipboard *cb = QApplication::clipboard(); // get the clipboard
    QImage tempPicture(this->grabFrameBuffer(false)); // grab current image
    cb->setImage(tempPicture); // put current image on the clipboard.
}
Exemplo n.º 4
0
void test1()
{
	QAxObject excel( "Excel.Application", 0);
	excel.setProperty("Visible", true);

	QAxObjectPtr workbooks(excel.querySubObject("Workbooks"));
	QAxObjectPtr workbook(workbooks->querySubObject("Add()"));
	QAxObjectPtr sheets(workbook->querySubObject("Worksheets"));
	sheets->dynamicCall("Add()");
	QAxObjectPtr sheet(sheets->querySubObject( "Item( int )", 1 ));
	// sheet->setProperty("Name","Nova Planilha");

	QAxObjectPtr range(sheet->querySubObject("Cells(int,int)",1,1));
	range->setProperty("Value", QVariant(1234));

	QImage image("c:/Users/jhlee/Dropbox/orgwiki/img/class01.png");
	QClipboard* clip = QApplication::clipboard();
	clip->setImage(image);
	QAxObjectPtr shapes(sheet->querySubObject("Shapes"));
	sheet->dynamicCall("Paste()");
	int shapeCount = shapes->property("Count").toInt();
	QAxObjectPtr shape(shapes->querySubObject(QString::fromLatin1("Item(%1)").arg(shapeCount).toAscii()));

	// shapes->dynamicCall("AddPicture( QString&, bool, bool, double, double, double, double","c:\\Users\\jhlee\\Dropbox\\orgwiki\\img\\class01.png",true,true,100,100,70,70);

	excel.setProperty("DisplayAlerts", false);
	workbook->dynamicCall("SaveAs(QString&)", "c:\\temp\\testexcel.xlsx");
	// //workbook->dynamicCall("Close()");
	// //excel.dynamicCall("Quit()");
	// workbook->dynamicCall("Close (Boolean)", true);
	excel.dynamicCall("Quit()");
}
Exemplo n.º 5
0
//clipboard
void SliceEditView::CopyToClipboard()
{
	if(supportMode)
		return;
	QClipboard *clipboard = QApplication::clipboard();
	clipboard->setImage(topImg);
}
Exemplo n.º 6
0
void ViewWidget::copyImage()
{
	_generator.repaintImage();
	const QImage& image = _generator.getImage();

	QClipboard* clipboard = QApplication::clipboard();
	clipboard->setImage(image, QClipboard::Clipboard);
}
void PFSViewMainWin::copyImage()
{
  QClipboard *cb = QApplication::clipboard();

  const QImage *image = pfsView->getDisplayedImage();
  cb->setImage( *image, QClipboard::Clipboard );
  statusBar()->showMessage( "Image copied to clipboard", 2000 );
}
Exemplo n.º 8
0
void itemdetail::on_copy_clicked()
{
    //ui->templete_view->selectAll();
    //ui->templete_view->copy();
    QImage img("temp.jpg");
    QClipboard *clipboard = QApplication::clipboard();
    clipboard->setImage(img);
    emit log_changed("已复制商品图片到剪切板...\r\n");
    log_ch("复制成功\r\n");
}
Exemplo n.º 9
0
    void SaveScreenshotWizardPage::on_saveToClipboardCommandLinkButton_clicked()
    {
        QClipboard *clipboard = QApplication::clipboard();

        clipboard->setImage(capturePixmap().toImage());

        screenshotWizard()->mSaveTarget = ScreenshotWizard::ClipboardSaveTarget;

        wizard()->accept();
    }
Exemplo n.º 10
0
// ---------------------------------------------------------------------
int wdclipwriteimage(char *s)
{
  QClipboard *clipboard = app->clipboard();
  if (!clipboard) return 1;
  if (!s || !strlen(s)) clipboard->clear();
  else {
    QImage image(s2q(s));
    if (image.isNull()) return 1;
    clipboard->setImage(image);
  }
  return 0;
}
Exemplo n.º 11
0
// ---------------------------------------------------------------------
int wdclipwriteimagedata(const uchar *data,int len)
{
  QClipboard *clipboard = app->clipboard();
  if (!clipboard) return 1;
  if (!data || len<=0) clipboard->clear();
  else {
    QImage image=QImage();
    if (image.loadFromData(data, len) && !image.isNull()) {
      clipboard->setImage(image);
    } else return 1;
  }
  return 0;
}
Exemplo n.º 12
0
void OverviewWindow::takeSnapshot()
{
   View* pView = dynamic_cast<View*>(mpOverview);
   if (pView != NULL)
   {
      QImage image;
      pView->getCurrentImage(image);
      if (image.isNull() == false)
      {
         QClipboard* pClipboard = QApplication::clipboard();
         pClipboard->setImage(image);
      }
   }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicSnapshotViewToClipboardFeature::onActionTriggered(bool isChecked)
{
    RimViewWindow* viewWindow = RiaApplication::activeViewWindow();

    if (viewWindow)
    {
        QClipboard* clipboard = QApplication::clipboard();
        if (clipboard)
        {
            QImage image = viewWindow->snapshotWindowContent();
            if (!image.isNull())
            {
                clipboard->setImage(image);
            }
        }
    }
}
Exemplo n.º 14
0
void RenderView::copyToClipboard()
{
	if ((luxStatistics("sceneIsReady") || luxStatistics("filmIsReady")) && luxfb->isVisible()) {
		QImage image = getFramebufferImage(overlayStats, showAlpha);
		if (image.isNull()) {
			LOG(LUX_ERROR, LUX_SYSTEM) << tr("Error getting framebuffer").toLatin1().data();
			return;
		}

		QClipboard *clipboard = QApplication::clipboard();
		// QT assumes 32bpp images for clipboard (DIBs)
		if (!clipboard) {
			LOG(LUX_ERROR, LUX_SYSTEM) << tr("Copy to clipboard failed, unable to open clipboard").toLatin1().data();
			return;
		}
		clipboard->setImage(image.convertToFormat(QImage::Format_ARGB32));
	}
}
Exemplo n.º 15
0
void ClipboardSingleton::queuedSetClipboardData(const QVariant& data, ClipboardType type)
{
    // work with clipboard in main thread
    QClipboard *clipboard = QApplication::clipboard();

    switch (type)
    {
    case TEXT:
        {
            QString plainText = data.toString();
            Q_ASSERT(plainText.isEmpty());

            clipboard->setText(plainText);
        }
        break;

    case RICHTEXT:
        {
            QString richText = data.toString();
            Q_ASSERT(richText.isEmpty());

            QMimeData mime;
            mime.setHtml(richText);
            clipboard->setMimeData(&mime);
        }
        break;

    case IMAGE:
        {
            QImage image = data.value<QImage>();
            Q_ASSERT(image.isNull());

            clipboard->setImage(image);
        }
        break;

    default:
        Q_ASSERT("You sould't be here" && false);
        break;
    }
}
Exemplo n.º 16
0
void PixelWidget::copyToClipboard()
{
    QClipboard *cb = QApplication::clipboard();
    cb->setImage(m_surface);
}
Exemplo n.º 17
0
void ImageView::copy() {
    QClipboard *clipboard = QApplication::clipboard();
    clipboard->setImage(image());
}
Exemplo n.º 18
0
/*! Takes a snapshot of the current display and pastes it to the clipboard.

This action is activated by the KeyboardAction::SNAPSHOT_TO_CLIPBOARD enum,
binded to \c Ctrl+C by default.
*/
void QGLViewer::snapshotToClipboard() {
  QClipboard *cb = QApplication::clipboard();
  cb->setImage(frameBufferSnapshot());
}
Exemplo n.º 19
0
void CpaperWidget::paperCopy()
{
	
	QClipboard *clipboard = QApplication::clipboard();
	clipboard->setImage(*bufferImage);
}
Exemplo n.º 20
0
void CopyPaste::copy() {
	QImage copy = ourImage->getImage()->copy(ourImage->getSelection());
	QClipboard *clipboard = QApplication::clipboard();
	clipboard->setImage(copy);
}
Exemplo n.º 21
0
void Transfer::OnDownLoadFinish(const QString& file_path){
    QClipboard *board = QApplication::clipboard();
    QDir dir("./");
    if(!dir.exists(TEMP_DIR_NAME)){
        if(!dir.mkdir(TEMP_DIR_NAME)){
            return ;
        }
    }
    if(QFile::exists(file_path)){
        QFileInfo file_info(file_path);
        QString file_name = file_info.fileName();

        if(file_name == TEMP_TEXT_FILE_NAME){
            QFile file(file_path);
            if(file.open(QIODevice::ReadOnly)){
                board->setText(file.readAll());
            }
            file.close();
        }
        else if(file_name == TEMP_HTML_FILE_NAME){
            QString save_path = QFileDialog::getSaveFileName(
                        NULL,
                        QObject::tr("Save Html"),
                        file_name,
                        QObject::tr("*.html"));
            if(!save_path.isEmpty()){
                QFile file(save_path);
                if(file.exists()){
                    file.remove();
                }
                file.setFileName(file_path);
                if(file.open(QIODevice::ReadOnly)){
                    file.copy(save_path);
                }
                file.close();
            }
        }
        else if(file_name == TEMP_IMG_FILE_NAME){
            QImage image(file_path);
            board->setImage(image);
        }
        else{
            QString save_path = QFileDialog::getSaveFileName(
                        NULL,
                        QObject::tr("Save File"),
                        file_name,
                        QObject::tr("*.*"));
            if(!save_path.isEmpty()){
                QFile file(save_path);
                if(file.exists()){
                    file.remove();
                }
                file.setFileName(file_path);
                if(file.open(QIODevice::ReadOnly)){
                    file.copy(save_path);
                }
                file.close();
            }
        }
    }
    is_transfering_ = false;
}
Exemplo n.º 22
0
void MathDisplay::copyImage()
{
	QClipboard *cb = QApplication::clipboard();
	cb->setImage(mathwidget->getUnthemedRender());
}