Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple Qt example #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aurelienrb
Copy link
Collaborator

@aurelienrb aurelienrb commented Jan 14, 2022

  • I use CMake presets, that help reduce the amount of scripts need in CI, but require a recent CMake version (>= 3.20)
    • typically options such as BUILD_WITH_ASAN etc... are set to ON via a preset dedicated to CI builds
  • Therefore I added a script to install a recent cmake version on Linux distros
    • ./scripts/install_recent_cmake.sh
  • The code should compile with fairly old Qt5 versions and the latest Qt6
    • apt-get install -qq ninja-build qt5-default libqt5x11extras5-dev
  • On Windows with MSVC, a high level of warnings is being configured, and warnings are treated as errors
  • I tried to showcase various aspects to Qt on purpose (rather than using things existing in std C++): text translation, QDirIterator, QtConcurrent, signal/slots in a multithreaded context, embeded resources (images), Qt asserts and logs, ...
  • I applied the clang-format style already exisint in the project
  • I use camelCase convention, in a way quite similar to what Qt does
  • I use a PCH that include many std headers and all QtCore (requires CMake >= 3.16)
  • I was a bit surprised to find the source code in the tools dir rather than a src dir, but why not
  • Basically the demo app allows to:
    • scan (in the background) a folder for some log file patterns (*.log, log*.txt)
    • read those files (in the background) in order to count their number of lines
    • highlight in red the files that contain the word "error" in their name
    • select one of those file (mark it in bold) and display its content in a basic text editor (read only)

screen

IMO, a key element in such an application is the text viewer. here I use a QTextEdit, but for a real log viewer app this class is not powerful enough, in terms of capacity to display huge log files, line numbers, customize line colors, etc... So I think a special widget has to be developed for that purpose. And I think it will apply to any GUI toolkit being used. And it can be a tricky task depending on the toolkit being used. I managed to quickly do a skeleton with Qt, with very good performances. But failed with Dear ImGui. I think OpenGL based toolkits are not well suited to build such text intensive widgets. At least that's the feeling I got from my experiments.

@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.20)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake 3.20 required for the presets

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is aligned and serve as a example towards showing up a time-series of events.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meged it in my fork mm-s/DebugVision.git

@mm-s
Copy link
Collaborator

mm-s commented Jan 14, 2022

I think this is aligned and serve as a example towards showing up a time-series of events.
Merged in mm-s/DebugVision

@mm-s
Copy link
Collaborator

mm-s commented Jan 15, 2022

  Could not find a package configuration file provided by "QT" with any of
  the following names:

    Qt6Config.cmake
...

Cmake should write an include file called config.h defining the macro
HAVE_QT 1|0

writing 0 or 1 depending on whether qt is available in the system or not, or --without-qt is selected

At most CMake shall report that the system is configured without Qt, but currently it fails with error

@aurelienrb
Copy link
Collaborator Author

At most CMake shall report that the system is configured without Qt, but currently it fails with error

It can, but I configured the search for Qt to be REQUIRED
I should be able to allow it to ignore the failure and then fail gracefully with a manual message asking to install it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants