Название: Nokia N900, портретный режим.
Отправлено: Lunex.08 от Июль 21, 2011, 06:46
Добрый день. Каким способом можно поменять ориентацию экрана на отображение в портретном режиме?
Название: Re: Nokia N900, портретный режим.
Отправлено: Sancho_s_rancho от Июль 21, 2011, 08:48
Гугл, между прочим, дает ответы на такие простые вопросы. enum ScreenOrientation { ScreenOrientationLockPortrait, ScreenOrientationLockLandscape, ScreenOrientationAuto }; void setOrientation(ScreenOrientation orientation) { #if defined(Q_OS_SYMBIAN) // If the version of Qt on the device is < 4.7.2, that attribute won't work if (orientation != ScreenOrientationAuto) { const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); return; } } #endif // Q_OS_SYMBIAN
Qt::WidgetAttribute attribute; switch (orientation) { #if QT_VERSION < 0x040702 // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes case ScreenOrientationLockPortrait: attribute = static_cast<Qt::WidgetAttribute>(128); break; case ScreenOrientationLockLandscape: attribute = static_cast<Qt::WidgetAttribute>(129); break; default: case ScreenOrientationAuto: attribute = static_cast<Qt::WidgetAttribute>(130); break; #else // QT_VERSION < 0x040702 case ScreenOrientationLockPortrait: attribute = Qt::WA_LockPortraitOrientation; break; case ScreenOrientationLockLandscape: attribute = Qt::WA_LockLandscapeOrientation; break; default: case ScreenOrientationAuto: attribute = Qt::WA_AutoOrientation; break; #endif // QT_VERSION < 0x040702 }; setAttribute(attribute, true); }
Название: Re: Nokia N900, портретный режим.
Отправлено: Lunex.08 от Июль 22, 2011, 05:56
Этот пример я в асистанте находил, но он не работал почему то. Спасибо.
Название: Re: Nokia N900, портретный режим.
Отправлено: Sancho_s_rancho от Июль 22, 2011, 07:03
Этот пример я в асистанте находил, но он не работал почему то. Спасибо.
Я в чудеса не сильно верю. Какая версия Qt у вас на n900? Если что-то типа 4.6, то посмотрите сюда http://doc.qt.nokia.com/qt-maemo-4.6/maemo5-rotation.html
Название: Re: Nokia N900, портретный режим.
Отправлено: Lunex.08 от Июль 22, 2011, 16:15
Спасибо за ссылку, посмотрел. Все заработало. Я еще посмотрел как все сделано в чужом проекте. Скорее всего я что то просмотрел в своем проекте. Спасибо
|