git-svn-id: svn://db.shs.com.ru/libs@306 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-10-26 21:26:19 +00:00
parent b2b954ccca
commit 0778d092e8
9 changed files with 40 additions and 18 deletions

View File

@@ -70,25 +70,35 @@ endif()
set(QAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qad) set(QAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qad)
include(qad/QtWraps.cmake) include(qad/QtWraps.cmake)
find_qt(Core)
set(QtVersions) set(QtVersions)
set(SomeQtFound 0)
foreach(_v ${_QT_VERSIONS_}) foreach(_v ${_QT_VERSIONS_})
option(Qt${_v} "Build for Qt${_v}" 1) option(Qt${_v} "Build for Qt${_v}" 1)
if (Qt${_v}) if (Qt${_v})
#message("Qt${_v}") #message("Qt${_v} -> ${LOCAL_FOUND${_v}}")
list(APPEND QtVersions Qt${_v}) if (LOCAL_FOUND${_v})
list(APPEND QtVersions Qt${_v})
set(SomeQtFound 1)
endif()
endif() endif()
endforeach() endforeach()
add_subdirectory(pip) add_subdirectory(pip)
message(STATUS "Building Qt-derived targets for ${QtVersions}") set(_DIRS)
add_subdirectory(qad) if (SomeQtFound)
set(_DIRS piqt piqt_utils qcd_utils) message(STATUS "Building Qt-derived targets for ${QtVersions}")
if (QGLVIEW) add_subdirectory(qad)
list(APPEND _DIRS qglview) 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() endif()
foreach(_D ${_DIRS})
list(APPEND QT_MULTILIB_LIST ${D})
endforeach(_D)
list(INSERT _DIRS 0 cd_utils) list(INSERT _DIRS 0 cd_utils)
foreach(_D ${_DIRS}) foreach(_D ${_DIRS})
include_directories(${_D}) include_directories(${_D})
@@ -97,7 +107,9 @@ endforeach(_D)
if(WIN32) if(WIN32)
foreach(PIP_LT ${PIP_LIBS_TARGETS}) 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() endforeach()
set(CMAKES "FindMinGW.cmake") set(CMAKES "FindMinGW.cmake")
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)

View File

@@ -105,7 +105,7 @@ g_main(this), g_selection(this) {
g_selection.setData(1003, true); g_selection.setData(1003, true);
col = Qt::lightGray; col = Qt::lightGray;
_resize(QSizeF(100., 60.)); _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); p.setCosmetic(true);
g_selection.setPen(p); g_selection.setPen(p);
g_selection.setBrush(QColor(128, 128, 255, 32)); g_selection.setBrush(QColor(128, 128, 255, 32));

View File

@@ -81,7 +81,7 @@ void BlockView::_init() {
sel_rect.hide(); sel_rect.hide();
QColor sc = palette().color(QPalette::Highlight); QColor sc = palette().color(QPalette::Highlight);
sc.setAlphaF(0.6); sc.setAlphaF(0.6);
QPen pen(sc.darker(200), 2., Qt::DotLine); QPen pen(sc.darker(200), lineThickness() + 1., Qt::DotLine);
pen.setCosmetic(true); pen.setCosmetic(true);
sel_rect.setPen(pen); sel_rect.setPen(pen);
sc.setAlphaF(0.2); sc.setAlphaF(0.2);
@@ -654,7 +654,7 @@ void BlockView::keyPressEvent(QKeyEvent * e) {
void BlockView::resizeEvent(QResizeEvent * event) { void BlockView::resizeEvent(QResizeEvent * event) {
QGraphicsView::resizeEvent(event); QGraphicsView::resizeEvent(event);
thick = qMax<int>(qRound(fontMetrics().size(0, "0").height() / 15.), 1); thick = lineThickness();
adjustThumb(); adjustThumb();
nav_target = _nav(); nav_target = _nav();
} }

View File

@@ -230,7 +230,7 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom(
ui->setupUi(widget_props); ui->setupUi(widget_props);
widget_props->setEnabled(false); widget_props->setEnabled(false);
int fh = qMax<int>(QApplication::fontMetrics().size(0, "0").height(), 22); int fh = qMax<int>(QApplication::fontMetrics().size(0, "0").height(), 22);
int thick = qMax<int>(qRound(QApplication::fontMetrics().size(0, "0").height() / 15.), 1); int thick = lineThickness();
QSize sz(fh * 2.5, fh); QSize sz(fh * 2.5, fh);
QStringList styles; QStringList styles;
styles << tr("NoPen") << tr("Solid") << tr("Dash") styles << tr("NoPen") << tr("Solid") << tr("Dash")

View File

@@ -1,4 +1,5 @@
#include "graphic.h" #include "graphic.h"
#include "qad_types.h"
#include "ui_graphic.h" #include "ui_graphic.h"
#include "ui_graphic_conf.h" #include "ui_graphic_conf.h"
#if QT_VERSION >= 0x050100 #if QT_VERSION >= 0x050100
@@ -204,7 +205,7 @@ void Graphic::canvasPaintEvent() {
font_sz = fontMetrics().size(0, "0"); font_sz = fontMetrics().size(0, "0");
font_sz.setHeight(font_sz.height() * 1.); font_sz.setHeight(font_sz.height() * 1.);
font_sz.setWidth(font_sz.width() * 8); font_sz.setWidth(font_sz.width() * 8);
thick = qMax<int>(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) if (buffer->width() != wid || buffer->height() != hei) {delete buffer; buffer = 0;}
if (buffer == 0) buffer = new QImage(wid, hei, QImage::Format_RGB32); if (buffer == 0) buffer = new QImage(wid, hei, QImage::Format_RGB32);
if (bufferActive) { if (bufferActive) {

View File

@@ -1,4 +1,5 @@
#include "graphic_conf.h" #include "graphic_conf.h"
#include "qad_types.h"
#include "ui_graphic_conf.h" #include "ui_graphic_conf.h"
@@ -7,7 +8,7 @@ GraphicConf::GraphicConf(QVector<GraphicType> & graphics_, QWidget * parent): QD
ui->setupUi(this); ui->setupUi(this);
QStringList styles; QStringList styles;
int fh = qMax<int>(fontMetrics().size(0, "0").height(), 22); int fh = qMax<int>(fontMetrics().size(0, "0").height(), 22);
int thick = qMax<int>(qRound(fontMetrics().size(0, "0").height() / 15.), 1); int thick = lineThickness();
QSize sz(fh * 2.5, fh); QSize sz(fh * 2.5, fh);
styles << tr("NoPen") << tr("Solid") << tr("Dash") styles << tr("NoPen") << tr("Solid") << tr("Dash")
<< tr("Dot") << tr("Dash-Dot") << tr("Dash-Dot-Dot"); << tr("Dot") << tr("Dash-Dot") << tr("Dash-Dot-Dot");

View File

@@ -1 +1 @@
qad_project(utils "Gui" "") qad_project(utils "Gui;Widgets" "")

View File

@@ -1,4 +1,6 @@
#include "qad_types.h" #include "qad_types.h"
#include <QApplication>
#include <QFontMetrics>
__QADTypesRegistrator__ __registrator__; __QADTypesRegistrator__ __registrator__;
@@ -121,3 +123,8 @@ QString uniqueName(QString n, const QStringList & names) {
nn = n + QString::number(++in).rightJustified(3, '0'); nn = n + QString::number(++in).rightJustified(3, '0');
return nn; return nn;
} }
int lineThickness() {
return qMax<int>(qRound(QApplication::fontMetrics().size(0, "0").height() / 15.), 1);
}

View File

@@ -117,6 +117,7 @@ inline QRectF enlargedRect(const QRectF & r, qreal dx, qreal dy, qreal v) {
QVariant::Type typeFromLetter(const QString & l); QVariant::Type typeFromLetter(const QString & l);
QString uniqueName(QString n, const QStringList & names); QString uniqueName(QString n, const QStringList & names);
int lineThickness();
#endif // QAD_TYPES_H #endif // QAD_TYPES_H