diff --git a/library/private/window_impl.h b/library/private/window_impl.h index addea7e956..283ce6af27 100644 --- a/library/private/window_impl.h +++ b/library/private/window_impl.h @@ -55,7 +55,7 @@ class window_impl : public window window& setSize(int width, int height) override; window& setPosition(int x, int y) override; window& setIcon(const unsigned char* icon, size_t iconSize) override; - window& setWindowName(const std::string& windowName) override; + window& setWindowName(std::string_view windowName) override; point3_t getWorldFromDisplay(const point3_t& displayPoint) const override; point3_t getDisplayFromWorld(const point3_t& worldPoint) const override; ///@} diff --git a/library/public/window.h b/library/public/window.h index 33d7aa9c6a..64bfabc70c 100644 --- a/library/public/window.h +++ b/library/public/window.h @@ -106,7 +106,7 @@ class F3D_EXPORT window /** * Set the window name to be shown by a window manager. */ - virtual window& setWindowName(const std::string& windowName) = 0; + virtual window& setWindowName(std::string_view windowName) = 0; /** * Convert a point in display coordinate to world coordinate. diff --git a/library/src/window_impl.cxx b/library/src/window_impl.cxx index 53107918a0..7e2f8e959c 100644 --- a/library/src/window_impl.cxx +++ b/library/src/window_impl.cxx @@ -315,9 +315,9 @@ window& window_impl::setIcon(const unsigned char* icon, size_t iconSize) } //---------------------------------------------------------------------------- -window& window_impl::setWindowName(const std::string& windowName) +window& window_impl::setWindowName(std::string_view windowName) { - this->Internals->RenWin->SetWindowName(windowName.c_str()); + this->Internals->RenWin->SetWindowName(windowName.data()); return *this; }