diff --git a/CMakeLists.txt b/CMakeLists.txt index abc90a4..7cdcd39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,25 +70,35 @@ endif() set(QAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qad) include(qad/QtWraps.cmake) +find_qt(Core) set(QtVersions) +set(SomeQtFound 0) foreach(_v ${_QT_VERSIONS_}) option(Qt${_v} "Build for Qt${_v}" 1) if (Qt${_v}) - #message("Qt${_v}") - list(APPEND QtVersions Qt${_v}) + #message("Qt${_v} -> ${LOCAL_FOUND${_v}}") + if (LOCAL_FOUND${_v}) + list(APPEND QtVersions Qt${_v}) + set(SomeQtFound 1) + endif() endif() endforeach() add_subdirectory(pip) -message(STATUS "Building Qt-derived targets for ${QtVersions}") -add_subdirectory(qad) -set(_DIRS piqt piqt_utils qcd_utils) -if (QGLVIEW) - list(APPEND _DIRS qglview) +set(_DIRS) +if (SomeQtFound) + message(STATUS "Building Qt-derived targets for ${QtVersions}") + add_subdirectory(qad) + set(_DIRS piqt piqt_utils qcd_utils) + if (QGLVIEW) + list(APPEND _DIRS qglview) + endif() + foreach(_D ${_DIRS}) + list(APPEND QT_MULTILIB_LIST ${_D}) + endforeach(_D) +else() + message(STATUS "None of Qt found, skip Qt-derived targets") endif() -foreach(_D ${_DIRS}) - list(APPEND QT_MULTILIB_LIST ${D}) -endforeach(_D) list(INSERT _DIRS 0 cd_utils) foreach(_D ${_DIRS}) include_directories(${_D}) @@ -97,7 +107,9 @@ endforeach(_D) if(WIN32) foreach(PIP_LT ${PIP_LIBS_TARGETS}) - qt_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pip/lib${PIP_LT}.dll" DESTINATION QtBin) + if (SomeQtFound) + qt_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pip/lib${PIP_LT}.dll" DESTINATION QtBin) + endif() endforeach() set(CMAKES "FindMinGW.cmake") install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) diff --git a/qad/blockview/blockitem.cpp b/qad/blockview/blockitem.cpp index 474559f..8e3bcdf 100644 --- a/qad/blockview/blockitem.cpp +++ b/qad/blockview/blockitem.cpp @@ -105,7 +105,7 @@ g_main(this), g_selection(this) { g_selection.setData(1003, true); col = Qt::lightGray; _resize(QSizeF(100., 60.)); - QPen p(QColor(128, 128, 255), 1., Qt::DotLine); + QPen p(QColor(128, 128, 255), lineThickness(), Qt::DotLine); p.setCosmetic(true); g_selection.setPen(p); g_selection.setBrush(QColor(128, 128, 255, 32)); diff --git a/qad/blockview/blockview.cpp b/qad/blockview/blockview.cpp index 528c7e0..22e6a6f 100644 --- a/qad/blockview/blockview.cpp +++ b/qad/blockview/blockview.cpp @@ -81,7 +81,7 @@ void BlockView::_init() { sel_rect.hide(); QColor sc = palette().color(QPalette::Highlight); sc.setAlphaF(0.6); - QPen pen(sc.darker(200), 2., Qt::DotLine); + QPen pen(sc.darker(200), lineThickness() + 1., Qt::DotLine); pen.setCosmetic(true); sel_rect.setPen(pen); sc.setAlphaF(0.2); @@ -654,7 +654,7 @@ void BlockView::keyPressEvent(QKeyEvent * e) { void BlockView::resizeEvent(QResizeEvent * event) { QGraphicsView::resizeEvent(event); - thick = qMax(qRound(fontMetrics().size(0, "0").height() / 15.), 1); + thick = lineThickness(); adjustThumb(); nav_target = _nav(); } diff --git a/qad/blockview/drawtools.cpp b/qad/blockview/drawtools.cpp index 3c40b7d..3bad348 100644 --- a/qad/blockview/drawtools.cpp +++ b/qad/blockview/drawtools.cpp @@ -230,7 +230,7 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom( ui->setupUi(widget_props); widget_props->setEnabled(false); int fh = qMax(QApplication::fontMetrics().size(0, "0").height(), 22); - int thick = qMax(qRound(QApplication::fontMetrics().size(0, "0").height() / 15.), 1); + int thick = lineThickness(); QSize sz(fh * 2.5, fh); QStringList styles; styles << tr("NoPen") << tr("Solid") << tr("Dash") diff --git a/qad/graphic/graphic.cpp b/qad/graphic/graphic.cpp index 0db6d40..85b7ac6 100644 --- a/qad/graphic/graphic.cpp +++ b/qad/graphic/graphic.cpp @@ -1,4 +1,5 @@ #include "graphic.h" +#include "qad_types.h" #include "ui_graphic.h" #include "ui_graphic_conf.h" #if QT_VERSION >= 0x050100 @@ -204,7 +205,7 @@ void Graphic::canvasPaintEvent() { font_sz = fontMetrics().size(0, "0"); font_sz.setHeight(font_sz.height() * 1.); font_sz.setWidth(font_sz.width() * 8); - thick = qMax(qRound(font_sz.height() / 15.), 1); + thick = lineThickness(); if (buffer != 0) if (buffer->width() != wid || buffer->height() != hei) {delete buffer; buffer = 0;} if (buffer == 0) buffer = new QImage(wid, hei, QImage::Format_RGB32); if (bufferActive) { diff --git a/qad/graphic/graphic_conf.cpp b/qad/graphic/graphic_conf.cpp index ae88331..265e64f 100644 --- a/qad/graphic/graphic_conf.cpp +++ b/qad/graphic/graphic_conf.cpp @@ -1,4 +1,5 @@ #include "graphic_conf.h" +#include "qad_types.h" #include "ui_graphic_conf.h" @@ -7,7 +8,7 @@ GraphicConf::GraphicConf(QVector & graphics_, QWidget * parent): QD ui->setupUi(this); QStringList styles; int fh = qMax(fontMetrics().size(0, "0").height(), 22); - int thick = qMax(qRound(fontMetrics().size(0, "0").height() / 15.), 1); + int thick = lineThickness(); QSize sz(fh * 2.5, fh); styles << tr("NoPen") << tr("Solid") << tr("Dash") << tr("Dot") << tr("Dash-Dot") << tr("Dash-Dot-Dot"); diff --git a/qad/utils/CMakeLists.txt b/qad/utils/CMakeLists.txt index 575dec2..c6c681c 100644 --- a/qad/utils/CMakeLists.txt +++ b/qad/utils/CMakeLists.txt @@ -1 +1 @@ -qad_project(utils "Gui" "") +qad_project(utils "Gui;Widgets" "") diff --git a/qad/utils/qad_types.cpp b/qad/utils/qad_types.cpp index 76a5394..e925f31 100644 --- a/qad/utils/qad_types.cpp +++ b/qad/utils/qad_types.cpp @@ -1,4 +1,6 @@ #include "qad_types.h" +#include +#include __QADTypesRegistrator__ __registrator__; @@ -121,3 +123,8 @@ QString uniqueName(QString n, const QStringList & names) { nn = n + QString::number(++in).rightJustified(3, '0'); return nn; } + + +int lineThickness() { + return qMax(qRound(QApplication::fontMetrics().size(0, "0").height() / 15.), 1); +} diff --git a/qad/utils/qad_types.h b/qad/utils/qad_types.h index ef4d16f..7186ff7 100644 --- a/qad/utils/qad_types.h +++ b/qad/utils/qad_types.h @@ -117,6 +117,7 @@ inline QRectF enlargedRect(const QRectF & r, qreal dx, qreal dy, qreal v) { QVariant::Type typeFromLetter(const QString & l); QString uniqueName(QString n, const QStringList & names); +int lineThickness(); #endif // QAD_TYPES_H