diff --git a/CHANGELOG.md b/CHANGELOG.md index 5df6ef2..bba227a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v2.2.1 + +- [#17](https://github.com/procitec/qlitehtmlbrowser/issues/17): Scale changed signal +- [#22](https://github.com/procitec/qlitehtmlbrowser/issues/22): Scaling makes images blurry with css properties `width` + ## v2.2.0 - [#20](https://github.com/procitec/qlitehtmlbrowser/issues/20): Feature Search Text diff --git a/CMakeLists.txt b/CMakeLists.txt index d169a9f..56df0b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.28) -project( QLiteHtmlBrowser VERSION 2.2.0 ) +project( QLiteHtmlBrowser VERSION 2.2.1 ) include(GNUInstallDirs) diff --git a/include/qlitehtmlbrowser/QLiteHtmlBrowser.h b/include/qlitehtmlbrowser/QLiteHtmlBrowser.h index f2124e3..200766b 100644 --- a/include/qlitehtmlbrowser/QLiteHtmlBrowser.h +++ b/include/qlitehtmlbrowser/QLiteHtmlBrowser.h @@ -185,6 +185,10 @@ public Q_SLOTS: /// send when an anchor is clicked in the document, even if link is not activated, @see setOpenLinks void anchorClicked( const QUrl& ); + /// send when scale changes + void scaleChanged(); + +protected: private: QLiteHtmlBrowserImpl* mImpl = nullptr; }; diff --git a/src/QLiteHtmlBrowser.cpp b/src/QLiteHtmlBrowser.cpp index 36bdc18..ec850d4 100644 --- a/src/QLiteHtmlBrowser.cpp +++ b/src/QLiteHtmlBrowser.cpp @@ -18,6 +18,7 @@ QLiteHtmlBrowser::QLiteHtmlBrowser( QWidget* parent ) connect( mImpl, &QLiteHtmlBrowserImpl::urlChanged, this, &QLiteHtmlBrowser::sourceChanged ); connect( mImpl, &QLiteHtmlBrowserImpl::anchorClicked, this, &QLiteHtmlBrowser::anchorClicked ); + connect( mImpl, &QLiteHtmlBrowserImpl::scaleChanged, this, &QLiteHtmlBrowser::scaleChanged ); } QUrl QLiteHtmlBrowser::source() const diff --git a/src/QLiteHtmlBrowserImpl.cpp b/src/QLiteHtmlBrowserImpl.cpp index c5380de..9f000de 100644 --- a/src/QLiteHtmlBrowserImpl.cpp +++ b/src/QLiteHtmlBrowserImpl.cpp @@ -24,6 +24,7 @@ QLiteHtmlBrowserImpl::QLiteHtmlBrowserImpl( QWidget* parent ) shortcut = new QShortcut( QKeySequence{ QKeySequence::Back }, this ); connect( shortcut, &QShortcut::activated, this, &QLiteHtmlBrowserImpl::backward ); + connect( mContainer, &container_qt::scaleChanged, this, &QLiteHtmlBrowserImpl::scaleChanged ); auto* layout = new QVBoxLayout; layout->setContentsMargins( 0, 0, 0, 0 ); diff --git a/src/QLiteHtmlBrowserImpl.h b/src/QLiteHtmlBrowserImpl.h index 73a22bb..17ad6e0 100644 --- a/src/QLiteHtmlBrowserImpl.h +++ b/src/QLiteHtmlBrowserImpl.h @@ -78,6 +78,7 @@ class QLiteHtmlBrowserImpl : public QWidget /// emited when the url changed due to user interaction, e.g. link activation void urlChanged( const QUrl& ); void anchorClicked( const QUrl& ); + void scaleChanged(); private: class HistoryEntry diff --git a/src/container_qt.cpp b/src/container_qt.cpp index 134cbf7..18c8f85 100644 --- a/src/container_qt.cpp +++ b/src/container_qt.cpp @@ -355,7 +355,7 @@ void container_qt::draw_list_marker( litehtml::uint_ptr hdc, const litehtml::lis { auto url = resolveUrl( marker.image.c_str(), marker.baseurl ); auto image = load_pixmap( url ); - p->drawPixmap( /*scaled*/ ( QRect( marker.pos.x, marker.pos.y, marker.pos.width, marker.pos.height ) ), image ); + p->drawPixmap( QRect( marker.pos.x, marker.pos.y, marker.pos.width, marker.pos.height ), image ); } else { @@ -537,7 +537,6 @@ void container_qt::draw_background( litehtml::uint_ptr hdc, const std::vector
Image without css width:
+
+Image with 50% css width:
+
+Image with 100px width:
+
+Image with 100% css width:
+
+