本文整理汇总了C++中QPoint::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QPoint::isNull方法的具体用法?C++ QPoint::isNull怎么用?C++ QPoint::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPoint
的用法示例。
在下文中一共展示了QPoint::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wheelEvent
void CanvasQt::wheelEvent(QWheelEvent* e){
MouseEvent::MouseWheelOrientation orientation;
if (e->orientation() == Qt::Horizontal) {
orientation = MouseEvent::MOUSE_WHEEL_HORIZONTAL;
} else {
orientation = MouseEvent::MOUSE_WHEEL_VERTICAL;
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QPoint numPixels = e->pixelDelta();
QPoint numDegrees = e->angleDelta() / 8 / 15;
#else
QPoint numPixels;
QPoint numDegrees = QPoint(0, e->delta() / 8 / 15);
#endif
int numSteps = 0;
if (!numPixels.isNull()) {
numSteps = (orientation==MouseEvent::MOUSE_WHEEL_HORIZONTAL? numPixels.x() : numPixels.y()) / 5;
} else if (!numDegrees.isNull()) {
numSteps = (orientation==MouseEvent::MOUSE_WHEEL_HORIZONTAL? numDegrees.x() : numDegrees.y());
}
ivec2 screenPos(e->pos().x(), e->pos().y());
ivec2 screenPosInvY(screenPos.x, static_cast<int>(getScreenDimensions().y) - 1 - screenPos.y);
MouseEvent mouseEvent(screenPos, numSteps,
EventConverterQt::getMouseWheelButton(e), MouseEvent::MOUSE_STATE_WHEEL, orientation,
EventConverterQt::getModifier(e), getScreenDimensions(),
getDepthValueAtCoord(screenPosInvY));
e->accept();
Canvas::mouseWheelEvent(&mouseEvent);
}
示例2: wheelEvent
void TimeLine::wheelEvent(QWheelEvent* event)
{
QPoint numPixels = event->pixelDelta();
QPoint numDegrees = event->angleDelta() / 8;
int isForward =0;
if (!numPixels.isNull()) {
if (numPixels.ry()>0)
isForward =1;
else if (numPixels.ry()<0)
isForward =-1;
}
else if (!numDegrees.isNull()) {
if (numDegrees.ry()>0)
isForward =1;
else if (numDegrees.ry()<0)
isForward =-1;
}
if (isForward >0)
mVScrollbar->triggerAction(QAbstractSlider::SliderSingleStepAdd);
else if (isForward <0)
mVScrollbar->triggerAction(QAbstractSlider::SliderSingleStepSub);
else
{
//Do nothing we've had a wheel event where we are neither going forward or backward
//which should never happen?
}
event->accept();
}
示例3: OnTreeViewContextMenu
void MainWin::OnTreeViewContextMenu(const QPoint &point)
{
if (point.isNull())
return;
QStandardItem *item = connections->itemFromIndex(
ui.serversTreeView->indexAt(point)
);
QPoint currentPoint = QCursor::pos();
if (!item || currentPoint.isNull() || treeViewUILocked)
return;
int type = item->type();
if (type == RedisServerItem::TYPE) {
if (((RedisServerItem*)item)->isLocked()) {
QMessageBox::warning(ui.serversTreeView, "Warning", "Performing operations. Please Keep patience.");
return;
}
QAction * action = serverMenu->exec(currentPoint);
if (action == nullptr)
return;
if (action->text() == "Reload")
treeViewUILocked = true;
} else if (type == RedisKeyItem::TYPE) {
keyMenu->exec(currentPoint);
}
}
示例4: wheelEvent
void MapWidget::wheelEvent(QWheelEvent* event)
{
QPoint numPixels = event->pixelDelta();
QPoint numDegrees = event->angleDelta() / 8;
int steps = 0;
if (!numPixels.isNull()) {
steps = numPixels.y()>0 ? numPixels.manhattanLength() : -numPixels.manhattanLength();
} else if (!numDegrees.isNull()) {
QPoint numSteps = numDegrees / 15;
steps = numSteps.y()>0 ? numSteps.manhattanLength() : -numSteps.manhattanLength();
}
if(steps==0){
return;
}
if (steps>=0) {
zoomIn(std::max(1.01,0.2*steps));
}
else {
zoomOut(std::max(1.01,0.2*steps));
}
event->accept();
}
示例5: wheelEvent
void QQuickWheelArea::wheelEvent(QWheelEvent *we)
{
if (we->phase() == Qt::ScrollBegin)
setActive(true);
else if (we->phase() == Qt::ScrollEnd)
setActive(false);
QPoint numPixels = we->pixelDelta();
QPoint numDegrees = we->angleDelta() / 8;
if (!numPixels.isNull()) {
setHorizontalDelta(numPixels.x() * pixelDeltaAdjustment);
setVerticalDelta(numPixels.y() * pixelDeltaAdjustment);
} else if (!numDegrees.isNull()) {
setHorizontalDelta(numDegrees.x() / 15.0 * m_scrollSpeed);
setVerticalDelta(numDegrees.y() / 15.0 * m_scrollSpeed);
}
// This allows other parent WheelArea's to handle scrolling
// For example this allows for ScrollView inside of another ScrollView to work correctly
// Once this scrollbar can't scroll anymore, ie it reaches the limits,
// it will ignore the scroll event so the parent WheelArea can start scrolling
if ((numPixels.x() != 0 || numDegrees.x() != 0) &&
m_horizontalMinimumValue <= m_horizontalMaximumValue &&
(isAtXBeginning() || isAtXEnd())) {
we->ignore();
} else if ((numPixels.y() != 0 || numDegrees.y() != 0) &&
m_verticalMinimumValue <= m_verticalMaximumValue &&
(isAtYBeginning() || isAtYEnd())) {
we->ignore();
} else {
we->accept();
}
}
示例6: wheelEvent
void ExampleView::wheelEvent(QWheelEvent* event)
{
QPoint pixelsScrolled = event->pixelDelta();
QPoint stepsScrolled = event->angleDelta();
int dx = 0, dy = 0;
if (!pixelsScrolled.isNull()) {
dx = pixelsScrolled.x();
dy = pixelsScrolled.y();
}
else if (!stepsScrolled.isNull()) {
dx = static_cast<qreal>(stepsScrolled.x()) * qMax(2, width() / 10) / 120;
dy = static_cast<qreal>(stepsScrolled.y()) * qMax(2, height() / 10) / 120;
}
if (dx == 0) {
if (dy == 0)
return;
else
dx = dy;
}
constraintCanvas(&dx);
_matrix.setMatrix(_matrix.m11(), _matrix.m12(), _matrix.m13(), _matrix.m21(),
_matrix.m22(), _matrix.m23(), _matrix.dx()+dx, _matrix.dy(), _matrix.m33());
imatrix = _matrix.inverted();
scroll(dx, 0);
}
示例7: showEvent
void XMainWindow::showEvent(QShowEvent *event)
{
if(!_private->_shown)
{
_private->_shown = true;
//qDebug("isModal() %s", isModal()?"true":"false");
QRect availableGeometry = QApplication::desktop()->availableGeometry();
if(!omfgThis->showTopLevel() && !isModal())
availableGeometry = omfgThis->workspace()->geometry();
QString objName = objectName();
QPoint pos = xtsettingsValue(objName + "/geometry/pos").toPoint();
QSize lsize = xtsettingsValue(objName + "/geometry/size").toSize();
if(lsize.isValid() && xtsettingsValue(objName + "/geometry/rememberSize", true).toBool() && (metaObject()->className() != QString("xTupleDesigner")))
resize(lsize);
setAttribute(Qt::WA_DeleteOnClose);
if(omfgThis->showTopLevel() || isModal())
{
omfgThis->_windowList.append(this);
statusBar()->show();
QRect r(pos, size());
if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool())
move(pos);
}
else
{
QWidget * fw = focusWidget();
omfgThis->workspace()->addWindow(this);
QRect r(pos, size());
if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool())
move(pos);
// This originally had to be after the show? Will it work here?
if(fw)
fw->setFocus();
}
_private->loadScriptEngine();
QList<XCheckBox*> allxcb = findChildren<XCheckBox*>();
for (int i = 0; i < allxcb.size(); ++i)
allxcb.at(i)->init();
shortcuts::setStandardKeys(this);
}
bool blocked = _private->_action->blockSignals(true);
_private->_action->setChecked(true);
_private->_action->blockSignals(blocked);
_private->callShowEvent(event);
QMainWindow::showEvent(event);
}
示例8: wheelEvent
void DisplayBoard::wheelEvent(QWheelEvent *event) {
QPoint numPixels = event->pixelDelta();
QPoint numDegrees = event->angleDelta() / 8;
if (!numDegrees.isNull()) {
zoom *= pow(2, numDegrees.y() / 90.0);
}
else if (!numPixels.isNull()) {
zoom *= pow(2, numPixels.y() / 100.0);
}
update();
event->accept();
}
示例9: wheelEvent
void LinkDialogGraphicsView::wheelEvent(QWheelEvent* e) {
QPoint numPixels = e->pixelDelta();
QPoint numDegrees = e->angleDelta() / 8 / 15;
if (!numPixels.isNull()) {
scene_->wheelAction(static_cast<float>(numPixels.y()) / 50.f);
} else if (!numDegrees.isNull()) {
scene_->wheelAction(static_cast<float>(numDegrees.y()) / 10.f);
}
e->accept();
}
示例10: eventFilter
bool PopupItem::eventFilter( QObject *object, QEvent *e )
{
MarbleWidget *widget = dynamic_cast<MarbleWidget*> ( object );
if ( !widget ) {
return BillboardGraphicsItem::eventFilter( object, e );
}
if ( e->type() == QEvent::MouseButtonDblClick
|| e->type() == QEvent::MouseMove
|| e->type() == QEvent::MouseButtonPress
|| e->type() == QEvent::MouseButtonRelease )
{
// Mouse events are forwarded to the underlying widget
QMouseEvent *event = static_cast<QMouseEvent*> ( e );
QPoint const shiftedPos = transform( event->pos() );
bool const forcedMouseRelease = m_needMouseRelease && e->type() == QEvent::MouseButtonRelease;
if ( !shiftedPos.isNull() || forcedMouseRelease ) {
if ( !m_needMouseRelease && e->type() == QEvent::MouseButtonPress ) {
m_needMouseRelease = true;
} else if ( forcedMouseRelease ) {
m_needMouseRelease = false;
}
widget->setCursor( Qt::ArrowCursor );
// transform to children's coordinates
QMouseEvent shiftedEvent = QMouseEvent( e->type(), shiftedPos,
event->globalPos(), event->button(), event->buttons(),
event->modifiers() );
if ( QApplication::sendEvent( m_webView, &shiftedEvent ) ) {
widget->setCursor( m_webView->cursor() );
emit dirty();
return true;
}
}
} else if ( e->type() == QEvent::Wheel ) {
// Wheel events are forwarded to the underlying widget
QWheelEvent *event = static_cast<QWheelEvent*> ( e );
QPoint const shiftedPos = transform( event->pos() );
if ( !shiftedPos.isNull() ) {
widget->setCursor( Qt::ArrowCursor );
QWheelEvent shiftedEvent = QWheelEvent( shiftedPos,
event->globalPos(), event->delta(), event->buttons(),
event->modifiers() );
if ( QApplication::sendEvent( m_webView, &shiftedEvent ) ) {
widget->setCursor( m_webView->cursor() );
emit dirty();
return true;
}
}
}
return BillboardGraphicsItem::eventFilter( object, e );
}
示例11: wheelEvent
/**
* Override to support zooming in and out using the mouse wheel.
*/
void MapView::wheelEvent(QWheelEvent *event)
{
auto *hBar = static_cast<FlexibleScrollBar*>(horizontalScrollBar());
auto *vBar = static_cast<FlexibleScrollBar*>(verticalScrollBar());
if (event->modifiers() & Qt::ControlModifier
&& event->orientation() == Qt::Vertical)
{
// No automatic anchoring since we'll do it manually
setTransformationAnchor(QGraphicsView::NoAnchor);
// This works around problems with automatic alignment of scenes that
// are smaller than the view, which seems to be impossible to disable.
hBar->allowNextRangeChange();
vBar->allowNextRangeChange();
mZoomable->handleWheelDelta(event->delta());
adjustCenterFromMousePosition(mLastMousePos);
// Restore the centering anchor
setTransformationAnchor(QGraphicsView::AnchorViewCenter);
return;
}
// By default, the scroll area forwards the wheel events to the scroll
// bars, which apply their bounds. This custom wheel handling is here to
// override the bounds checking.
//
// This also disables QGraphicsSceneWheelEvent, but Tiled does not rely
// on that event.
QPoint pixels = event->pixelDelta();
if (pixels.isNull()) {
QPointF steps = event->angleDelta() / 8.0 / 15.0;
int lines = QApplication::wheelScrollLines();
pixels.setX(int(steps.x() * lines * hBar->singleStep()));
pixels.setY(int(steps.y() * lines * vBar->singleStep()));
}
if (!pixels.isNull()) {
int horizontalValue = hBar->value() + (isRightToLeft() ? pixels.x() : -pixels.x());
int verticalValue = vBar->value() - pixels.y();
hBar->forceSetValue(horizontalValue);
vBar->forceSetValue(verticalValue);
// When scrolling the mouse does not move, but the view below it does.
// This affects the mouse scene position, which needs to be updated.
mLastMouseScenePos = mapToScene(viewport()->mapFromGlobal(mLastMousePos));
}
}
示例12: onLineColor
void CMindMapDtLineTool::onLineColor()
{
QPoint p;
QColor c;
QPen pen;
QList<CDiagramItem*> items;
if (!m_d || !m_p)
return;
items = m_d->getItemsHasFocus();
if (items.length() == 0)
return;
foreach (CDiagramItem *item, items)
{
if (dynamic_cast<CMindMapNode*>(item))
{
pen = item->pen();
break;
}
}
c = pen.color();
m_lineColors->setMode( CUiColorPanel::SolidFill );
m_lineColors->setSelectedColor(c);
p = Utils::getPopupPoint(m_d, m_p, ui->m_btnLineColor, m_lineColors);
if (!p.isNull())
{
m_lineColors->raise();
m_lineColors->show();
m_lineColors->move( p );
}
}
示例13: settings
/*
A dialog for getting/setting general info about a Make Controller
*/
Inspector::Inspector(MainWindow *mainWindow) : QDialog( 0 )
{
this->mainWindow = mainWindow;
setupUi(this);
connect(this, SIGNAL(finished(int)), this, SLOT(onFinished()));
connect(&infoTimer, SIGNAL(timeout()), this, SLOT(getBoardInfo()));
connect(applyButton, SIGNAL(clicked()), this, SLOT(onApply()));
connect(revertButton, SIGNAL(clicked()), this, SLOT(onRevert()));
connect(nameEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(serialEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(versionEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(freememEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(ipEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(netmaskEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(gatewayEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(listenPortEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(sendPortEdit, SIGNAL(textEdited(QString)), this, SLOT(onAnyValueEdited()));
connect(dhcpBox, SIGNAL(clicked(bool)), this, SLOT(onAnyValueEdited()));
QSettings settings("MakingThings", "mchelper");
QPoint inspectorPos = settings.value("inspector_pos").toPoint();
if(!inspectorPos.isNull())
move(inspectorPos);
resize(gridLayout->sizeHint());
}
示例14: setOption
bool EnlargeShrink::setOption(const QString &option, const QVariant &value)
{
bool ok = false;
if (option == QuillImageFilter::Radius) {
double radius = value.toDouble(&ok);
if (ok) {
m_Radius = radius;
}
} else if (option == QuillImageFilter::Center) {
QPoint center = value.toPoint();
if (!center.isNull()) {
m_Center = center;
ok = true;
}
} else if (option == FORCE_OPTION) {
double force = value.toDouble(&ok);
ok = ok && force <= 1.0 && force >= -1.0;
if (ok) {
// Divide by the FORCE_FACTOR to get appropiated values for
// the Amplitude used by the "distort" function
m_Force = force/FORCE_FACTOR;
}
}
return ok;
}
示例15: wheelEvent
void LinkDialogGraphicsView::wheelEvent(QWheelEvent* e) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QPoint numPixels = e->pixelDelta();
QPoint numDegrees = e->angleDelta() / 8 / 15;
#else
QPoint numPixels;
QPoint numDegrees = QPoint(0, e->delta() / 8 / 15);
#endif
if (!numPixels.isNull()) {
scene_->wheelAction(static_cast<float>(numPixels.y()) / 50.0);
} else if (!numDegrees.isNull()) {
scene_->wheelAction(static_cast<float>(numDegrees.y()) / 10.0);
}
e->accept();
}