diff options
Diffstat (limited to 'qt')
-rw-r--r-- | qt/draw_widget.cpp | 35 | ||||
-rw-r--r-- | qt/draw_widget.hpp | 3 | ||||
-rw-r--r-- | qt/mainwindow.cpp | 2 |
3 files changed, 35 insertions, 5 deletions
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index fe6f517ae5..fccd3e1266 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -109,7 +109,7 @@ bool IsLocationEmulation(QMouseEvent * e) void DrawWidget::UpdateAfterSettingsChanged() { - m_framework->SetupMeasurementSystem(); + m_framework->EnterForeground(); } void DrawWidget::LoadState() @@ -170,8 +170,21 @@ bool IsLocationEmulation(QMouseEvent * e) void DrawWidget::CreateEngine() { - m_framework->CreateDrapeEngine(make_ref(m_contextFactory), m_ratio, - m_ratio * width(), m_ratio * height()); + Framework::DrapeCreationParams p; + p.m_surfaceWidth = m_ratio * width(); + p.m_surfaceHeight = m_ratio * height(); + p.m_visualScale = m_ratio; + + m_skin.reset(new gui::Skin(gui::ResolveGuiSkinFile("default"), m_ratio)); + m_skin->Resize(p.m_surfaceWidth, p.m_surfaceHeight); + m_skin->ForEach([&p](gui::EWidget widget, gui::Position const & pos) + { + p.m_widgetsInitInfo[widget] = pos; + }); + + p.m_widgetsInitInfo[gui::WIDGET_SCALE_LABLE] = gui::Position(dp::LeftBottom); + + m_framework->CreateDrapeEngine(make_ref(m_contextFactory), move(p)); m_framework->AddViewportListener(bind(&DrawWidget::OnViewportChanged, this, _1)); } @@ -315,7 +328,21 @@ bool IsLocationEmulation(QMouseEvent * e) void DrawWidget::sizeChanged(int) { - m_framework->OnSize(m_ratio * width(), m_ratio * height()); + float w = m_ratio * width(); + float h = m_ratio * height(); + m_framework->OnSize(w, h); + if (m_skin) + { + m_skin->Resize(w, h); + + gui::TWidgetsLayoutInfo layout; + m_skin->ForEach([&layout](gui::EWidget w, gui::Position const & pos) + { + layout[w] = pos.m_pixelPivot; + }); + + m_framework->SetWidgetLayout(move(layout)); + } } void DrawWidget::SubmitFakeLocationPoint(m2::PointD const & pt) diff --git a/qt/draw_widget.hpp b/qt/draw_widget.hpp index 37dd51afdb..35276d9951 100644 --- a/qt/draw_widget.hpp +++ b/qt/draw_widget.hpp @@ -5,6 +5,7 @@ #include "map/framework.hpp" #include "drape_frontend/drape_engine.hpp" +#include "drape_gui/skin.hpp" #include "std/unique_ptr.hpp" @@ -99,5 +100,7 @@ namespace qt bool m_emulatingLocation; void InitRenderPolicy(); + + unique_ptr<gui::Skin> m_skin; }; } diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 841623bd23..446a4195ed 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -386,7 +386,7 @@ void MainWindow::OnPreferences() PreferencesDialog dlg(this); dlg.exec(); - m_pDrawWidget->GetFramework().SetupMeasurementSystem(); + m_pDrawWidget->GetFramework().EnterForeground(); } #ifndef NO_DOWNLOADER |