本文整理汇总了C++中QCursor::shape方法的典型用法代码示例。如果您正苦于以下问题:C++ QCursor::shape方法的具体用法?C++ QCursor::shape怎么用?C++ QCursor::shape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCursor
的用法示例。
在下文中一共展示了QCursor::shape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
SetWaitCursor::~SetWaitCursor()
{
if (m_guiApp) {
RG_DEBUG << "SetWaitCursor::SetWaitCursor() : restoring normal cursor\n";
QWidget* viewport = 0;
QCursor currentCompositionViewCursor;
if ((m_guiApp->getView() &&
m_guiApp->getView()->getTrackEditor() &&
m_guiApp->getView()->getTrackEditor()->getCompositionView() &&
m_guiApp->getView()->getTrackEditor()->getCompositionView()->viewport())) {
viewport = m_guiApp->getView()->getTrackEditor()->getCompositionView()->viewport();
currentCompositionViewCursor = viewport->cursor();
}
m_guiApp->setCursor(m_saveCursor);
if (viewport) {
if (currentCompositionViewCursor.shape() == Qt::WaitCursor) {
viewport->setCursor(m_saveCompositionViewCursor);
} else {
viewport->setCursor(currentCompositionViewCursor); // because m_guiApp->setCursor() has replaced it
}
}
// otherwise, it's been modified elsewhere, so leave it as is
}
}
示例2: onStateChanged
void MainDialog::onStateChanged(int state, short disconnectStatus)
{
QColor clr = BTN_RED;
if( state == CloseWaitState || state == ProgressState ) {
QCursor* ovrCur = QApplication::overrideCursor();
if( ovrCur == NULL || ovrCur->shape() != Qt::WaitCursor )
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
clr = BTN_YELLOW;
}
if( state == EstablishState ) {
QApplication::restoreOverrideCursor();
startButton_->setEnabled( false );
stopButton_->setEnabled( true );
clr = BTN_GREEN;
}
else {
QApplication::restoreOverrideCursor();
startButton_->setEnabled(true);
stopButton_->setEnabled(false);
}
QPalette pal;
pal.setColor(QPalette::Button, clr);
colorButton_->setPalette(pal);
}
示例3: updateCursor
void QDragManager::updateCursor()
{
#ifndef QT_NO_CURSOR
if (willDrop) {
if (qt_qws_dnd_deco)
qt_qws_dnd_deco->show();
if (currentActionForOverrideCursor != global_accepted_action) {
QApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0));
currentActionForOverrideCursor = global_accepted_action;
}
} else {
QCursor *overrideCursor = QApplication::overrideCursor();
if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) {
QApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor));
currentActionForOverrideCursor = Qt::IgnoreAction;
}
#ifndef EMSCRIPTEN
// Hiding the pixmap feels weird, and doesn't match the desktop behaving;
// so I've disabled it for Emscripten.
if (qt_qws_dnd_deco)
qt_qws_dnd_deco->hide();
#endif
}
#endif
}
示例4: hideMouseCursor
void GenericCodeEditor::hideMouseCursor()
{
#ifdef Q_OS_MAC
return; // LATER: for some reason this crashes on osx. we should try to figure out why
#endif
QCursor * overrideCursor = QApplication::overrideCursor();
if (!overrideCursor || overrideCursor->shape() != Qt::BlankCursor)
QApplication::setOverrideCursor( Qt::BlankCursor );
}
示例5: cursorToValue
int QtCursorDatabase::cursorToValue(const QCursor &cursor) const
{
#ifndef QT_NO_CURSOR
Qt::CursorShape shape = cursor.shape();
if (m_cursorShapeToValue.contains(shape))
return m_cursorShapeToValue[shape];
#endif
return -1;
}
示例6: event
bool LLWebView::event(QEvent* event)
{
if (window && event->type() == QEvent::CursorChange) {
QCursor cursor = this->cursor();
if (currentShape != cursor.shape()) {
currentShape = cursor.shape();
LLQtWebKit::ECursor llcursor;
switch(currentShape)
{
case Qt::ArrowCursor:
llcursor = LLQtWebKit::C_ARROW;
break;
case Qt::PointingHandCursor:
llcursor = LLQtWebKit::C_POINTINGHAND;
break;
case Qt::IBeamCursor:
llcursor = LLQtWebKit::C_IBEAM;
break;
case Qt::SplitVCursor:
llcursor = LLQtWebKit::C_SPLITV;
break;
case Qt::SplitHCursor:
llcursor = LLQtWebKit::C_SPLITH;
break;
default:
qWarning() << "Unhandled cursor shape:" << currentShape;
llcursor = LLQtWebKit::C_ARROW;
}
LLEmbeddedBrowserWindowEvent event(window->getWindowId());
event.setEventUri(window->getCurrentUri());
event.setIntValue((int)llcursor);
window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onCursorChanged, event);
}
return true;
}
return QGraphicsWebView::event(event);
}
示例7: shape
QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c)
: shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0)
{
if (shape == Qt::BitmapCursor) {
const qint64 pixmapCacheKey = c.pixmap().cacheKey();
if (pixmapCacheKey) {
bitmapCacheKey = pixmapCacheKey;
} else {
Q_ASSERT(c.bitmap());
Q_ASSERT(c.mask());
bitmapCacheKey = c.bitmap()->cacheKey();
maskCacheKey = c.mask()->cacheKey();
}
}
}
示例8: qt_symbian_setWindowGroupCursor
/*
* Makes the specified cursor appear above a specific native window group
* Called from QSymbianControl and QApplication::restoreOverrideCursor
*
* Window server is needed for this, so there is no equivalent when using
* the sprite workaround.
*/
void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node)
{
Qt::HANDLE handle = cursor.handle();
if (handle) {
RWsPointerCursor *pcurs = reinterpret_cast<RWsPointerCursor *> (handle);
node.SetCustomPointerCursor(*pcurs);
} else
#ifdef Q_SYMBIAN_HAS_SYSTEM_CURSORS
{
TInt shape = qt_symbian_translate_cursor_shape(cursor.shape());
node.SetPointerCursor(shape);
}
#else
qWarning("qt_s60_setWindowGroupCursor - null handle");
#endif
}
示例9: scaledToScreen
// static
QCursor MapEditorTool::scaledToScreen(const QCursor& unscaled_cursor)
{
auto scale = Settings::getInstance().getSetting(Settings::General_PixelsPerInch).toReal() / 96.0;
if (unscaled_cursor.shape() == Qt::BitmapCursor
&& scale > 1.5)
{
// Need to scale our low res image for high DPI screen
const auto unscaled_pixmap = unscaled_cursor.pixmap();
const auto scaled_hotspot = QPointF{ unscaled_cursor.hotSpot() } * scale;
return QCursor{ unscaled_pixmap.scaledToWidth(unscaled_pixmap.width() * scale, Qt::SmoothTransformation),
qRound(scaled_hotspot.x()), qRound(scaled_hotspot.y()) };
}
else
{
return unscaled_cursor;
}
}
示例10: StartEdit
bool EditPickPointsPlugin::StartEdit(MeshModel &mm, GLArea *gla )
{
//qDebug() << "StartEdit Pick Points: " << mm.fileName.c_str() << " ..." << mm.cm.fn;
//if there are no faces then we cant do anything with this plugin
if(mm.cm.fn < 1)
{
if(NULL != pickPointsDialog)
{
pickPointsDialog->hide();
}
//show message
QMessageBox::warning(gla->window(), "Edit Pick Points",
"Sorry, this mesh has no faces on which picked points can sit.",
QMessageBox::Ok, QMessageBox::Ok);
return false;
}
//get the cursor
QCursor *cursor = QApplication::overrideCursor();
if(cursor) overrideCursorShape = cursor->shape();
else overrideCursorShape = Qt::ArrowCursor;
//set this so redraw can use it
glArea = gla;
//Create GUI window if we dont already have one
if(pickPointsDialog == 0)
{
pickPointsDialog = new PickPointsDialog(this, gla->window());
}
currentModel = &mm;
//set the current mesh
pickPointsDialog->setCurrentMeshModel(&mm, gla);
//show the dialog
pickPointsDialog->show();
return true;
}
示例11: updateCursor
void QDragManager::updateCursor()
{
#ifndef QT_NO_CURSOR
if (willDrop) {
if (qt_qws_dnd_deco)
qt_qws_dnd_deco->show();
if (currentActionForOverrideCursor != global_accepted_action) {
QApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0));
currentActionForOverrideCursor = global_accepted_action;
}
} else {
QCursor *overrideCursor = QApplication::overrideCursor();
if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) {
QApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor));
currentActionForOverrideCursor = Qt::IgnoreAction;
}
if (qt_qws_dnd_deco)
qt_qws_dnd_deco->hide();
}
#endif
}
示例12: onStateChanged
void MainDialog::onStateChanged(quint8 state, const QString& reason)
{
QColor clr = BTN_RED;
if( state == EngineClosingState || state == ProgressState ) {
QCursor* ovrCur = QApplication::overrideCursor();
if( ovrCur == NULL || ovrCur->shape() != Qt::WaitCursor )
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
clr = BTN_YELLOW;
}
if( state == EstablishState || state == EstablishWarnState ) {
QApplication::restoreOverrideCursor();
startButton_->setEnabled( false );
stopButton_->setEnabled( true );
clr = BTN_GREEN;
}
else {
QApplication::restoreOverrideCursor();
startButton_->setEnabled(true);
stopButton_->setEnabled(false);
}
QPalette pal;
pal.setColor(QPalette::Button, clr);
colorButton_->setPalette(pal);
if( state == ProgressState )
statusBar_->connecting(netman_->model()->value(ServerParam));
else if( state == ReconnectingState )
statusBar_->reconnecting();
else if( state == EstablishState || state == EstablishWarnState )
statusBar_->established(reason);
else if( state == ForcedClosingState)
statusBar_->loggedOut(reason);
else if( state == ClosedFailureState || state == ClosedRemoteState ) {
statusBar_->disconnected(reason);
netman_->reconnect();
}
}
示例13: updateCursor
void QBasicDrag::updateCursor(Qt::DropAction action)
{
#ifndef QT_NO_CURSOR
Qt::CursorShape cursorShape = Qt::ForbiddenCursor;
if (canDrop()) {
switch (action) {
case Qt::CopyAction:
cursorShape = Qt::DragCopyCursor;
break;
case Qt::LinkAction:
cursorShape = Qt::DragLinkCursor;
break;
default:
cursorShape = Qt::DragMoveCursor;
break;
}
}
QCursor *cursor = QGuiApplication::overrideCursor();
QPixmap pixmap = m_drag->dragCursor(action);
if (!cursor) {
QGuiApplication::changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
} else {
if (!pixmap.isNull()) {
if ((cursor->pixmap().cacheKey() != pixmap.cacheKey())) {
QGuiApplication::changeOverrideCursor(QCursor(pixmap));
}
} else {
if (cursorShape != cursor->shape()) {
QGuiApplication::changeOverrideCursor(QCursor(cursorShape));
}
}
}
#endif
updateAction(action);
}
示例14: mouseMoveEvent
//.........这里部分代码省略.........
Indent -= (MouseX - m->x()) / Scaling;
if (Indent < 0)
Indent = 0;
if (Indent > ColWidth-1)
Indent = ColWidth-1;
First = oldInd - Indent;
emit MarkerMoved(textBase(), Indent);
repaint();
break;
case rc_rightMargin:
RMargin -= (MouseX - m->x()) / Scaling;
if (RMargin < 0)
RMargin = 0;
if (RMargin > ColWidth-1)
RMargin = ColWidth-1;
emit MarkerMoved(textBase(), RMargin);
repaint();
break;
case rc_tab:
TabValues[ActTab].tabPosition -= (MouseX - m->x()) / Scaling;
if (TabValues[ActTab].tabPosition < 0)
TabValues[ActTab].tabPosition = 0;
if (TabValues[ActTab].tabPosition > ColWidth-1)
TabValues[ActTab].tabPosition = ColWidth-1;
emit MarkerMoved(textBase(), TabValues[ActTab].tabPosition);
UpdateTabList();
repaint();
break;
default:
break;
}
MouseX = m->x();
/* if (RulerCode != rc_none)
{
QPoint py = currView->viewport()->mapFromGlobal(m->globalPos());
QPainter p;
p.begin(currView->viewport());
p.setCompositionMode(QPainter::CompositionMode_Xor);
p.setPen(QPen(Qt::white, 1, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
QPoint out = currView->contentsToViewport(QPoint(0, qRound(currDoc->currentPage()->yOffset() * Scaling)));
p.drawLine(Markp, out.y(), Markp, out.y()+qRound(currDoc->currentPage()->height() * Scaling));
p.drawLine(py.x(), out.y(), py.x(), out.y()+qRound(currDoc->currentPage()->height() * Scaling));
p.end();
Markp = py.x();
}*/
return;
}
if ((!Mpressed) && (m->y() < height()) && (m->y() > 0) && (m->x() > ColStart - 2*currDoc->guidesSettings.grabRad) && (m->x() < ColEnd + 2*currDoc->guidesSettings.grabRad))
{
qApp->changeOverrideCursor(QCursor(loadIcon("tab.png"), 3));
switch(findRulerHandle(m->pos(), currDoc->guidesSettings.grabRad))
{
case rc_leftFrameDist:
qApp->changeOverrideCursor(QCursor(Qt::SplitHCursor));
break;
case rc_rightFrameDist:
qApp->changeOverrideCursor(QCursor(Qt::SplitHCursor));
break;
case rc_indentFirst:
qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor));
break;
case rc_leftMargin:
qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor));
break;
case rc_rightMargin:
qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor));
break;
case rc_tab:
qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor));
break;
}
Draw(m->x());
double marker = localToTextPos(m->x());
emit MarkerMoved(textBase(), marker);
return;
}
if ((Mpressed) && (RulerCode == rc_tab) && ((m->y() > height()) || (m->y() < 0)))
{
qApp->changeOverrideCursor(QCursor(loadIcon("DelPoint.png"), 1, 1));
return;
}
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
else
{
if (Mpressed)
{
rulerGesture->mouseMoveEvent(m);
}
else
{
QCursor* cursor = qApp->overrideCursor();
Qt::CursorShape shape = cursor ? cursor->shape() : Qt::ArrowCursor;
if ((shape == Qt::SplitHCursor) || (shape == Qt::SplitVCursor))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
}
}
示例15: process
//.........这里部分代码省略.........
for(uint i= 1; i < st.count(); i++)t+='/'+st.at(i);
att2->setText(1,t);
}
else if(val.type() == QVariant::String)att2->setText(1,'"'+val.toString()+'"');
else if(val.type() == QVariant::CString)att2->setText(1,'"'+val.toCString()+'"');
else if(val.type() == QVariant::Bool){
if(val.toBool())att2->setText(1,"True");
else att2->setText(1,"False");
}
else if(val.type() == QVariant::Int)att2->setText(1,QString::number(val.toInt()));
else if(val.type() == QVariant::UInt)att2->setText(1,QString::number(val.toUInt()));
else if(val.type() == QVariant::Double)att2->setText(1,QString::number(val.toDouble()));
else if(val.type() == QVariant::Rect){
const QRect r = val.toRect();
att2->setText(1,'[' + QString::number(r.left()) + ',' + QString::number(r.top())+
',' + QString::number(r.right()) + ',' + QString::number(r.bottom())+']');
}
else if(val.type() == QVariant::Region){
const QRegion reg = val.toRegion();
QRect r = reg.boundingRect();
att2->setText(1,'[' + QString::number(r.left()) + ',' + QString::number(r.top())+
',' + QString::number(r.right()) + ',' + QString::number(r.bottom())+"],");
}
else if(val.type() == QVariant::Size){
const QSize s = val.toSize();
att2->setText(1,'[' + QString::number(s.width()) + ',' + QString::number(s.height())+']');
}
else if(val.type() == QVariant::Point){
const QPoint p = val.toPoint();
att2->setText(1,'[' + QString::number(p.x()) + ',' + QString::number(p.y())+']');
}
else if(val.type() == QVariant::Color){
const QColor c = val.toColor();
att2->setText(1,'[' + QString::number(c.red()) + ',' +
QString::number(c.green()) + ',' +
QString::number(c.blue()) + ']');
}
else if(val.type() == QVariant::ColorGroup){
const QColorGroup cg = val.toColorGroup();
QColor c = cg.base();
att2->setText(1,'[' + QString::number(c.red()) + ',' +
QString::number(c.green()) + ',' +
QString::number(c.blue()) + "], ...");
}
else if(val.type() == QVariant::Font){
const QFont f = val.toFont();
QString text = '\'' + f.family() + "', " + QString::number(f.pointSize())
+ ", " + QString::number(f.weight());
if(f.italic())text+=", italic";
att2->setText(1,text);
}
else if(val.type() == QVariant::SizePolicy){
QSizePolicy sp = val.toSizePolicy();
QString text;
if(sp.horData() == QSizePolicy::Fixed)text+="Fixed";
else if(sp.horData() == QSizePolicy::Minimum )text+="Minimum";
else if(sp.horData() == QSizePolicy::Maximum )text+="Maximum";
else if(sp.horData() == QSizePolicy::Preferred )text+="Preferred";
else if(sp.horData() == QSizePolicy::MinimumExpanding )text+="MinimumExpanding";
else if(sp.horData() == QSizePolicy::Expanding )text+="Expanding";
text +='/';
if(sp.verData() == QSizePolicy::Fixed)text+="Fixed";
else if(sp.verData() == QSizePolicy::Minimum )text+="Minimum";
else if(sp.verData() == QSizePolicy::Maximum )text+="Maximum";
else if(sp.verData() == QSizePolicy::Preferred )text+="Preferred";
else if(sp.verData() == QSizePolicy::MinimumExpanding )text+="MinimumExpanding";
else if(sp.verData() == QSizePolicy::Expanding )text+="Expanding";
att2->setText(1,text);
}
else if(val.type() == QVariant::Pixmap){
QPixmap pix = val.toPixmap();
if(!pix.isNull())att2->setPixmap(1,pix);
}
else if(val.type() == QVariant::Cursor){
const QCursor cur = val.toCursor();
const QBitmap * pix = cur.bitmap();
if(pix && !pix->isNull())att2->setPixmap(1,*pix);
else att2->setText(1,QString::number(cur.shape()));
}
}
}
}
const QObjectList * roots = obj->children();
if(roots != NULL){
__current = new QListViewItem(__current,att,"children","ptr="+QString::number((unsigned long)roots),
"List<QObject>["+QString::number(roots->count())+"]");
__current->setPixmap(0,__pixappe);
QObjectList r(*roots);
uint size = r.count();
for(uint i = 0; i < size; i++ ){
QObject * _obj = r.at(i);
process(_obj);
}
}
__current = buf;
}
}