forked from qt-creator/qt-creator
QmlDesigner: Fix ZoomAction
Task-number: QDS-1720 Change-Id: I310679df54536841e0a7c6591bd1d03280c5280c Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -30,10 +30,12 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
const int defaultZoomIndex = 11;
|
||||||
|
|
||||||
ZoomAction::ZoomAction(QObject *parent)
|
ZoomAction::ZoomAction(QObject *parent)
|
||||||
: QWidgetAction(parent),
|
: QWidgetAction(parent),
|
||||||
m_zoomLevel(1.0),
|
m_zoomLevel(1.0),
|
||||||
m_currentComboBoxIndex(8)
|
m_currentComboBoxIndex(defaultZoomIndex)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -58,7 +60,7 @@ void ZoomAction::zoomOut()
|
|||||||
void ZoomAction::resetZoomLevel()
|
void ZoomAction::resetZoomLevel()
|
||||||
{
|
{
|
||||||
m_zoomLevel = 1.0;
|
m_zoomLevel = 1.0;
|
||||||
m_currentComboBoxIndex = 8;
|
m_currentComboBoxIndex = defaultZoomIndex;
|
||||||
emit reseted();
|
emit reseted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +74,9 @@ QWidget *ZoomAction::createWidget(QWidget *parent)
|
|||||||
{
|
{
|
||||||
auto comboBox = new QComboBox(parent);
|
auto comboBox = new QComboBox(parent);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When add zoom levels do not forget to update defaultZoomIndex
|
||||||
|
*/
|
||||||
if (m_comboBoxModel.isNull()) {
|
if (m_comboBoxModel.isNull()) {
|
||||||
m_comboBoxModel = comboBox->model();
|
m_comboBoxModel = comboBox->model();
|
||||||
comboBox->addItem(QLatin1String("1 %"), 0.01);
|
comboBox->addItem(QLatin1String("1 %"), 0.01);
|
||||||
|
Reference in New Issue
Block a user