本文整理汇总了C++中QSize::transpose方法的典型用法代码示例。如果您正苦于以下问题:C++ QSize::transpose方法的具体用法?C++ QSize::transpose怎么用?C++ QSize::transpose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSize
的用法示例。
在下文中一共展示了QSize::transpose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeMaxZoomHeight
int computeMaxZoomHeight(QSize scrollSize, QSize imageSize,
int scrollBarDimension) {
scrollSize.transpose();
imageSize.transpose();
return computeMaxZoomWidth(scrollSize, imageSize, scrollBarDimension);
}
示例2: privateSetOrientation
void SDeclarativeScreenPrivateResize::privateSetOrientation(int orientation)
{
if (orientation == SDeclarativeScreen::All
|| orientation == SDeclarativeScreen::LandscapeInverted
|| orientation == SDeclarativeScreen::PortraitInverted)
return;
if (m_allowedOrientations != SDeclarativeScreen::Default && !(m_allowedOrientations & orientation))
return;
QSize newScreenSize = m_displaySize;
if(orientation == SDeclarativeScreen::Default)
orientation = portraitDisplay() ? SDeclarativeScreen::Portrait : SDeclarativeScreen::Landscape;
if (orientation == SDeclarativeScreen::Portrait && !portraitDisplay())
newScreenSize.transpose();
else if (orientation == SDeclarativeScreen::Landscape && portraitDisplay())
newScreenSize.transpose();
if (m_view)
m_view->resize(newScreenSize);
else
setScreenSize(newScreenSize);
}
示例3: resizeEvent
//! [3]
void MainWindow::resizeEvent(QResizeEvent *event)
{
QSize size = event->size();
bool isLandscape = size.width() > size.height();
if (!isLandscape)
size.transpose();
landscapeWidget->setFixedSize(size);
size.transpose();
portraitWidget->setFixedSize(size);
landscapeWidget->setVisible(isLandscape);
portraitWidget->setVisible(!isLandscape);
}
示例4: sizeHint
QSize OrientationButton::sizeHint() const
{
QSize size = QPushButton::sizeHint();
if (orientation_ == Qt::Vertical)
size.transpose();
return size;
}
示例5: paintEvent
void RotationToolButton::paintEvent(QPaintEvent*)
{
QStylePainter painter(this);
painter.rotate(rot);
switch (rot)
{
case UpsideDown:
painter.translate(-width(), -height());
break;
case Clockwise:
painter.translate(0, -width());
break;
case CounterClockwise:
painter.translate(-height(), 0);
break;
default:
// nothing to do
break;
}
QStyleOptionToolButton opt;
initStyleOption(&opt);
if (rot & Vertical_Mask)
{
QSize size = opt.rect.size();
size.transpose();
opt.rect.setSize(size);
}
painter.drawComplexControl(QStyle::CC_ToolButton, opt);
}
示例6: setCell
void TileLayer::setCell(int x, int y, const Cell &cell)
{
Q_ASSERT(contains(x, y));
if (cell.tile) {
QSize size = cell.tile->size();
if (cell.flippedAntiDiagonally)
size.transpose();
const QPoint offset = cell.tile->tileset()->tileOffset();
mMaxTileSize = maxSize(size, mMaxTileSize);
mOffsetMargins = maxMargins(QMargins(-offset.x(),
-offset.y(),
offset.x(),
offset.y()),
mOffsetMargins);
if (mMap)
mMap->adjustDrawMargins(drawMargins());
}
mGrid[x + y * mWidth] = cell;
}
示例7: getStyleOption
QStyleOptionButton OrientationButton::getStyleOption() const
{
QStyleOptionButton opt;
opt.initFrom(this);
if (orientation_ == Qt::Vertical)
{
QSize size = opt.rect.size();
size.transpose();
opt.rect.setSize(size);
}
opt.features = QStyleOptionButton::None;
if (isFlat())
opt.features |= QStyleOptionButton::Flat;
if (menu())
opt.features |= QStyleOptionButton::HasMenu;
if (autoDefault() || isDefault())
opt.features |= QStyleOptionButton::AutoDefaultButton;
if (isDefault())
opt.features |= QStyleOptionButton::DefaultButton;
if (isDown() || (menu() && menu()->isVisible()))
opt.state |= QStyle::State_Sunken;
if (isChecked())
opt.state |= QStyle::State_On;
if (!isFlat() && !isDown())
opt.state |= QStyle::State_Raised;
opt.text = text();
opt.icon = icon();
opt.iconSize = iconSize();
return opt;
}
示例8: getStyleOption
QStyleOptionButton QxtPushButtonPrivate::getStyleOption() const
{
QStyleOptionButton option;
option.initFrom(&qxt_p());
if (rot & Vertical_Mask)
{
QSize size = option.rect.size();
size.transpose();
option.rect.setSize(size);
}
option.features = QStyleOptionButton::None;
if (qxt_p().isFlat())
option.features |= QStyleOptionButton::Flat;
if (qxt_p().menu())
option.features |= QStyleOptionButton::HasMenu;
if (qxt_p().autoDefault() || qxt_p().isDefault())
option.features |= QStyleOptionButton::AutoDefaultButton;
if (qxt_p().isDefault())
option.features |= QStyleOptionButton::DefaultButton;
if (qxt_p().isDown() || (qxt_p().menu() && qxt_p().menu()->isVisible()))
option.state |= QStyle::State_Sunken;
if (qxt_p().isChecked())
option.state |= QStyle::State_On;
if (!qxt_p().isFlat() && !qxt_p().isDown())
option.state |= QStyle::State_Raised;
if (!isRichText())
{
option.text = qxt_p().text();
option.icon = qxt_p().icon();
option.iconSize = qxt_p().iconSize();
}
return option;
}
示例9: arrowSize
/*!
Calculate the size for a arrow that fits into a rect of a given size
\param arrowType Arrow type
\param boundingSize Bounding size
\return Size of the arrow
*/
QSize QwtArrowButton::arrowSize(Qt::ArrowType arrowType,
const QSize &boundingSize) const
{
QSize bs = boundingSize;
if ( arrowType == Qt::UpArrow || arrowType == Qt::DownArrow )
bs.transpose();
const int MinLen = 2;
const QSize sz = bs.expandedTo(
QSize(MinLen, 2 * MinLen - 1)); // minimum
int w = sz.width();
int h = 2 * w - 1;
if ( h > sz.height() )
{
h = sz.height();
w = (h + 1) / 2;
}
QSize arrSize(w, h);
if ( arrowType == Qt::UpArrow || arrowType == Qt::DownArrow )
arrSize.transpose();
return arrSize;
}
示例10: paintEvent
/*!
\reimp
*/
void QxtLabel::paintEvent(QPaintEvent* event)
{
QFrame::paintEvent(event);
QPainter p(this);
p.rotate(qxt_d().rot);
QRect r = contentsRect();
switch (qxt_d().rot)
{
case Qxt::UpsideDown:
p.translate(-r.width(), -r.height());
break;
case Qxt::Clockwise:
p.translate(0, -r.width());
break;
case Qxt::CounterClockwise:
p.translate(-r.height(), 0);
break;
default:
// nothing to do
break;
}
if (qxt_d().rot & Vertical_Mask)
{
QSize s = r.size();
s.transpose();
r = QRect(r.topLeft(), s);
}
const QString elidedText = fontMetrics().elidedText(qxt_d().text, qxt_d().mode, r.width());
p.drawText(r, qxt_d().align, elidedText);
}
示例11: updateFocusZones
void QAndroidCameraFocusControl::updateFocusZones(QCameraFocusZone::FocusZoneStatus status)
{
if (!m_session->camera())
return;
// create a focus zone (50x50 pixel) around the focus point
m_focusZones.clear();
if (m_actualFocusPoint.isNull())
return;
QSize viewportSize = m_session->camera()->previewSize();
if (!viewportSize.isValid())
return;
if (m_session->camera()->getDisplayOrientation() % 180)
viewportSize.transpose();
QSizeF focusSize(50.f / viewportSize.width(), 50.f / viewportSize.height());
float x = qBound(qreal(0),
m_actualFocusPoint.x() - (focusSize.width() / 2),
1.f - focusSize.width());
float y = qBound(qreal(0),
m_actualFocusPoint.y() - (focusSize.height() / 2),
1.f - focusSize.height());
QRectF area(QPointF(x, y), focusSize);
m_focusZones.append(QCameraFocusZone(area, status));
emit focusZonesChanged();
}
示例12: main
Q_DECL_EXPORT
#endif
int main(int argc, char *argv[])
{
#if defined(Q_OS_LINUX) && !defined(MAEMO)
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
#endif
QApplication a(argc, argv);
QSize res = QApplication::desktop()->screenGeometry().size();
if (res.width() < res.height())
res.transpose();
pixel_xres = res.width();
pixel_yres = res.height();
g_dpi_scale = CalculateDPIScale();
dp_xres = (int)(pixel_xres * g_dpi_scale); dp_yres = (int)(pixel_yres * g_dpi_scale);
net::Init();
#ifdef __SYMBIAN32__
const char *savegame_dir = "E:/PPSSPP/";
const char *assets_dir = "E:/PPSSPP/";
#elif defined(BLACKBERRY)
const char *savegame_dir = "/accounts/1000/shared/misc/";
const char *assets_dir = "app/native/assets/";
#elif defined(MEEGO_EDITION_HARMATTAN) || defined(MAEMO)
const char *savegame_dir = "/home/user/MyDocs/PPSSPP/";
const char *assets_dir = "/opt/PPSSPP/";
#else
const char *savegame_dir = "./";
const char *assets_dir = "./";
#endif
NativeInit(argc, (const char **)argv, savegame_dir, assets_dir, "BADCOFFEE");
#ifdef USING_GLES2
emugl = new MainUI();
emugl->resize(pixel_xres, pixel_yres);
emugl->showFullScreen();
#endif
#ifdef __SYMBIAN32__
// Set RunFast hardware mode for VFPv2.
User::SetFloatingPointMode(EFpModeRunFast);
// Disable screensaver
QScopedPointer<QSystemScreenSaver> ssObject(new QSystemScreenSaver(emugl));
ssObject->setScreenSaverInhibit();
QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys());
#endif
QScopedPointer<QThread> thread(new QThread);
QScopedPointer<MainAudio> audio(new MainAudio());
audio->moveToThread(thread.data());
QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run()));
thread->start();
#ifdef QT_HAS_SDL
SDLJoystick joy(true);
joy.startEventLoop();
#endif
int ret = a.exec();
thread->quit();
NativeShutdown();
net::Shutdown();
return ret;
}
示例13: setScreenSize
void SDeclarativeScreenPrivateResize::setScreenSize(QSize size)
{
Q_Q(SDeclarativeScreen);
// Fallback
if (size.isEmpty())
size = enforceFixedOrientation(systemScreenSize());
if (size.isEmpty() || size == m_screenSize)
return;
#ifndef Q_OS_SYMBIAN
QSize sizeTransposed = size;
sizeTransposed.transpose();
if (m_displaySize != size && m_displaySize != sizeTransposed) {
m_displaySize = size;
q->emit displayChanged();
}
#endif
if ((m_screenSize.width() <= m_screenSize.height() && size.width() > size.height())
|| (m_screenSize.width() > m_screenSize.height() && size.width() <= size.height()))
q->emit privateAboutToChangeOrientation(0, false);
SDeclarativeScreenPrivate::setScreenSize(size);
setCurrentOrientation(portraitScreen() ? SDeclarativeScreen::Portrait : SDeclarativeScreen::Landscape);
}
示例14: sizeHint
QSize DockButton::sizeHint() const
{
QSize hint = QToolButton::sizeHint();
if (toolBarOrientation(this) == Qt::Vertical) {
hint.transpose();
}
return hint;
}
示例15: minimumSizeHint
/*!
\reimp
*/
QSize QxtStars::minimumSizeHint() const
{
QSize size = qxt_d().getStarSize();
size.rwidth() *= maximum() - minimum();
if (orientation() == Qt::Vertical)
size.transpose();
return size;
}