summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-06-26 13:39:09 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-06-26 23:15:02 +0200
commit65e7303ec906fb64930772a06fed647f41b54391 (patch)
treedcd6bf9b8030c8ebaabdbba0347896722db2f083 /examples/widgets
parente46fb69a87c46e812cc09b3f131462c99aae85d8 (diff)
Move digital clock example to manual test
Pick-to: 6.5 6.6 Change-Id: I043c0060a71d9de2f3e74aab0759d07a20880c3a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/doc/src/digitalclock.qdoc51
-rw-r--r--examples/widgets/widgets/CMakeLists.txt1
-rw-r--r--examples/widgets/widgets/digitalclock/CMakeLists.txt37
-rw-r--r--examples/widgets/widgets/digitalclock/digitalclock.cpp36
-rw-r--r--examples/widgets/widgets/digitalclock/digitalclock.h22
-rw-r--r--examples/widgets/widgets/digitalclock/digitalclock.pro9
-rw-r--r--examples/widgets/widgets/digitalclock/main.cpp14
-rw-r--r--examples/widgets/widgets/widgets.pro1
8 files changed, 0 insertions, 171 deletions
diff --git a/examples/widgets/doc/src/digitalclock.qdoc b/examples/widgets/doc/src/digitalclock.qdoc
deleted file mode 100644
index d24277177f..0000000000
--- a/examples/widgets/doc/src/digitalclock.qdoc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example widgets/digitalclock
- \title Digital Clock Example
- \ingroup examples-widgets
- \brief The Digital Clock example shows how to use QLCDNumber to display a
- number with LCD-like digits.
-
- \borderedimage digitalclock-example.png
- \caption Screenshot of the Digital Clock example
-
- This example also demonstrates how QTimer can be used to update a widget
- at regular intervals.
-
- \section1 DigitalClock Class Definition
-
- The \c DigitalClock class provides a clock widget showing the time with
- hours and minutes separated by a blinking colon. We subclass QLCDNumber
- and implement a private slot called \c showTime() to update the clock
- display:
-
- \snippet widgets/digitalclock/digitalclock.h 0
-
- \section1 DigitalClock Class Implementation
-
- \snippet widgets/digitalclock/digitalclock.cpp 0
-
- In the constructor, we first change the look of the LCD numbers. The
- QLCDNumber::Filled style produces raised segments filled with the
- foreground color (typically black). We also set up a one-second timer
- to keep track of the current time, and we connect
- its \l{QTimer::timeout()}{timeout()} signal to the private \c showTime() slot
- so that the display is updated every second. Then, we
- call the \c showTime() slot; without this call, there would be a one-second
- delay at startup before the time is shown.
-
- \snippet widgets/digitalclock/digitalclock.cpp 1
- \snippet widgets/digitalclock/digitalclock.cpp 2
-
- The \c showTime() slot is called whenever the clock display needs
- to be updated.
-
- The current time is converted into a string with the format "hh:mm".
- When QTime::second() is a even number, the colon in the string is
- replaced with a space. This makes the colon appear and vanish every
- other second.
-
- Finally, we call QLCDNumber::display() to update the widget.
-*/
diff --git a/examples/widgets/widgets/CMakeLists.txt b/examples/widgets/widgets/CMakeLists.txt
index 98b27bd146..a8432644f9 100644
--- a/examples/widgets/widgets/CMakeLists.txt
+++ b/examples/widgets/widgets/CMakeLists.txt
@@ -4,7 +4,6 @@
qt_internal_add_example(analogclock)
qt_internal_add_example(calculator)
qt_internal_add_example(calendarwidget)
-qt_internal_add_example(digitalclock)
qt_internal_add_example(groupbox)
qt_internal_add_example(icons)
qt_internal_add_example(imageviewer)
diff --git a/examples/widgets/widgets/digitalclock/CMakeLists.txt b/examples/widgets/widgets/digitalclock/CMakeLists.txt
deleted file mode 100644
index 57cd80c492..0000000000
--- a/examples/widgets/widgets/digitalclock/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(digitalclock LANGUAGES CXX)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/digitalclock")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_standard_project_setup()
-
-qt_add_executable(digitalclock
- digitalclock.cpp digitalclock.h
- main.cpp
-)
-
-set_target_properties(digitalclock PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(digitalclock PRIVATE
- Qt6::Core
- Qt6::Gui
- Qt6::Widgets
-)
-
-install(TARGETS digitalclock
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/widgets/digitalclock/digitalclock.cpp b/examples/widgets/widgets/digitalclock/digitalclock.cpp
deleted file mode 100644
index 4eec982c25..0000000000
--- a/examples/widgets/widgets/digitalclock/digitalclock.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "digitalclock.h"
-
-#include <QTime>
-#include <QTimer>
-
-//! [0]
-DigitalClock::DigitalClock(QWidget *parent)
- : QLCDNumber(parent)
-{
- setSegmentStyle(Filled);
-
- QTimer *timer = new QTimer(this);
- connect(timer, &QTimer::timeout, this, &DigitalClock::showTime);
- timer->start(1000);
-
- showTime();
-
- setWindowTitle(tr("Digital Clock"));
- resize(150, 60);
-}
-//! [0]
-
-//! [1]
-void DigitalClock::showTime()
-//! [1] //! [2]
-{
- QTime time = QTime::currentTime();
- QString text = time.toString("hh:mm");
- if ((time.second() % 2) == 0)
- text[2] = ' ';
- display(text);
-}
-//! [2]
diff --git a/examples/widgets/widgets/digitalclock/digitalclock.h b/examples/widgets/widgets/digitalclock/digitalclock.h
deleted file mode 100644
index 7b028cb06e..0000000000
--- a/examples/widgets/widgets/digitalclock/digitalclock.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef DIGITALCLOCK_H
-#define DIGITALCLOCK_H
-
-#include <QLCDNumber>
-
-//! [0]
-class DigitalClock : public QLCDNumber
-{
- Q_OBJECT
-
-public:
- DigitalClock(QWidget *parent = nullptr);
-
-private slots:
- void showTime();
-};
-//! [0]
-
-#endif
diff --git a/examples/widgets/widgets/digitalclock/digitalclock.pro b/examples/widgets/widgets/digitalclock/digitalclock.pro
deleted file mode 100644
index 4e4bc0f557..0000000000
--- a/examples/widgets/widgets/digitalclock/digitalclock.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-QT += widgets
-
-HEADERS = digitalclock.h
-SOURCES = digitalclock.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/digitalclock
-INSTALLS += target
diff --git a/examples/widgets/widgets/digitalclock/main.cpp b/examples/widgets/widgets/digitalclock/main.cpp
deleted file mode 100644
index d930e72f23..0000000000
--- a/examples/widgets/widgets/digitalclock/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include <QApplication>
-
-#include "digitalclock.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- DigitalClock clock;
- clock.show();
- return app.exec();
-}
diff --git a/examples/widgets/widgets/widgets.pro b/examples/widgets/widgets/widgets.pro
index 3b3cce7d11..f67184ce63 100644
--- a/examples/widgets/widgets/widgets.pro
+++ b/examples/widgets/widgets/widgets.pro
@@ -2,7 +2,6 @@ TEMPLATE = subdirs
SUBDIRS = analogclock \
calculator \
calendarwidget \
- digitalclock \
groupbox \
icons \
imageviewer \