diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index ec66f712ccce..4d251115a6c3 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -160,25 +160,22 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) std::unique_ptr QtInstanceBuilder::weld_message_dialog(const OUString& id) { QMessageBox* pMessageBox = m_xBuilder->get(id); - std::unique_ptr xRet( - pMessageBox ? std::make_unique(pMessageBox) : nullptr); - return xRet; + assert(pMessageBox); + return std::make_unique(pMessageBox); } std::unique_ptr QtInstanceBuilder::weld_dialog(const OUString& rId) { QDialog* pDialog = m_xBuilder->get(rId); - std::unique_ptr xRet(pDialog ? std::make_unique(pDialog) - : nullptr); - return xRet; + assert(pDialog); + return std::make_unique(pDialog); } std::unique_ptr QtInstanceBuilder::weld_assistant(const OUString& rId) { QWizard* pWizard = m_xBuilder->get(rId); - std::unique_ptr xRet(pWizard ? std::make_unique(pWizard) - : nullptr); - return xRet; + assert(pWizard); + return std::make_unique(pWizard); } std::unique_ptr QtInstanceBuilder::create_screenshot_window() @@ -190,17 +187,14 @@ std::unique_ptr QtInstanceBuilder::create_screenshot_window() std::unique_ptr QtInstanceBuilder::weld_widget(const OUString& rId) { QWidget* pWidget = m_xBuilder->get(rId); - std::unique_ptr xRet(pWidget ? std::make_unique(pWidget) - : nullptr); - return xRet; + assert(pWidget); + return std::make_unique(pWidget); } std::unique_ptr QtInstanceBuilder::weld_container(const OUString& rId) { QWidget* pWidget = m_xBuilder->get(rId); - if (!pWidget) - return nullptr; - + assert(pWidget); assert(pWidget->layout() && "no layout"); return std::make_unique(pWidget); } @@ -208,9 +202,7 @@ std::unique_ptr QtInstanceBuilder::weld_container(const OUStrin std::unique_ptr QtInstanceBuilder::weld_box(const OUString& rId) { QWidget* pWidget = m_xBuilder->get(rId); - if (!pWidget) - return nullptr; - + assert(pWidget); assert(qobject_cast(pWidget->layout()) && "widget doesn't have a box layout"); return std::make_unique(pWidget); } @@ -218,9 +210,7 @@ std::unique_ptr QtInstanceBuilder::weld_box(const OUString& rId) std::unique_ptr QtInstanceBuilder::weld_grid(const OUString& rId) { QWidget* pWidget = m_xBuilder->get(rId); - if (!pWidget) - return nullptr; - + assert(pWidget); assert(qobject_cast(pWidget->layout()) && "no grid layout"); return std::make_unique(pWidget); } @@ -234,42 +224,37 @@ std::unique_ptr QtInstanceBuilder::weld_paned(const OUString&) std::unique_ptr QtInstanceBuilder::weld_frame(const OUString& rId) { QGroupBox* pGroupBox = m_xBuilder->get(rId); - std::unique_ptr xRet(pGroupBox ? std::make_unique(pGroupBox) - : nullptr); - return xRet; + assert(pGroupBox); + return std::make_unique(pGroupBox); } std::unique_ptr QtInstanceBuilder::weld_scrolled_window(const OUString& rId, bool) { QScrollArea* pScrollArea = m_xBuilder->get(rId); - std::unique_ptr xRet( - pScrollArea ? std::make_unique(pScrollArea) : nullptr); - return xRet; + assert(pScrollArea); + return std::make_unique(pScrollArea); } std::unique_ptr QtInstanceBuilder::weld_notebook(const OUString& rId) { QTabWidget* pTabWidget = m_xBuilder->get(rId); - std::unique_ptr xRet( - pTabWidget ? std::make_unique(pTabWidget) : nullptr); - return xRet; + assert(pTabWidget); + return std::make_unique(pTabWidget); } std::unique_ptr QtInstanceBuilder::weld_button(const OUString& rId) { QPushButton* pButton = m_xBuilder->get(rId); - std::unique_ptr xRet(pButton ? std::make_unique(pButton) - : nullptr); - return xRet; + assert(pButton); + return std::make_unique(pButton); } std::unique_ptr QtInstanceBuilder::weld_menu_button(const OUString& rId) { QToolButton* pButton = m_xBuilder->get(rId); - std::unique_ptr xRet(pButton ? std::make_unique(pButton) - : nullptr); - return xRet; + assert(pButton); + return std::make_unique(pButton); } std::unique_ptr QtInstanceBuilder::weld_menu_toggle_button(const OUString&) @@ -281,57 +266,50 @@ std::unique_ptr QtInstanceBuilder::weld_menu_toggle_butt std::unique_ptr QtInstanceBuilder::weld_link_button(const OUString& rId) { QtHyperlinkLabel* pLabel = m_xBuilder->get(rId); - std::unique_ptr xRet(pLabel ? std::make_unique(pLabel) - : nullptr); - return xRet; + assert(pLabel); + return std::make_unique(pLabel); } std::unique_ptr QtInstanceBuilder::weld_toggle_button(const OUString& rId) { QAbstractButton* pButton = m_xBuilder->get(rId); - std::unique_ptr xRet( - pButton ? std::make_unique(pButton) : nullptr); - return xRet; + assert(pButton); + return std::make_unique(pButton); } std::unique_ptr QtInstanceBuilder::weld_radio_button(const OUString& rId) { QRadioButton* pRadioButton = m_xBuilder->get(rId); - std::unique_ptr xRet( - pRadioButton ? std::make_unique(pRadioButton) : nullptr); - return xRet; + assert(pRadioButton); + return std::make_unique(pRadioButton); } std::unique_ptr QtInstanceBuilder::weld_check_button(const OUString& rId) { QCheckBox* pCheckBox = m_xBuilder->get(rId); - std::unique_ptr xRet( - pCheckBox ? std::make_unique(pCheckBox) : nullptr); - return xRet; + assert(pCheckBox); + return std::make_unique(pCheckBox); } std::unique_ptr QtInstanceBuilder::weld_scale(const OUString& rId) { QSlider* pSlider = m_xBuilder->get(rId); - std::unique_ptr xRet(pSlider ? std::make_unique(pSlider) - : nullptr); - return xRet; + assert(pSlider); + return std::make_unique(pSlider); } std::unique_ptr QtInstanceBuilder::weld_progress_bar(const OUString& rId) { QProgressBar* pProgressBar = m_xBuilder->get(rId); - std::unique_ptr xRet( - pProgressBar ? std::make_unique(pProgressBar) : nullptr); - return xRet; + assert(pProgressBar); + return std::make_unique(pProgressBar); } std::unique_ptr QtInstanceBuilder::weld_level_bar(const OUString& rId) { QProgressBar* pProgressBar = m_xBuilder->get(rId); - std::unique_ptr xRet( - pProgressBar ? std::make_unique(pProgressBar) : nullptr); - return xRet; + assert(pProgressBar); + return std::make_unique(pProgressBar); } std::unique_ptr QtInstanceBuilder::weld_spinner(const OUString&) @@ -343,8 +321,8 @@ std::unique_ptr QtInstanceBuilder::weld_spinner(const OUString&) std::unique_ptr QtInstanceBuilder::weld_image(const OUString& rId) { QLabel* pLabel = m_xBuilder->get(rId); - std::unique_ptr xRet(pLabel ? std::make_unique(pLabel) : nullptr); - return xRet; + assert(pLabel); + return std::make_unique(pLabel); } std::unique_ptr QtInstanceBuilder::weld_calendar(const OUString&) @@ -356,17 +334,15 @@ std::unique_ptr QtInstanceBuilder::weld_calendar(const OUString& std::unique_ptr QtInstanceBuilder::weld_entry(const OUString& rId) { QLineEdit* pLineEdit = m_xBuilder->get(rId); - std::unique_ptr xRet(pLineEdit ? std::make_unique(pLineEdit) - : nullptr); - return xRet; + assert(pLineEdit); + return std::make_unique(pLineEdit); } std::unique_ptr QtInstanceBuilder::weld_spin_button(const OUString& rId) { QtDoubleSpinBox* pSpinBox = m_xBuilder->get(rId); - std::unique_ptr xRet( - pSpinBox ? std::make_unique(pSpinBox) : nullptr); - return xRet; + assert(pSpinBox); + return std::make_unique(pSpinBox); } std::unique_ptr @@ -379,17 +355,15 @@ std::unique_ptr QtInstanceBuilder::weld_formatted_spin_button(const OUString& rId) { QtDoubleSpinBox* pSpinBox = m_xBuilder->get(rId); - std::unique_ptr xRet( - pSpinBox ? std::make_unique(pSpinBox) : nullptr); - return xRet; + assert(pSpinBox); + return std::make_unique(pSpinBox); } std::unique_ptr QtInstanceBuilder::weld_combo_box(const OUString& rId) { QComboBox* pComboBox = m_xBuilder->get(rId); - std::unique_ptr xRet(pComboBox ? std::make_unique(pComboBox) - : nullptr); - return xRet; + assert(pComboBox); + return std::make_unique(pComboBox); } std::unique_ptr @@ -401,89 +375,79 @@ QtInstanceBuilder::weld_entry_tree_view(const OUString& rContainerId, const OUSt QTreeView* pTreeView = m_xBuilder->get(rTreeViewId); assert(pWidget && pLineEdit && pTreeView); - std::unique_ptr xRet(std::make_unique( - pWidget, pLineEdit, pTreeView, weld_entry(rEntryId), weld_tree_view(rTreeViewId))); - - return xRet; + return std::make_unique( + pWidget, pLineEdit, pTreeView, weld_entry(rEntryId), weld_tree_view(rTreeViewId)); } std::unique_ptr QtInstanceBuilder::weld_tree_view(const OUString& rId) { QTreeView* pTreeView = m_xBuilder->get(rId); - std::unique_ptr xRet(pTreeView ? std::make_unique(pTreeView) - : nullptr); - return xRet; + assert(pTreeView); + return std::make_unique(pTreeView); } std::unique_ptr QtInstanceBuilder::weld_icon_view(const OUString& rId) { QListView* pListView = m_xBuilder->get(rId); - std::unique_ptr xRet(pListView ? std::make_unique(pListView) - : nullptr); - return xRet; + assert(pListView); + return std::make_unique(pListView); } std::unique_ptr QtInstanceBuilder::weld_label(const OUString& rId) { QLabel* pLabel = m_xBuilder->get(rId); - std::unique_ptr xRet(pLabel ? std::make_unique(pLabel) : nullptr); - return xRet; + assert(pLabel); + return std::make_unique(pLabel); } std::unique_ptr QtInstanceBuilder::weld_text_view(const OUString& rId) { QPlainTextEdit* pTextEdit = m_xBuilder->get(rId); - std::unique_ptr xRet(pTextEdit ? std::make_unique(pTextEdit) - : nullptr); - return xRet; + assert(pTextEdit); + return std::make_unique(pTextEdit); } std::unique_ptr QtInstanceBuilder::weld_expander(const OUString& rId) { QtExpander* pExpander = m_xBuilder->get(rId); - std::unique_ptr xRet(pExpander ? std::make_unique(pExpander) - : nullptr); - return xRet; + assert(pExpander); + return std::make_unique(pExpander); } std::unique_ptr QtInstanceBuilder::weld_drawing_area(const OUString& rId, const a11yref&, FactoryFunction, void*) { QLabel* pLabel = m_xBuilder->get(rId); - std::unique_ptr xRet(pLabel ? std::make_unique(pLabel) - : nullptr); - return xRet; + assert(pLabel); + return std::make_unique(pLabel); } std::unique_ptr QtInstanceBuilder::weld_menu(const OUString& rId) { QMenu* pMenu = m_xBuilder->get_menu(rId); - std::unique_ptr xRet(pMenu ? std::make_unique(pMenu) : nullptr); - return xRet; + assert(pMenu); + return std::make_unique(pMenu); } std::unique_ptr QtInstanceBuilder::weld_popover(const OUString& rId) { QWidget* pWidget = m_xBuilder->get(rId); - std::unique_ptr xRet(pWidget ? std::make_unique(pWidget) - : nullptr); - return xRet; + assert(pWidget); + return std::make_unique(pWidget); } std::unique_ptr QtInstanceBuilder::weld_toolbar(const OUString& rId) { QToolBar* pToolBar = m_xBuilder->get(rId); - std::unique_ptr xRet(pToolBar ? std::make_unique(pToolBar) - : nullptr); - return xRet; + assert(pToolBar); + return std::make_unique(pToolBar); } std::unique_ptr QtInstanceBuilder::weld_scrollbar(const OUString& rId) { QScrollBar* pScrollBar = m_xBuilder->get(rId); - std::unique_ptr xRet( - pScrollBar ? std::make_unique(pScrollBar) : nullptr); - return xRet; + assert(pScrollBar); + return std::make_unique(pScrollBar); } std::unique_ptr QtInstanceBuilder::create_size_group()