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,16 +70,23 @@ 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}")
#message("Qt${_v} -> ${LOCAL_FOUND${_v}}")
if (LOCAL_FOUND${_v})
list(APPEND QtVersions Qt${_v})
set(SomeQtFound 1)
endif()
endif()
endforeach()
add_subdirectory(pip)
set(_DIRS)
if (SomeQtFound)
message(STATUS "Building Qt-derived targets for ${QtVersions}")
add_subdirectory(qad)
set(_DIRS piqt piqt_utils qcd_utils)
@@ -87,8 +94,11 @@ if (QGLVIEW)
list(APPEND _DIRS qglview)
endif()
foreach(_D ${_DIRS})
list(APPEND QT_MULTILIB_LIST ${D})
list(APPEND QT_MULTILIB_LIST ${_D})
endforeach(_D)
else()
message(STATUS "None of Qt found, skip Qt-derived targets")
endif()
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})
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)

View File

@@ -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));

View File

@@ -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<int>(qRound(fontMetrics().size(0, "0").height() / 15.), 1);
thick = lineThickness();
adjustThumb();
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);
widget_props->setEnabled(false);
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);
QStringList styles;
styles << tr("NoPen") << tr("Solid") << tr("Dash")

View File

@@ -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<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) buffer = new QImage(wid, hei, QImage::Format_RGB32);
if (bufferActive) {

View File

@@ -1,4 +1,5 @@
#include "graphic_conf.h"
#include "qad_types.h"
#include "ui_graphic_conf.h"
@@ -7,7 +8,7 @@ GraphicConf::GraphicConf(QVector<GraphicType> & graphics_, QWidget * parent): QD
ui->setupUi(this);
QStringList styles;
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);
styles << tr("NoPen") << tr("Solid") << tr("Dash")
<< 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 <QApplication>
#include <QFontMetrics>
__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<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);
QString uniqueName(QString n, const QStringList & names);
int lineThickness();
#endif // QAD_TYPES_H