void MTPageCreateContract::on_pushButton_clicked()
{
    // Get text from the clipboard, and add it to the plainTextEdit widget
    //
    QClipboard *clipboard = QApplication::clipboard();

    if (NULL != clipboard)
    {
        QString qstrClipText = clipboard->text();

        if (!qstrClipText.isEmpty())
            ui->plainTextEdit->insertPlainText(qstrClipText);
    }
}
Пример #2
0
// Handle a mouse button press.
void QsciScintillaBase::mousePressEvent(QMouseEvent *e)
{
    setFocus();

    QSCI_SCI_NAMESPACE(Point) pt(e->x(), e->y());

    if (e->button() == Qt::LeftButton)
    {
        unsigned clickTime;

        // It is a triple click if the timer is running and the mouse hasn't
        // moved too much.
        if (triple_click.isActive() && (e->globalPos() - triple_click_at).manhattanLength() < QApplication::startDragDistance())
            clickTime = sci->lastClickTime + QSCI_SCI_NAMESPACE(Platform)::DoubleClickTime() - 1;
        else
            clickTime = sci->lastClickTime + QSCI_SCI_NAMESPACE(Platform)::DoubleClickTime() + 1;

        triple_click.stop();

        // Scintilla uses the Alt modifier to initiate rectangular selection.
        // However the GTK port (under X11, not Windows) uses the Control
        // modifier (by default, although it is configurable).  It does this
        // because most X11 window managers hijack Alt-drag to move the window.
        // We do the same, except that (for the moment at least) we don't allow
        // the modifier to be configured.
        bool shift = e->state() & Qt::ShiftButton;
        bool ctrl = e->state() & Qt::ControlButton;
#if !defined(Q_WS_X11)
        bool alt = e->modifiers() & Qt::AltButton;
#else
        bool alt = ctrl;
#endif

        sci->ButtonDown(pt, clickTime, shift, ctrl, alt);
    }
    else if (e->button() == Qt::MidButton)
    {
        QClipboard *cb = QApplication::clipboard();

        if (cb->supportsSelection())
        {
            int pos = sci->PositionFromLocation(pt);

            sci->sel.Clear();
            sci->SetSelection(pos, pos);

            sci->pasteFromClipboard(QClipboard::Selection);
        }
    }
}
Пример #3
0
void WidgetLeds::actionMenuPaste()
{
    if (isLedFrameInClipboard())
    {
        QClipboard *clipboard = QApplication::clipboard();

        LedFrame lf;
        if (lf.fromText(clipboard->text()))
        {
            setLedFrame(lf);
            emit ledFrameChanged();
        }
    }
}
Пример #4
0
void CMouseMoveMap::slotCopyPosPixel()
{
    IMap& map = CMapDB::self().getMap();

    double u = mousePos.x();
    double v = mousePos.y();

    map.convertPt2Pixel(u,v);
    QString position = QString("%1 %2").arg(u, 0,'f',0).arg(v,0,'f',0);

    QClipboard *clipboard = QApplication::clipboard();
    clipboard->setText(position);

}
Пример #5
0
void ScriptContentDialog::on_clipboardButton_clicked()
{
	QClipboard *clipboard = QApplication::clipboard();

	switch(mType)
	{
	case Read:
		clipboard->setText(ui->scriptContent->toPlainText());
		break;
	case Write:
		ui->scriptContent->setPlainText(clipboard->text());
		break;
	}
}
void DesignDocumentControllerView::toClipboard() const
{
    QClipboard *clipboard = QApplication::clipboard();

    QMimeData *data = new QMimeData;

    data->setText(toText());
    QStringList imports;
    foreach (const Import &import, model()->imports())
        imports.append(import.toString());

    data->setData("QmlDesigner::imports", stringListToArray(imports));
    clipboard->setMimeData(data);
}
Пример #7
0
void ccPointListPickingDlg::processPickedPoint(ccPointCloud* cloud, unsigned pointIndex, int x, int y)
{
	if (cloud != m_associatedCloud || !cloud || !MainWindow::TheInstance())
		return;

	cc2DLabel* newLabel = new cc2DLabel();
	newLabel->addPoint(cloud,pointIndex);
	newLabel->setVisible(true);
	newLabel->setDisplayedIn2D(false);
	newLabel->setDisplayedIn3D(true);
	newLabel->setCollapsed(true);
	ccGenericGLDisplay* display = m_associatedCloud->getDisplay();
	if (display)
	{
		newLabel->setDisplay(display);
		int vp[4];
		display->getViewportArray(vp);
		newLabel->setPosition(	static_cast<float>(x+20)/static_cast<float>(vp[2]-vp[0]),
								static_cast<float>(y+20)/static_cast<float>(vp[3]-vp[1]) );
	}

	//add default container if necessary
	if (!m_orderedLabelsContainer)
	{
		m_orderedLabelsContainer = new ccHObject(s_pickedPointContainerName);
		m_associatedCloud->addChild(m_orderedLabelsContainer);
		m_orderedLabelsContainer->setDisplay(display);
		MainWindow::TheInstance()->addToDB(m_orderedLabelsContainer,false,true,false,false);
	}
	assert(m_orderedLabelsContainer);
	m_orderedLabelsContainer->addChild(newLabel);
	MainWindow::TheInstance()->addToDB(newLabel,false,true,false,false);
	m_toBeAdded.push_back(newLabel);

	//automatically send the new point coordinates to the clipboard
	QClipboard* clipboard = QApplication::clipboard();
	if (clipboard)
	{
		const CCVector3* P = cloud->getPoint(pointIndex);
		int precision = m_associatedWin ? m_associatedWin->getDisplayParameters().displayedNumPrecision : 6;
		int indexInList = startIndexSpinBox->value() + static_cast<int>(m_orderedLabelsContainer->getChildrenNumber()) - 1;
		clipboard->setText(QString("CC_POINT_#%0(%1;%2;%3)").arg(indexInList).arg(P->x,0,'f',precision).arg(P->y,0,'f',precision).arg(P->z,0,'f',precision));
	}

	updateList();

	if (m_associatedWin)
		m_associatedWin->redraw();
}
Пример #8
0
QString
GlobalActionManager::copyPlaylistToClipboard( const dynplaylist_ptr& playlist )
{
    QUrl link( QString( "%1/%2/create/" ).arg( hostname() ).arg( playlist->mode() == OnDemand ? "station" : "autoplaylist" ) );

    if ( playlist->generator()->type() != "echonest" )
    {
        tLog() << "Only echonest generators are supported";
        return QString();
    }

    TomahawkUtils::urlAddQueryItem( link, "type", "echonest" );
    TomahawkUtils::urlAddQueryItem( link, "title", playlist->title() );

    QList< dyncontrol_ptr > controls = playlist->generator()->controls();
    foreach ( const dyncontrol_ptr& c, controls )
    {
        if ( c->selectedType() == "Artist" )
        {
            if ( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType )
                TomahawkUtils::urlAddQueryItem( link, "artist_limitto", c->input() );
            else
                TomahawkUtils::urlAddQueryItem( link, "artist", c->input() );
        }
        else if ( c->selectedType() == "Artist Description" )
        {
            TomahawkUtils::urlAddQueryItem( link, "description", c->input() );
        }
        else
        {
            QString name = c->selectedType().toLower().replace( " ", "_" );
            Echonest::DynamicPlaylist::PlaylistParam p = static_cast< Echonest::DynamicPlaylist::PlaylistParam >( c->match().toInt() );
            // if it is a max, set that too
            if ( p == Echonest::DynamicPlaylist::MaxTempo || p == Echonest::DynamicPlaylist::MaxDuration || p == Echonest::DynamicPlaylist::MaxLoudness
               || p == Echonest::DynamicPlaylist::MaxDanceability || p == Echonest::DynamicPlaylist::MaxEnergy || p == Echonest::DynamicPlaylist::ArtistMaxFamiliarity
               || p == Echonest::DynamicPlaylist::ArtistMaxHotttnesss || p == Echonest::DynamicPlaylist::SongMaxHotttnesss || p == Echonest::DynamicPlaylist::ArtistMaxLatitude
               || p == Echonest::DynamicPlaylist::ArtistMaxLongitude )
                name += "_max";

            TomahawkUtils::urlAddQueryItem( link, name, c->input() );
        }
    }

    QClipboard* cb = QApplication::clipboard();
    QByteArray data = percentEncode( link );
    cb->setText( data );

    return link.toString();
}
Пример #9
0
void qtDLGDebugStrings::MenuCallback(QAction* pAction)
{
	if(QString().compare(pAction->text(),"Line") == 0)
	{
		QClipboard* clipboard = QApplication::clipboard();
		clipboard->setText(QString("%1:%2")
			.arg(tblDebugStrings->item(m_selectedRow,0)->text())
			.arg(tblDebugStrings->item(m_selectedRow,1)->text()));
	}
	else if(QString().compare(pAction->text(),"Debug String") == 0)
	{
		QClipboard* clipboard = QApplication::clipboard();
		clipboard->setText(tblDebugStrings->item(m_selectedRow,1)->text());
	}
}
Пример #10
0
void VoxCad::Paste(void)
{
	if (CurViewMode == VM_EDITLAYER){
		CVXC_Structure Layer;
		CXML_Rip LocXML;

		QClipboard *clipboard = QApplication::clipboard();
		std::string Text = clipboard->text().toStdString();
		LocXML.fromXMLText(&Text);
		Layer.ReadXML(&LocXML);

		MainObj.ImposeLayerCur(&Layer);
		ReqGLUpdateAll(); 
	}
}
Пример #11
0
void VoxCad::Copy(void)
{
	if (CurViewMode == VM_EDITLAYER){
		CVXC_Structure Layer;
		MainObj.ExtractCurLayer(&Layer);

		CXML_Rip LocXML;
		Layer.WriteXML(&LocXML);
		std::string Text;
		LocXML.toXMLText(&Text);

		QClipboard *clipboard = QApplication::clipboard();
		clipboard->setText(Text.c_str());
	}
}
Пример #12
0
void TStyleSelection::cutStyles()
{
	if (isEmpty())
		return;
	QClipboard *clipboard = QApplication::clipboard();
	QMimeData *oldData = cloneData(clipboard->mimeData());
	TStyleSelection *selection = new TStyleSelection(this);
	if (m_pageIndex == 0 && (isSelected(m_palette, 0, 0) || isSelected(m_palette, 0, 1))) {
		MsgBox(CRITICAL, "Can't delete colors #0 and #1");
		return;
	}
	cutStylesWithoutUndo(m_palette, m_pageIndex, &m_styleIndicesInPage);

	TUndoManager::manager()->add(new CutStylesUndo(selection, oldData));
}
Пример #13
0
/**
 * @if english
 * This is the destructor method for this class.
 * @endif
 * @if spanish
 * Este es el metodo destructor para esta clase.
 * @endif
*/
TupMainWindow::~TupMainWindow()
{
    #ifdef K_DEBUG
           TEND;
    #endif

    QClipboard *clipboard = QApplication::clipboard();
    clipboard->clear(QClipboard::Clipboard);

    delete TupPluginManager::instance();
    delete TOsd::self();
 
    delete m_projectManager;
    delete penView;
}
Пример #14
0
void MainWindow::on_action_CopyPassword_triggered()
{
    int row = ui->listWidget->currentRow();
    QListWidgetItem *widgetItem = ui->listWidget->currentItem();

    if(row >= 0 && widgetItem && widgetItem->isSelected())
    {
        QClipboard *clipboard = QApplication::clipboard();
        QList<PasswordItem> list = this->accountFile->getPasswordList();
        QString password = list.at(row).password;

        clipboard->setText(password);
        QTimer::singleShot(60 * 1000, this, SLOT(on_action_ClearClipboard_triggered()));
    }
}
Пример #15
0
void CObjInfo::on_cb_copy1_clicked()
////////////////////////////////////
{
  QClipboard *clipboard = QApplication::clipboard();
  double ra, dec;

  ra = m_infoItem.radec.Ra;
  dec = m_infoItem.radec.Dec;

  precess(&ra, &dec, JD2000, m_map->m_mapView.jd);

  QString str = getStrRA(ra) + " "  + getStrDeg(dec);

  clipboard->setText(str);
}
Пример #16
0
// Send response to clipboard or standard error
void ImodClipboard::sendResponse(int succeeded)
{
  static int lastResponse = 0;
  QString str;
  if (succeeded < 0)
    succeeded = lastResponse;
  lastResponse = succeeded;
  if (mUseStdin) {
    imodPrintStderr("%s\n", succeeded ? "OK" : "ERROR");
  } else {
    str.sprintf("%u %s", ourWindowID(), succeeded ? "OK" : "ERROR");
    QClipboard *cb = QApplication::clipboard();
    //cb->setSelectionMode(false);
    cb->setText(str);
  }
}
Пример #17
0
void CMouseMoveMap::slotCopyPosDegree()
{
    IMap& map = CMapDB::self().getMap();
    double u = mousePos.x();
    double v = mousePos.y();

    map.convertPt2Rad(u,v);
    u *= RAD_TO_DEG;
    v *= RAD_TO_DEG;
    QString position;
    GPS_Math_Deg_To_Str(u, v, position);

    QClipboard *clipboard = QApplication::clipboard();
    clipboard->setText(position);

}
Пример #18
0
    void Notifier::onCopyDocument()
    {
        QModelIndex selectedInd = _observer->selectedIndex();
        if (!selectedInd.isValid())
            return;

        BsonTreeItem *documentItem = QtUtils::item<BsonTreeItem*>(selectedInd);
        if (!documentItem)
            return;

        if (!detail::isSimpleType(documentItem))
            return;

        QClipboard *clipboard = QApplication::clipboard();
        clipboard->setText(documentItem->value());
    }
Пример #19
0
void QtLogView::on_SaveToClipboard_clicked()
{
  QClipboard *clipboard = QApplication::clipboard();
  QString loggingMessagesAsText = QString("");
  for (int i=0; i<ui.tableView->model()->rowCount(); i++)
    {
    for (int j=0; j<ui.tableView->model()->columnCount(); j++)
      {
      QModelIndex index = ui.tableView->model()->index(i, j);
      loggingMessagesAsText += ui.tableView->model()->data(index, Qt::DisplayRole).toString() + " ";
      }
    loggingMessagesAsText += "\n";
    }

  clipboard->setText(loggingMessagesAsText);
}
Пример #20
0
int Jovie::sayClipboard()
{
    // Get the clipboard object.
    QClipboard *cb = qApp->clipboard();

    // Copy text from the clipboard.
    QString text = cb->text();

    // Speak it.
    if (!(text.isNull() || text.isEmpty()))
    {
        return Speaker::Instance()->say(callingAppId(), text, 0);
    } else {
        return 0;
    }
}
Пример #21
0
QString GlobalConfigWidget::getClipboard()
{
   QClipboard *clipboard = QApplication::clipboard();

   switch( Settings::value( Settings::GlobalClipboardMode ) )
   {
      case 1:
      case 3:
         return clipboard->text( QClipboard::Selection );
      case 2:
      case 4:
         return clipboard->text( QClipboard::Clipboard );
      default:
         return QString();
   }
}
Пример #22
0
void MainWindow::copyCurrentUrlToClipboard()
{
    FileInfo * currentItem = _selectionModel->currentItem();

    if ( currentItem )
    {
	QClipboard * clipboard = QApplication::clipboard();
	QString url = currentItem->url();
	clipboard->setText( url );
	showProgress( tr( "Copied to system clipboard: %1" ).arg( url ) );
    }
    else
    {
	showProgress( tr( "No current item" ) );
    }
}
Пример #23
0
void SearchJobWidget::copyTorrentURLs()
{
    const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
    QStringList urls;
    for (const QModelIndex &rowIndex : rows) {
        const QString descrLink = m_proxyModel->data(
                    m_proxyModel->index(rowIndex.row(), SearchSortModel::DESC_LINK)).toString();
        if (!descrLink.isEmpty())
            urls << descrLink;
    }

    if (!urls.empty()) {
        QClipboard *clipboard = QApplication::clipboard();
        clipboard->setText(urls.join('\n'));
    }
}
Пример #24
0
void SliceEditView::PasteFromClipboard()
{
	if(supportMode)
		return;

	QClipboard *clipboard = QApplication::clipboard();
	if(clipboard->image().isNull())
		return;

	modified = true;
	topImg = clipboard->image();
	pDrawingContext->SetUpperImg(&topImg);
    RefreshContext(1);//所以我们可以撤消粘贴...
    SaveToUndoBuffer();//由于图像被改变,保存到缓冲器。
	ReCompress();
}
Пример #25
0
// The timeout occurred - if count has not expired, resend message with an
// added space, otherwise write error message and exit with error
void ImodSendEvent::timerEvent(QTimerEvent *e)
{
  if (++retryCount < retryLimit) {
    timeStr += " ";
    QString qstr = timeStr + cmdStr;
    QClipboard *cb = QApplication::clipboard();
    //cb->setSelectionMode(false);
    if (debugOut)
      fprintf(stderr, "Imodsendevent - resending %s \n", LATIN1(qstr));
    cb->setText(qstr);
    return;
  }
  fprintf(stderr, "ERROR: imodsendevent - timeout before response received "
          "from target 3dmod\n");
  QApplication::exit(2);
}
Пример #26
0
Incidence::Ptr DndFactory::pasteIncidence( const KDateTime &newDateTime,
                                           const QFlags<PasteFlag> &pasteOptions )
{
  QClipboard *clipboard = QApplication::clipboard();
  MemoryCalendar::Ptr calendar( createDropCalendar( clipboard->mimeData() ) );

  if ( !calendar ) {
    kDebug() << "Can't parse clipboard";
    return Incidence::Ptr();
  }

  Incidence::List incidenceList = calendar->incidences();
  Incidence::Ptr incidence = incidenceList.isEmpty() ? Incidence::Ptr() : incidenceList.first();

  return d->pasteIncidence( incidence, newDateTime, pasteOptions );
}
Пример #27
0
void SliceEditView::PasteFromClipboard()
{
	if(supportMode)
		return;

	QClipboard *clipboard = QApplication::clipboard();
	if(clipboard->image().isNull())
		return;

	modified = true;
	topImg = clipboard->image();
	pDrawingContext->SetUpperImg(&topImg);
	RefreshContext(1);//so we can undo the paste...
	SaveToUndoBuffer();//since the image is altered, save to the buffer.
	ReCompress();
}
Пример #28
0
void TableWidget::copy()
{
	// Get a list of all selected ranges:
	QList<QTableWidgetSelectionRange> selectedRanges = this->selectedRanges();
	if(selectedRanges.isEmpty()) return;
	
	// Establish the outer boundary of all selections:
	int leftColumn  = this->columnCount() - 1;
	int rightColumn = 0;
	int topRow      = this->rowCount() - 1;
	int bottomRow   = 0;
	
	for(int i = 0; i < selectedRanges.size(); i++)
	{
		QTableWidgetSelectionRange range = selectedRanges.at(i);
		
		if(range.leftColumn()  < leftColumn)  leftColumn  = range.leftColumn();
		if(range.rightColumn() > rightColumn) rightColumn = range.rightColumn();
		if(range.topRow()      < topRow)      topRow      = range.topRow();
		if(range.bottomRow()   > bottomRow)   bottomRow   = range.bottomRow();
	}
	
	if(bottomRow < topRow or rightColumn < leftColumn) return;
	
	// Loop through selection range and extract data:
	QString outputText;
	
	for(int i = topRow; i <= bottomRow; i++)
	{
		for(int j = leftColumn; j <= rightColumn; j++)
		{
			if(this->item(i, j)->isSelected())
			{
				outputText += this->item(i, j)->text();
			}
			
			if (j < rightColumn) outputText += "\t";
			else                 outputText += "\n";
		}
	}
	
	// Copy data to clipboard:
	QClipboard *clipboard = QApplication::clipboard();
	clipboard->setText(outputText);
	
	return;
}
Пример #29
0
Incidence *DndFactory::pasteIncidence( const QDate &newDate, const QTime *newTime )
{
  QClipboard *cb = QApplication::clipboard();
  Calendar *cal = createDropCalendar( cb->mimeData() );

  if ( !cal ) {
    kDebug() << "Can't parse clipboard";
    return 0;
  }

  Incidence::List incList = cal->incidences();
  Incidence *inc = incList.isEmpty() ? 0 : incList.first();

  Incidence *newInc = d->pasteIncidence( inc, newDate, newTime );
  newInc->setRelatedTo( 0 );
  return newInc;
}
Пример #30
0
void HuboInitWidget::handleJointCopy()
{
    QString copyText;
    
    for(int i=0; i<HUBO_JOINT_COUNT; i++)
    {
        double pos = h_state.joint[i].pos;
        if( degSelect->isChecked() )
            pos = pos*180.0/M_PI;
        
        if(i>0)
            QTextStream(&copyText) << "\t";
        QTextStream(&copyText) << QString::number(pos);
    }
    QClipboard* clipboard = QApplication::clipboard();
    clipboard->setText(copyText);
}