From f932710e1627ddcf0f36ccc4fef206c4be3d5d65 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 26 Feb 2022 19:55:05 +0200 Subject: [PATCH] partial build fix for the case when QT_NO_STATUSBAR is defined Signed-off-by: Ivailo Monev --- src/core/global/qconfig.h.cmake | 14 ++++---- .../components/taskmenu/taskmenu_component.cpp | 2 ++ .../components/taskmenu/toolbar_taskmenu.cpp | 2 ++ .../components/taskmenu/toolbar_taskmenu.h | 4 ++- src/designer/shared/qdesigner_command.cpp | 2 ++ src/designer/shared/qdesigner_command_p.h | 2 ++ src/designer/shared/qdesigner_taskmenu.cpp | 4 +++ src/tools/qtconfig/mainwindow.cpp | 7 +++- tests/auto/qmainwindow/tst_qmainwindow.cpp | 41 +++++++++++++++++----- tests/auto/qmenu/tst_qmenu.cpp | 6 +++- tests/auto/qstatusbar/tst_qstatusbar.cpp | 12 +++++-- 11 files changed, 75 insertions(+), 21 deletions(-) diff --git a/src/core/global/qconfig.h.cmake b/src/core/global/qconfig.h.cmake index a824d5758..77b286c1a 100644 --- a/src/core/global/qconfig.h.cmake +++ b/src/core/global/qconfig.h.cmake @@ -134,6 +134,13 @@ // #cmakedefine QT_NO_SCROLLBAR // #cmakedefine QT_NO_SHORTCUT // #cmakedefine QT_NO_SIGNALMAPPER +// #cmakedefine QT_NO_SLIDER +// #cmakedefine QT_NO_SORTFILTERPROXYMODEL +// #cmakedefine QT_NO_SPINBOX +// #cmakedefine QT_NO_SPLITTER +// #cmakedefine QT_NO_STACKEDWIDGET +// #cmakedefine QT_NO_STANDARDITEMMODEL +// #cmakedefine QT_NO_STATUSBAR // Misc #cmakedefine QT_NO_USING_NAMESPACE @@ -176,14 +183,7 @@ #cmakedefine QT_NO_QUUID_STRING #cmakedefine QT_NO_SHAREDMEMORY #cmakedefine QT_NO_SIZEGRIP -#cmakedefine QT_NO_SLIDER -#cmakedefine QT_NO_SORTFILTERPROXYMODEL -#cmakedefine QT_NO_SPINBOX #cmakedefine QT_NO_SPLASHSCREEN -#cmakedefine QT_NO_SPLITTER -#cmakedefine QT_NO_STACKEDWIDGET -#cmakedefine QT_NO_STANDARDITEMMODEL -#cmakedefine QT_NO_STATUSBAR #cmakedefine QT_NO_STATUSTIP #cmakedefine QT_NO_STRINGLISTMODEL #cmakedefine QT_NO_STYLE_CLEANLOOKS diff --git a/src/designer/components/taskmenu/taskmenu_component.cpp b/src/designer/components/taskmenu/taskmenu_component.cpp index 41aec7689..1e7f89328 100644 --- a/src/designer/components/taskmenu/taskmenu_component.cpp +++ b/src/designer/components/taskmenu/taskmenu_component.cpp @@ -65,7 +65,9 @@ TaskMenuComponent::TaskMenuComponent(QDesignerFormEditorInterface *core, QObject MenuTaskMenuFactory::registerExtension(mgr, taskMenuId); MenuBarTaskMenuFactory::registerExtension(mgr, taskMenuId); ToolBarTaskMenuFactory::registerExtension(mgr, taskMenuId); +#ifndef QT_NO_STATUSBAR StatusBarTaskMenuFactory::registerExtension(mgr, taskMenuId); +#endif // QT_NO_STATUSBAR LayoutWidgetTaskMenuFactory::registerExtension(mgr, taskMenuId); SpacerTaskMenuFactory::registerExtension(mgr, taskMenuId); diff --git a/src/designer/components/taskmenu/toolbar_taskmenu.cpp b/src/designer/components/taskmenu/toolbar_taskmenu.cpp index 2af89224b..096766a73 100644 --- a/src/designer/components/taskmenu/toolbar_taskmenu.cpp +++ b/src/designer/components/taskmenu/toolbar_taskmenu.cpp @@ -54,6 +54,7 @@ namespace qdesigner_internal { return QList(); } +#ifndef QT_NO_STATUSBAR // ------------ StatusBarTaskMenu StatusBarTaskMenu::StatusBarTaskMenu(QStatusBar *sb, QObject *parent) : QObject(parent), @@ -85,6 +86,7 @@ namespace qdesigner_internal { fw->commandHistory()->push(cmd); } } +#endif // QT_NO_STATUSBAR } QT_END_NAMESPACE diff --git a/src/designer/components/taskmenu/toolbar_taskmenu.h b/src/designer/components/taskmenu/toolbar_taskmenu.h index a5ead2c6f..ae245f18f 100644 --- a/src/designer/components/taskmenu/toolbar_taskmenu.h +++ b/src/designer/components/taskmenu/toolbar_taskmenu.h @@ -48,7 +48,9 @@ public: private: QToolBar *m_toolBar; }; +typedef ExtensionFactory ToolBarTaskMenuFactory; +#ifndef QT_NO_STATUSBAR // StatusBarTaskMenu provides promotion and deletion class StatusBarTaskMenu : public QObject, public QDesignerTaskMenuExtension { @@ -69,8 +71,8 @@ private: PromotionTaskMenu *m_promotionTaskMenu; }; -typedef ExtensionFactory ToolBarTaskMenuFactory; typedef ExtensionFactory StatusBarTaskMenuFactory; +#endif // QT_NO_STATUSBAR } // namespace qdesigner_internal diff --git a/src/designer/shared/qdesigner_command.cpp b/src/designer/shared/qdesigner_command.cpp index bd2134faf..9a585061f 100644 --- a/src/designer/shared/qdesigner_command.cpp +++ b/src/designer/shared/qdesigner_command.cpp @@ -1529,6 +1529,7 @@ void DeleteMenuBarCommand::undo() } } +#ifndef QT_NO_STATUSBAR // ---- CreateStatusBarCommand ---- CreateStatusBarCommand::CreateStatusBarCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Create Status Bar"), formWindow) @@ -1615,6 +1616,7 @@ void DeleteStatusBarCommand::undo() formWindow()->emitSelectionChanged(); } } +#endif // QT_NO_STATUSBAR // ---- AddToolBarCommand ---- AddToolBarCommand::AddToolBarCommand(QDesignerFormWindowInterface *formWindow) diff --git a/src/designer/shared/qdesigner_command_p.h b/src/designer/shared/qdesigner_command_p.h index 600e0413c..6ad3be38a 100644 --- a/src/designer/shared/qdesigner_command_p.h +++ b/src/designer/shared/qdesigner_command_p.h @@ -667,6 +667,7 @@ private: QPointer m_menuBar; }; +#ifndef QT_NO_STATUSBAR class Q_DESIGNER_EXPORT CreateStatusBarCommand: public QDesignerFormWindowCommand { @@ -698,6 +699,7 @@ private: QPointer m_mainWindow; QPointer m_statusBar; }; +#endif // QT_NO_STATUSBAR class Q_DESIGNER_EXPORT AddToolBarCommand: public QDesignerFormWindowCommand { diff --git a/src/designer/shared/qdesigner_taskmenu.cpp b/src/designer/shared/qdesigner_taskmenu.cpp index 04ac7b021..4b0e669d8 100644 --- a/src/designer/shared/qdesigner_taskmenu.cpp +++ b/src/designer/shared/qdesigner_taskmenu.cpp @@ -451,6 +451,7 @@ void QDesignerTaskMenu::addToolBar() void QDesignerTaskMenu::createStatusBar() { +#ifndef QT_NO_STATUSBAR if (QDesignerFormWindowInterface *fw = formWindow()) { QMainWindow *mw = qobject_cast(fw->mainContainer()); if (!mw) { @@ -462,10 +463,12 @@ void QDesignerTaskMenu::createStatusBar() cmd->init(mw); fw->commandHistory()->push(cmd); } +#endif // QT_NO_STATUSBAR } void QDesignerTaskMenu::removeStatusBar() { +#ifndef QT_NO_STATUSBAR if (QDesignerFormWindowInterface *fw = formWindow()) { QMainWindow *mw = qobject_cast(fw->mainContainer()); if (!mw) { @@ -477,6 +480,7 @@ void QDesignerTaskMenu::removeStatusBar() cmd->init(findStatusBar(mw)); fw->commandHistory()->push(cmd); } +#endif // QT_NO_STATUSBAR } QList QDesignerTaskMenu::taskActions() const diff --git a/src/tools/qtconfig/mainwindow.cpp b/src/tools/qtconfig/mainwindow.cpp index 1dabf49dc..d932b20d0 100644 --- a/src/tools/qtconfig/mainwindow.cpp +++ b/src/tools/qtconfig/mainwindow.cpp @@ -129,7 +129,6 @@ MainWindow::MainWindow() previewstyle(0) { ui->setupUi(this); - statusBar(); // signals and slots connections connect(ui->fontStyleCombo, SIGNAL(activated(int)), SLOT(buildFont())); @@ -307,11 +306,15 @@ extern void qt_x11_apply_settings_in_all_apps(); void MainWindow::fileSave() { if (! modified) { +#ifndef QT_NO_STATUSBAR statusBar()->showMessage(tr("No changes to be saved."), 2000); +#endif // QT_NO_STATUSBAR return; } +#ifndef QT_NO_STATUSBAR statusBar()->showMessage(tr("Saving changes...")); +#endif // QT_NO_STATUSBAR { QSettings settings(QLatin1String("Katie"), QSettings::NativeFormat); @@ -387,7 +390,9 @@ void MainWindow::fileSave() #endif // Q_WS_X11 setModified(false); +#ifndef QT_NO_STATUSBAR statusBar()->showMessage(tr("Saved changes.")); +#endif // QT_NO_STATUSBAR } void MainWindow::fileExit() diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index 04ab8bbf8..35fff4564 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -289,6 +289,7 @@ void tst_QMainWindow::getSetCheck() QVERIFY(!var1); // delete var1; // No delete, since QMainWindow takes ownership +#ifndef QT_NO_STATUSBAR // QStatusBar * QMainWindow::statusBar() // void QMainWindow::setStatusBar(QStatusBar *) QPointer var2 = new QStatusBar; @@ -300,6 +301,7 @@ void tst_QMainWindow::getSetCheck() QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); QVERIFY(!var2); // delete var2; // No delete, since QMainWindow takes ownership +#endif // QT_NO_STATUSBAR // QWidget * QMainWindow::centralWidget() // void QMainWindow::setCentralWidget(QWidget *) @@ -498,7 +500,8 @@ void tst_QMainWindow::iconSize() } void tst_QMainWindow::setIconSize() -{ DEPENDS_ON("iconSize()"); +{ + DEPENDS_ON("iconSize()"); } void tst_QMainWindow::toolButtonStyle() @@ -698,7 +701,9 @@ void tst_QMainWindow::toolButtonStyle() } void tst_QMainWindow::setToolButtonStyle() -{ DEPENDS_ON("toolButtonStyle()"); } +{ + DEPENDS_ON("toolButtonStyle()"); +} void tst_QMainWindow::menuBar() { @@ -785,10 +790,13 @@ void tst_QMainWindow::menuBar() } void tst_QMainWindow::setMenuBar() -{ DEPENDS_ON("menuBar()"); } +{ + DEPENDS_ON("menuBar()"); +} void tst_QMainWindow::statusBar() { +#ifndef QT_NO_STATUSBAR { QMainWindow mw; QVERIFY(mw.statusBar() != 0); @@ -867,10 +875,15 @@ void tst_QMainWindow::statusBar() indexOfSb = l->indexOf(sb); QVERIFY(indexOfSb == -1); } +#else // QT_NO_STATUSBAR + QSKIP("Katie compiled without statusbar support (QT_NO_STATUSBAR)", SkipAll); +#endif // QT_NO_STATUSBAR } void tst_QMainWindow::setStatusBar() -{ DEPENDS_ON("statusBar()"); } +{ + DEPENDS_ON("statusBar()"); +} void tst_QMainWindow::centralWidget() { @@ -939,7 +952,9 @@ void tst_QMainWindow::centralWidget() } void tst_QMainWindow::setCentralWidget() -{ DEPENDS_ON("centralwidget()"); } +{ + DEPENDS_ON("centralwidget()"); +} void tst_QMainWindow::corner() { @@ -978,7 +993,9 @@ void tst_QMainWindow::corner() } void tst_QMainWindow::setCorner() -{ DEPENDS_ON("corner()"); } +{ + DEPENDS_ON("corner()"); +} void tst_QMainWindow::addToolBarBreak() { @@ -1379,7 +1396,9 @@ void tst_QMainWindow::dockWidgetArea() } void tst_QMainWindow::saveState() -{ DEPENDS_ON("restoreState()"); } +{ + DEPENDS_ON("restoreState()"); +} void tst_QMainWindow::restoreState() { @@ -1792,10 +1811,14 @@ void tst_QMainWindow::saveRestore() } void tst_QMainWindow::iconSizeChanged() -{ DEPENDS_ON("iconSize()"); } +{ + DEPENDS_ON("iconSize()"); +} void tst_QMainWindow::toolButtonStyleChanged() -{ DEPENDS_ON("toolButtonStyle()"); } +{ + DEPENDS_ON("toolButtonStyle()"); +} void tst_QMainWindow::isSeparator() { diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 2a17282ad..311114d3e 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -412,7 +412,8 @@ void tst_QMenu::overrideMenuAction() void tst_QMenu::statusTip() { - //check that the statustip of actions inserted into the menu are displayed +#ifndef QT_NO_STATUSBAR + // check that the statustip of actions inserted into the menu are displayed QMainWindow w; connect(w.statusBar(), SIGNAL(messageChanged(const QString &)), SLOT(onStatusMessageChanged(const QString &)));; //creates the status bar QToolBar tb; @@ -439,6 +440,9 @@ void tst_QMenu::statusTip() QTimer::singleShot(200,this, SLOT(onStatusTipTimer())); btn->showMenu(); QVERIFY(statustip.isEmpty()); +#else // QT_NO_STATUSBAR + QSKIP("Katie compiled without statusbar support (QT_NO_STATUSBAR)", SkipAll); +#endif // QT_NO_STATUSBAR } //2nd part of the test diff --git a/tests/auto/qstatusbar/tst_qstatusbar.cpp b/tests/auto/qstatusbar/tst_qstatusbar.cpp index 3f31a4fdb..1ceb76925 100644 --- a/tests/auto/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/qstatusbar/tst_qstatusbar.cpp @@ -30,8 +30,10 @@ #include "../../shared/util.h" -//TESTED_CLASS= -//TESTED_FILES= +// TESTED_CLASS= +// TESTED_FILES= + +#ifndef QT_NO_STATUSBAR class tst_QStatusBar: public QObject { @@ -311,3 +313,9 @@ void tst_QStatusBar::QTBUG25492_msgtimeout() QTEST_MAIN(tst_QStatusBar) #include "moc_tst_qstatusbar.cpp" + +#else // QT_NO_STATUSBAR + +QTEST_NOOP_MAIN + +#endif // QT_NO_STATUSBAR -- 2.11.0