本文整理汇总了C++中QClipboard::supportsSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ QClipboard::supportsSelection方法的具体用法?C++ QClipboard::supportsSelection怎么用?C++ QClipboard::supportsSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QClipboard
的用法示例。
在下文中一共展示了QClipboard::supportsSelection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClaimSelection
// Claim the selection.
void ScintillaQt::ClaimSelection()
{
bool isSel = !sel.Empty();
if (isSel)
{
QClipboard *cb = QApplication::clipboard();
// If we support X11 style selection then make it available now.
if (cb->supportsSelection())
{
SelectionText text;
CopySelectionRange(&text);
if (text.s)
cb->setMimeData(mimeSelection(text), QClipboard::Selection);
}
primarySelection = true;
}
else
primarySelection = false;
emit qsb->QSCN_SELCHANGED(isSel);
}
示例2: mousePressEvent
//------------------------------------------------------------------------------
//
void XxCopyLabel::mousePressEvent( QMouseEvent* event )
{
QClipboard *cb = QkApplication::clipboard();
cb->setText( _fulltext, cb->supportsSelection() ?
QClipboard::Selection :
QClipboard::Clipboard );
QLabel::mousePressEvent( event );
}
示例3: copyToClipboard
void copyToClipboard(const QString &text)
{
QClipboard *cb = QApplication::clipboard();
cb->setText(text, QClipboard::Clipboard);
if(cb->supportsSelection()) {
cb->setText(text, QClipboard::Selection);
}
}
示例4: QAbstractScrollArea
// The ctor.
QsciScintillaBase::QsciScintillaBase(QWidget *parent)
: QAbstractScrollArea(parent), preeditPos(-1), preeditNrBytes(0)
#if QT_VERSION >= 0x050000
, clickCausedFocus(false)
#endif
{
connect(verticalScrollBar(), SIGNAL(valueChanged(int)),
SLOT(handleVSb(int)));
connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
SLOT(handleHSb(int)));
setAcceptDrops(true);
setFocusPolicy(Qt::WheelFocus);
setAttribute(Qt::WA_KeyCompression);
setAttribute(Qt::WA_InputMethodEnabled);
#if QT_VERSION >= 0x050100
setInputMethodHints(
Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhMultiLine);
#elif QT_VERSION >= 0x040600
setInputMethodHints(Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText);
#endif
viewport()->setBackgroundRole(QPalette::Base);
viewport()->setMouseTracking(true);
//viewport()->setAttribute(Qt::WA_NoSystemBackground);
//viewport()->setAutoFillBackground(false);
//viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
// QPainter p( viewport() );
// p.setCompositionMode( QPainter::CompositionMode_Clear );
// p.fillRect( viewport()->rect(), Qt::transparent );
triple_click.setSingleShot(true);
#if (QT_VERSION >= 0x040200 && QT_VERSION < 0x050000 && defined(Q_OS_MAC)) || (QT_VERSION >= 0x050200 && defined(Q_OS_OSX))
initialiseRectangularPasteboardMime();
#endif
sci = new QsciScintillaQt(this);
SendScintilla(SCI_SETCARETPERIOD, QApplication::cursorFlashTime() / 2);
// Make sure the lexers are linked in.
if (!lexersLinked)
{
Scintilla_LinkLexers();
lexersLinked = true;
}
QClipboard *cb = QApplication::clipboard();
if (cb->supportsSelection())
connect(cb, SIGNAL(selectionChanged()), SLOT(handleSelection()));
// Add it to the pool.
poolList.append(this);
}
示例5: setGlobalMouseSelection
void GwtCallback::setGlobalMouseSelection(QString selection)
{
#ifdef Q_OS_LINUX
QClipboard* clipboard = QApplication::clipboard();
if (clipboard->supportsSelection())
clipboard->setText(selection, QClipboard::Selection);
s_globalMouseSelection = selection;
#endif
}
示例6: copy
void KviTopicWidget::copy()
{
QClipboard * c = QApplication::clipboard();
if(!c)
return;
if(c->supportsSelection())
c->setText(m_szTopic,QClipboard::Selection);
c->setText(m_szTopic,QClipboard::Clipboard);
}
示例7: copy
void CoordinateCapture::copy()
{
QClipboard *myClipboard = QApplication::clipboard();
//if we are on x11 system put text into selection ready for middle button pasting
if ( myClipboard->supportsSelection() )
{
myClipboard->setText( mpUserCrsEdit->text() + "," + mpCanvasEdit->text(), QClipboard::Selection );
}
myClipboard->setText( mpUserCrsEdit->text() + "," + mpCanvasEdit->text(), QClipboard::Clipboard );
}
示例8: QWidget
// The ctor.
QsciScintillaBase::QsciScintillaBase(QWidget *parent, const char *name,
WFlags f)
: QWidget(parent, name, f)
{
QGridLayout *layout = new QGridLayout(this, 2, 2);
txtarea = new QWidget(this, 0, WRepaintNoErase|WResizeNoErase);
txtarea->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding));
txtarea->setMouseTracking(true);
txtarea->setAcceptDrops(true);
txtarea->setFocusPolicy(WheelFocus);
txtarea->setFocusProxy(this);
layout->addWidget(txtarea, 0, 0);
vsb = new QScrollBar(Vertical, this);
layout->addWidget(vsb, 0, 1);
connect(vsb, SIGNAL(valueChanged(int)), SLOT(handleVSb(int)));
hsb = new QScrollBar(Horizontal, this);
layout->addWidget(hsb, 1, 0);
connect(hsb, SIGNAL(valueChanged(int)), SLOT(handleHSb(int)));
txtarea->installEventFilter(this);
setFocusPolicy(WheelFocus);
// FIXME: QMacPasteboardMime isn't in Qt v5 yet.
#if QT_VERSION >= 0x040200 && defined(Q_OS_MAC) && QT_VERSION < 0x050000
RectangularPasteboardMime::initialise();
#endif
sci = new QsciScintillaQt(this);
SendScintilla(SCI_SETCARETPERIOD, QApplication::cursorFlashTime() / 2);
// Make sure the lexers are linked in.
if (!lexersLinked)
{
Scintilla_LinkLexers();
lexersLinked = true;
}
QClipboard *cb = QApplication::clipboard();
if (cb->supportsSelection())
connect(cb, SIGNAL(selectionChanged()), SLOT(handleSelection()));
// Add it to the pool.
poolList.append(this);
}
示例9: mousePressEvent
// 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->modifiers() & Qt::ShiftModifier;
bool ctrl = e->modifiers() & Qt::ControlModifier;
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
bool alt = e->modifiers() & Qt::AltModifier;
#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);
}
}
}
示例10: setText
void Clipboard::setText(const QString& text)
{
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(text, QClipboard::Clipboard);
if (clipboard->supportsSelection()) {
clipboard->setText(text, QClipboard::Selection);
}
if (config()->get("security/clearclipboard").toBool()) {
int timeout = config()->get("security/clearclipboardtimeout").toInt();
if (timeout > 0) {
m_lastCopied = text;
m_timer->start(timeout * 1000);
}
}
}
示例11:
NS_IMETHODIMP
nsClipboard::SupportsSelectionClipboard(PRBool *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
QClipboard *cb = QApplication::clipboard();
if (cb->supportsSelection())
{
*_retval = PR_TRUE; // we support the selection clipboard
}
else
{
*_retval = PR_FALSE;
}
return NS_OK;
}
示例12: copy
void CoordinateCapture::copy()
{
QClipboard *myClipboard = QApplication::clipboard();
//if we are on x11 system put text into selection ready for middle button pasting
if ( myClipboard->supportsSelection() )
{
myClipboard->setText( mpUserCrsEdit->text() + "," + mpCanvasEdit->text(), QClipboard::Selection );
//QString myMessage = tr("Clipboard contents set to: ");
//statusBar()->showMessage(myMessage + myClipboard->text(QClipboard::Selection));
}
else
{
//user has an inferior operating system....
myClipboard->setText( mpUserCrsEdit->text() + "," + mpCanvasEdit->text(), QClipboard::Clipboard );
//QString myMessage = tr("Clipboard contents set to: ");
//statusBar()->showMessage(myMessage + myClipboard->text(QClipboard::Clipboard));
}
}
示例13: clearClipboard
void Clipboard::clearClipboard()
{
QClipboard* clipboard = QApplication::clipboard();
if (!clipboard) {
qWarning("Unable to access the clipboard.");
return;
}
if (clipboard->text(QClipboard::Clipboard) == m_lastCopied) {
clipboard->clear(QClipboard::Clipboard);
}
if (clipboard->supportsSelection()
&& (clipboard->text(QClipboard::Selection) == m_lastCopied)) {
clipboard->clear(QClipboard::Selection);
}
m_lastCopied.clear();
}
示例14: QAbstractScrollArea
// The ctor.
QsciScintillaBase::QsciScintillaBase(QWidget *parent)
: QAbstractScrollArea(parent)
{
connect(verticalScrollBar(), SIGNAL(valueChanged(int)),
SLOT(handleVSb(int)));
connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
SLOT(handleHSb(int)));
setAcceptDrops(true);
setFocusPolicy(Qt::WheelFocus);
setAttribute(Qt::WA_KeyCompression);
viewport()->setBackgroundRole(QPalette::Base);
viewport()->setMouseTracking(true);
viewport()->setAttribute(Qt::WA_NoSystemBackground);
triple_click.setSingleShot(true);
sci = new ScintillaQt(this);
curseurs = new QMap<int, Curseur*>;
lockedLines = new QList<int>;
SendScintilla(SCI_SETCARETPERIOD, QApplication::cursorFlashTime() / 2);
// Make sure the lexers are linked in.
if (!lexersLinked)
{
Scintilla_LinkLexers();
lexersLinked = true;
}
QClipboard *cb = QApplication::clipboard();
if (cb->supportsSelection())
connect(cb, SIGNAL(selectionChanged()), SLOT(handleSelection()));
// Add it to the pool.
poolList.append(this);
}
示例15:
void db_base::pem2clipboard()
{
long l;
const char *p;
QString msg;
QClipboard *cb = QApplication::clipboard();
BIO *bio = BIO_new(BIO_s_mem());
if (!currentIdx.isValid())
return;
pki_base *pki = static_cast<pki_base*>(currentIdx.internalPointer());
pki->pem(bio);
openssl_error();
l = BIO_get_mem_data(bio, &p);
msg = QString::fromUtf8(p, l);
BIO_free(bio);
if (cb->supportsSelection())
cb->setText(msg, QClipboard::Selection);
else
cb->setText(msg);
}