-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from QtRVSim-team/qt6
Qt6
- Loading branch information
Showing
26 changed files
with
288 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,48 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(svgscene) | ||
|
||
find_package(Qt5 | ||
REQUIRED COMPONENTS Core Widgets Gui) | ||
|
||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) | ||
# Normally, we would use variable Qt5 or Qt6 to reference the Qt library. Here we do that through | ||
# this variable based on detected version major of Qt. | ||
set(QtLib "Qt${QT_VERSION_MAJOR}") | ||
find_package(${QtLib} | ||
REQUIRED COMPONENTS Core Widgets Gui) | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_AUTOUIC ON) | ||
|
||
add_library(svgscene STATIC | ||
src/svgscene/components/groupitem.cpp | ||
src/svgscene/components/groupitem.h | ||
src/svgscene/components/hyperlinkitem.cpp | ||
src/svgscene/components/hyperlinkitem.h | ||
src/svgscene/components/simpletextitem.cpp | ||
src/svgscene/components/simpletextitem.h | ||
src/svgscene/graphicsview/svggraphicsview.cpp | ||
src/svgscene/graphicsview/svggraphicsview.h | ||
src/svgscene/svgdocument.cpp | ||
src/svgscene/svgdocument.h | ||
src/svgscene/svggraphicsscene.cpp | ||
src/svgscene/svggraphicsscene.h | ||
src/svgscene/svghandler.cpp | ||
src/svgscene/svghandler.h | ||
src/svgscene/svgmetadata.cpp | ||
src/svgscene/svgmetadata.h | ||
src/svgscene/svgspec.h | ||
src/svgscene/utils/logging.h | ||
src/svgscene/utils/memory_ownership.h | ||
) | ||
src/svgscene/components/groupitem.cpp | ||
src/svgscene/components/groupitem.h | ||
src/svgscene/components/hyperlinkitem.cpp | ||
src/svgscene/components/hyperlinkitem.h | ||
src/svgscene/components/simpletextitem.cpp | ||
src/svgscene/components/simpletextitem.h | ||
src/svgscene/graphicsview/svggraphicsview.cpp | ||
src/svgscene/graphicsview/svggraphicsview.h | ||
src/svgscene/svgdocument.cpp | ||
src/svgscene/svgdocument.h | ||
src/svgscene/svggraphicsscene.cpp | ||
src/svgscene/svggraphicsscene.h | ||
src/svgscene/svghandler.cpp | ||
src/svgscene/svghandler.h | ||
src/svgscene/svgmetadata.cpp | ||
src/svgscene/svgmetadata.h | ||
src/svgscene/svgspec.h | ||
src/svgscene/utils/logging.h | ||
src/svgscene/utils/memory_ownership.h | ||
) | ||
target_link_libraries(svgscene | ||
PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets) | ||
PRIVATE ${QtLib}::Core ${QtLib}::Gui ${QtLib}::Widgets) | ||
target_include_directories(svgscene PUBLIC src PRIVATE src/svgscene) | ||
|
||
add_executable(svgscene-example EXCLUDE_FROM_ALL | ||
src/example/main.cpp | ||
src/example/mainwindow.cpp | ||
src/example/mainwindow.h | ||
src/example/mainwindow.ui | ||
) | ||
src/example/main.cpp | ||
src/example/mainwindow.cpp | ||
src/example/mainwindow.h | ||
src/example/mainwindow.ui | ||
) | ||
target_link_libraries(svgscene-example | ||
PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets svgscene) | ||
PRIVATE ${QtLib}::Core ${QtLib}::Gui ${QtLib}::Widgets svgscene) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef POLYFILLS_QFONTMETRICS_H | ||
#define POLYFILLS_QFONTMETRICS_H | ||
|
||
int QFontMetrics_horizontalAdvance(const QFontMetrics &self, const QString &str, int len = -1) { | ||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) | ||
return self.horizontalAdvance(str, len); | ||
#else | ||
return self.width(str, len); | ||
#endif | ||
} | ||
|
||
#endif // QTMIPS_QFONTMETRICS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef POLYFILLS_QLINEF_H | ||
#define POLYFILLS_QLINEF_H | ||
|
||
#include <QLine> | ||
|
||
QLineF::IntersectType | ||
QLineF_intersect(const QLineF &l1, const QLineF &l2, QPointF *intersectionPoint) { | ||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) | ||
return l1.intersects(l2, intersectionPoint); | ||
#else | ||
return l1.intersect(l2, intersectionPoint); | ||
#endif | ||
} | ||
|
||
#endif // QTMIPS_QLINEF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef POLYFILLS_QTABLEVIEW_H | ||
#define POLYFILLS_QTABLEVIEW_H | ||
|
||
#include <QTableView> | ||
|
||
/** | ||
* QTableView polyfill | ||
* | ||
* initViewItemOption is protected, therefore the whole class needs to be wrapped. | ||
*/ | ||
class Poly_QTableView : public QTableView { | ||
public: | ||
explicit Poly_QTableView(QWidget *parent) : QTableView(parent) {} | ||
|
||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) | ||
protected: | ||
void initViewItemOption(QStyleOptionViewItem *viewOpts) { | ||
*viewOpts = QTableView::viewOptions(); | ||
} | ||
#endif | ||
}; | ||
|
||
#endif // QTMIPS_QTABLEVIEW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.