本文整理汇总了C++中QClipboardData::source方法的典型用法代码示例。如果您正苦于以下问题:C++ QClipboardData::source方法的具体用法?C++ QClipboardData::source怎么用?C++ QClipboardData::source使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QClipboardData
的用法示例。
在下文中一共展示了QClipboardData::source方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMimeData
void QClipboard::setMimeData(QMimeData* src, Mode mode)
{
if (mode != Clipboard) return;
QClipboardData *d = clipboardData();
/* Propagate text data to other QWSClients */
QString newText;
if( src != 0 )
newText = src->text();
QString oldText;
if( d->source() != 0 )
oldText = d->source()->text();
d->setSource(src);
if( oldText != newText ) {
if( d->source() == 0 ) {
qwsSetClipboardText( QString() );
} else {
qwsSetClipboardText( d->source()->text() );
}
}
emitChanged(QClipboard::Clipboard);
}
示例2: mimeData
const QMimeData* QClipboard::mimeData(Mode mode) const
{
if (mode != Clipboard) return 0;
QClipboardData *d = clipboardData();
// Try and get data from QWSProperty if no mime data has been set on us.
if( !d->source() ) {
QString t = qwsClipboardText();
if( !t.isEmpty() ) {
QMimeData* nd = new QMimeData;
nd->setText( t );
d->setSource( nd );
}
}
return d->source();
}
示例3: mimeData
const QMimeData* QClipboard::mimeData(Mode mode) const
{
if (mode != Clipboard) return 0;
QClipboardData *d = clipboardData();
bool dataExists(false);
if (d)
{
TRAPD(err,{
RFs fs = qt_s60GetRFs();
CClipboard* cb = CClipboard::NewForReadingLC(fs);
Q_ASSERT(cb);
//stream for qt
RStoreReadStream stream;
TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream);
if (stid != 0) {
stream.OpenLC(cb->Store(),stid);
QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream));
CleanupStack::PopAndDestroy(&stream);
dataExists = true;
}
else {
//symbian clipboard
RStoreReadStream symbianStream;
TStreamId symbianStId = (cb->StreamDictionary()).At(KClipboardUidTypePlainText);
if (symbianStId != 0) {
symbianStream.OpenLC(cb->Store(), symbianStId);
QT_TRYCATCH_LEAVING(readSymbianStoreLX(d->source(), cb));
CleanupStack::PopAndDestroy(&symbianStream);
dataExists = true;
}
}
CleanupStack::PopAndDestroy(cb);
});
if (err != KErrNone){
qDebug()<< "clipboard is empty/err: " << err;
}
if (dataExists) {
return d->source();
}
}
示例4: mimeData
const QMimeData* QClipboard::mimeData(Mode mode) const
{
if (mode != Clipboard) return 0;
QClipboardData *d = clipboardData();
if (d)
{
TRAPD(err,{
RFs fs = qt_s60GetRFs();
CClipboard* cb = CClipboard::NewForReadingLC(fs);
Q_ASSERT(cb);
RStoreReadStream stream;
TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream);
stream.OpenLC(cb->Store(),stid);
QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream));
CleanupStack::PopAndDestroy(2,cb);
return d->source();
});
if (err != KErrNone){
qDebug()<< "clipboard is empty/err: " << err;
}
}
示例5: event
bool QClipboard::event(QEvent *e)
{
static bool recursionWatch = false;
if (e->type() != QEvent::Clipboard || recursionWatch)
return QObject::event(e);
recursionWatch = true;
QWSPropertyNotifyEvent *event = (QWSPropertyNotifyEvent *)(((QClipboardEvent *)e)->data());
if (event && event->simpleData.state == QWSPropertyNotifyEvent::PropertyNewValue) {
QClipboardData *d = clipboardData();
QString t = qwsClipboardText();
if( (d->source() == 0 && !t.isEmpty()) || (d->source() != 0 && d->source()->text() != t) ) {
if( !d->source() )
d->setSource(new QMimeData);
d->source()->setText( t );
emitChanged(QClipboard::Clipboard);
}
}
recursionWatch = false;
return true;
}
示例6: mimeData
const QMimeData* QClipboard::mimeData(Mode mode) const
{
QClipboardData *d = 0;
switch (mode) {
case Selection:
d = selectionData();
break;
case Clipboard:
d = clipboardData();
break;
default:
qWarning("QClipboard::mimeData: unsupported mode '%d'", mode);
return 0;
}
if (! d->source() && ! timer_event_clear) {
if (mode == Selection) {
if (! selection_watcher)
selection_watcher = new QClipboardWatcher(mode);
d->setSource(selection_watcher);
} else {
if (! clipboard_watcher)
clipboard_watcher = new QClipboardWatcher(mode);
d->setSource(clipboard_watcher);
}
if (! timer_id) {
// start a zero timer - we will clear cached data when the timer
// times out, which will be the next time we hit the event loop...
// that way, the data is cached long enough for calls within a single
// loop/function, but the data doesn't linger around in case the selection
// changes
QClipboard *that = ((QClipboard *) this);
timer_id = that->startTimer(0);
}
}
return d->source();
}
示例7: event
//.........这里部分代码省略.........
XSelectionRequestEvent *req = &xevent->xselectionrequest;
if (requestor && req->requestor == requestor->internalWinId())
break;
XEvent event;
event.xselection.type = SelectionNotify;
event.xselection.display = req->display;
event.xselection.requestor = req->requestor;
event.xselection.selection = req->selection;
event.xselection.target = req->target;
event.xselection.property = XNone;
event.xselection.time = req->time;
DEBUG("QClipboard: SelectionRequest from %lx\n"
" selection 0x%lx (%s) target 0x%lx (%s)",
req->requestor,
req->selection,
X11->xdndAtomToString(req->selection).data(),
req->target,
X11->xdndAtomToString(req->target).data());
QClipboardData *d;
if (req->selection == XA_PRIMARY) {
d = selectionData();
} else if (req->selection == ATOM(CLIPBOARD)) {
d = clipboardData();
} else {
qWarning("QClipboard: Unknown selection '%lx'", req->selection);
XSendEvent(dpy, req->requestor, False, NoEventMask, &event);
break;
}
if (! d->source()) {
qWarning("QClipboard: Cannot transfer data, no data available");
XSendEvent(dpy, req->requestor, False, NoEventMask, &event);
break;
}
DEBUG("QClipboard: SelectionRequest at time %lx (ours %lx)",
req->time, d->timestamp);
if (d->timestamp == CurrentTime // we don't own the selection anymore
|| (req->time != CurrentTime && req->time < d->timestamp)) {
DEBUG("QClipboard: SelectionRequest too old");
XSendEvent(dpy, req->requestor, False, NoEventMask, &event);
break;
}
Atom xa_targets = ATOM(TARGETS);
Atom xa_multiple = ATOM(MULTIPLE);
Atom xa_timestamp = ATOM(TIMESTAMP);
struct AtomPair { Atom target; Atom property; } *multi = 0;
Atom multi_type = XNone;
int multi_format = 0;
int nmulti = 0;
int imulti = -1;
bool multi_writeback = false;
if (req->target == xa_multiple) {
QByteArray multi_data;
if (req->property == XNone
|| !X11->clipboardReadProperty(req->requestor, req->property, false, &multi_data,
0, &multi_type, &multi_format)
|| multi_format != 32) {