本文整理汇总了C++中PlotSettings::adjust方法的典型用法代码示例。如果您正苦于以下问题:C++ PlotSettings::adjust方法的具体用法?C++ PlotSettings::adjust怎么用?C++ PlotSettings::adjust使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlotSettings
的用法示例。
在下文中一共展示了PlotSettings::adjust方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseReleaseEvent
void plotter::mouseReleaseEvent(QMouseEvent *event)
{
if ((event->button() == Qt::LeftButton) && rubberBandIsShown) {
rubberBandIsShown = false;
updateRubberBandRegion();
unsetCursor();
QRect rect = rubberBandRect.normalized();
if (rect.width() < 4 || rect.height() < 4)
return;
rect.translate(-Margin, -Margin);
PlotSettings prevSettings = zoomStack[curZoom];
PlotSettings settings;
double dx = prevSettings.spanX() / (width() - 2 * Margin);
double dy = prevSettings.spanY() / (height() - 2 * Margin);
settings.minX = prevSettings.minX + dx * rect.left();
settings.maxX = prevSettings.minX + dx * rect.right();
settings.minY = prevSettings.maxY - dy * rect.bottom();
settings.maxY = prevSettings.maxY - dy * rect.top();
settings.adjust();
zoomStack.resize(curZoom + 1);
zoomStack.append(settings);
zoomIn();
}
}
示例2: keyPressEvent
void Plotter::keyPressEvent(QKeyEvent *event)
{
switch(event->key())
{
case Qt::Key_Right:
if(rubberBandRect.x() < this->width()-(rubberBandRect.width()-10))
{
rubberBandRect.setLeft(rubberBandRect.x() + 10);
rubberBandRect.setWidth(rubberBandRect.width()+10);
updateRubberBandRegion();
}
break;
case Qt::Key_Left:
if(rubberBandRect.x() > 10){
rubberBandRect.setLeft(rubberBandRect.x() - 10);
rubberBandRect.setWidth(rubberBandRect.width()-10);
updateRubberBandRegion();
}
break;
case Qt::Key_Down:
if(rubberBandRect.y() < this->height()-rubberBandRect.height()){
rubberBandRect.setTop(rubberBandRect.y() + 10);
rubberBandRect.setHeight(rubberBandRect.height()+10);
updateRubberBandRegion();
}
break;
case Qt::Key_Up:
if(rubberBandRect.y() >0){
rubberBandRect.setTop(rubberBandRect.y() - 10);
rubberBandRect.setHeight(rubberBandRect.height()-10);
updateRubberBandRegion();
}
break;
default: QWidget::keyPressEvent(event);
}
QRect rect = rubberBandRect.normalized();
if(rect.width() < 4 || rect.height() < 4 )
{
return;
}
rect.translate(-Margin,-Margin);
PlotSettings prevSettings = zoomStack[curZoom];
PlotSettings settings;
settings.m_nOffset = prevSettings.m_nOffset;
double dx = prevSettings.spanX() / (width()-2*Margin);
double dy = prevSettings.spanY() / (height()-2*Margin);
settings.minX = prevSettings.minX + dx * rect.left();
settings.maxX = prevSettings.minX + dx * rect.right();
settings.minY = prevSettings.maxY - dy * rect.bottom();
settings.maxY = prevSettings.maxY - dy * rect.top();
settings.adjust();
PlotSettings *pTemp = new PlotSettings();
pTemp = &settings;
zoomStack.resize(curZoom + 1);
zoomStack.append(settings);
refreshPixmap();
emit moveWindow(rubberBandRect,settings);
}