本文整理汇总了C++中QClipboard类的典型用法代码示例。如果您正苦于以下问题:C++ QClipboard类的具体用法?C++ QClipboard怎么用?C++ QClipboard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QClipboard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_pushButton_clicked
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: setFocus
// 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: actionMenuPaste
void WidgetLeds::actionMenuPaste()
{
if (isLedFrameInClipboard())
{
QClipboard *clipboard = QApplication::clipboard();
LedFrame lf;
if (lf.fromText(clipboard->text()))
{
setLedFrame(lf);
emit ledFrameChanged();
}
}
}
示例4: QString
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: on_clipboardButton_clicked
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;
}
}
示例6: toClipboard
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: cc2DLabel
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: link
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: if
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: Paste
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: Copy
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: cutStyles
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: instance
/**
* @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: on_action_CopyPassword_triggered
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: precess
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);
}