Add library 'QtComponets'.

This commit is contained in:
amass 2023-08-13 15:05:35 +08:00
parent 5d8e1888f0
commit 595ee7f98e
6 changed files with 121 additions and 2 deletions

View File

@ -11,4 +11,5 @@ set(ZeroMQ_LIBRARIES zmq)
add_subdirectory(AsioZeroMQ)
add_subdirectory(Encrypt)
add_subdirectory(HttpProxy)
add_subdirectory(QtComponets)
add_subdirectory(Universal)

View File

@ -7,6 +7,7 @@
#include <boost/url/grammar/range_rule.hpp>
#include <boost/url/grammar/tuple_rule.hpp>
#include <boost/url/pct_string_view.hpp>
#include <boost/url/string_view.hpp>
class TemplateSegment {
friend class TemplateSegmentRule;

View File

@ -0,0 +1,15 @@
find_package(Qt6 COMPONENTS Gui REQUIRED)
set(CMAKE_AUTOMOC ON)
add_library(QtComponets
QClassStdStream.h QClassStdStream.cpp
)
target_include_directories(QtComponets
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(QtComponets
PUBLIC Qt6::Gui
)

View File

@ -0,0 +1,47 @@
#include "QClassStdStream.h"
namespace std {
std::ostream &operator<<(std::ostream &stream, const QSize &element) {
stream << "QSize(" << element.width() << "," << element.height() << ")";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QPoint &element) {
stream << "QPoint(" << element.x() << "," << element.y() << ")";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QPointF &element) {
stream << "QPointF(" << element.x() << "," << element.y() << ")";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QString &element) {
stream << element.toStdString();
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QStringList &element) {
stream << "[";
for (auto &str : element) {
stream << str << ", ";
}
stream << "]";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QImage::Format &element) {
switch (element) {
case QImage::Format_RGB32:
stream << "Format_RGB32";
break;
case QImage::Format_RGBA8888:
stream << "Format_RGBA8888";
break;
default:
stream << "unknown format: " << (int)element;
break;
}
return stream;
}
} // namespace std

View File

@ -0,0 +1,25 @@
#ifndef QCLASSSTDSTREAM_H
#define QCLASSSTDSTREAM_H
#include <QImage>
#include <QString>
#include <QVector3D>
#include <ostream>
namespace std {
inline std::ostream &operator<<(std::ostream &stream, const QVector3D &element) {
stream << "(" << element.x() << "," << element.y() << "," << element.z() << ")";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QString &element);
std::ostream &operator<<(std::ostream &stream, const QStringList &element);
std::ostream &operator<<(std::ostream &stream, const QPoint &element);
std::ostream &operator<<(std::ostream &stream, const QPointF &element);
std::ostream &operator<<(std::ostream &stream, const QSize &element);
std::ostream &operator<<(std::ostream &stream, const QImage::Format &element);
} // namespace std
#endif // QCLASSSTDSTREAM_H

View File

@ -9,6 +9,35 @@ else
fi
echo "build directory: $build_path"
if [ -d "/opt/Qt/6.5.2/gcc_64" ]; then
qt_prefix_path="/opt/Qt/6.5.2/gcc_64"
cmake_qt_parameters="-DCMAKE_PREFIX_PATH=${qt_prefix_path} \
-DQT_QMAKE_EXECUTABLE=${qt_prefix_path}/bin/qmake \
-DQT_DIR=${qt_prefix_path}/lib/cmake/Qt6 \
-DQt6_DIR=${qt_prefix_path}/lib/cmake/Qt6 \
-DQt6Core_DIR=${qt_prefix_path}/lib/cmake/Qt6Core \
-DQt6Gui_DIR=${qt_prefix_path}/lib/cmake/Qt6Gui \
-DQt6Qml_DIR=${qt_prefix_path}/lib/cmake/Qt6Qml \
-DQt6Widgets_DIR=${qt_prefix_path}/lib/cmake/Qt6Widgets \
-DQt6Quick_DIR=${qt_prefix_path}/lib/cmake/Qt6Quick \
-DQt6Svg_DIR=${qt_prefix_path}/lib/cmake/Qt6Svg "
elif [ -d "/opt/Qt/5.15.2/gcc_64" ]; then
qt_prefix_path="/opt/Qt/5.15.2/gcc_64"
cmake_qt_parameters="-DCMAKE_PREFIX_PATH=${qt_prefix_path} \
-DQT_QMAKE_EXECUTABLE=${qt_prefix_path}/bin/qmake \
-DQT_DIR=${qt_prefix_path}/lib/cmake/Qt5 \
-DQt5_DIR=${qt_prefix_path}/lib/cmake/Qt5 \
-DQt5Core_DIR=${qt_prefix_path}/lib/cmake/Qt5Core \
-DQt5Gui_DIR=${qt_prefix_path}/lib/cmake/Qt5Gui \
-DQt5Qml_DIR=${qt_prefix_path}/lib/cmake/Qt5Qml \
-DQt5Widgets_DIR=${qt_prefix_path}/lib/cmake/Qt5Widgets \
-DQt5Quick_DIR=${qt_prefix_path}/lib/cmake/Qt5Quick \
-DQt5Svg_DIR=${qt_prefix_path}/lib/cmake/Qt5Svg "
else
cmake_qt_parameters=""
echo "please install qt6.5.2 or qt5.15.2 ..."
fi
function cmake_scan() {
if [ ! -d ${build_path} ]; then
mkdir ${build_path}
@ -18,8 +47,9 @@ function cmake_scan() {
-S ${base_path} \
-B ${build_path} \
-DCMAKE_BUILD_TYPE=Debug \
-DBOOST_ROOT=${libraries_root}/boost_1_82_0 \
-DZeroMQ_ROOT=${libraries_root}/zeromq-4.3.4_debug
-DBOOST_ROOT=${libraries_root}/boost_1_83_0 \
-DZeroMQ_ROOT=${libraries_root}/zeromq-4.3.4_debug \
${cmake_qt_parameters}
}
function build() {