multi deploy

other qt6 patches
This commit is contained in:
2022-01-31 19:54:19 +03:00
parent bdb2acb414
commit 604441efc3
7 changed files with 54 additions and 32 deletions

View File

@@ -26,11 +26,18 @@ LogView::Category::Category() {
}
void LogView::Category::makeIcon(QSize size, QSize size_icon) {
void LogView::Category::makeIcon(QSize size, QSize size_icon, qreal ratio) {
icon_image = QImage();
if (!image.isNull())
icon_image = image.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
QPixmap px = QPixmap::fromImage(image.scaled(size_icon, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
if (!image.isNull()) {
icon_image = image.scaled(size * ratio, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
icon_image.setDevicePixelRatio(ratio);
#endif
}
QPixmap px = QPixmap::fromImage(image.scaled(size_icon * ratio, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
px.setDevicePixelRatio(ratio);
#endif
icon.addPixmap(px, QIcon::Active);
icon.addPixmap(px, QIcon::Disabled);
icon.addPixmap(px, QIcon::Normal);
@@ -119,7 +126,11 @@ void LogView::registerCategory(const QString & label, QRegularExpression regexp,
c.text_brush = text_brush;
c.background = background;
c.bold = bold;
c.makeIcon(iconImageSize(), preferredIconSize(1., this));
c.makeIcon(iconImageSize(), preferredIconSize(1., this)
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
, devicePixelRatioF()
#endif
);
categories.append(c);
ui->comboCategory->addItem(c.icon, label, QVariant(regexp));
}
@@ -204,7 +215,11 @@ void LogView::changeEvent(QEvent * e) {
ui->labelIconSearch->setFixedSize(preferredIconSize(1.2, this));
QSize is = iconImageSize(), is_i = preferredIconSize(1., this);
for (int i = 0; i < categories.size(); ++i)
categories[i].makeIcon(is, is_i);
categories[i].makeIcon(is, is_i
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
, devicePixelRatioF()
#endif
);
} break;
default: break;
}

View File

@@ -80,7 +80,7 @@ public:
private:
struct QAD_APPLICATION_EXPORT Category {
Category();
void makeIcon(QSize size, QSize size_icon);
void makeIcon(QSize size, QSize size_icon, qreal ratio = 1.);
QString label;
QRegularExpression regexp;
QImage image, icon_image;

View File

@@ -303,9 +303,7 @@ QPIConfig::QPIConfig(const QString & path, QStringList dirs) {
return;
}
dev->close();
#if QT_VERSION_MAJOR > 5
stream.setEncoding(QStringConverter::Utf8);
#endif
setupCodec();
setFileName(cp);
open(QIODevice::ReadOnly);
parse();
@@ -350,16 +348,22 @@ void QPIConfig::setString(QString * str) {
void QPIConfig::setCodec(const char * codecName) {
codec = codecName;
setupCodec();
parse();
}
void QPIConfig::setupCodec() {
#if QT_VERSION_MAJOR <= 5
stream.setCodec(codecName);
stream.setCodec(codec.toLatin1().data());
#else
QString cn = QString(codecName).toLower().remove(' ').remove('-').trimmed();
QString cn = codec.toLower().remove(' ').remove('-').trimmed();
QStringConverter::Encoding sc = QStringConverter::System;
if (cn == "utf8" ) sc = QStringConverter::Utf8 ;
else if (cn == "utf16") sc = QStringConverter::Utf16;
stream.setEncoding(sc);
#endif
parse();
}
@@ -606,10 +610,7 @@ void QPIConfig::writeAll() {
stream.setString(buffer);
buffer->clear();
}
#if QT_VERSION_MAJOR <= 5
if (!codec.isEmpty())
stream.setCodec(codec.toLatin1().data());
#endif
setupCodec();
stream.seek(0);
buildFullNames(&root);
Branch b = allLeaves();
@@ -782,13 +783,10 @@ void QPIConfig::parse(QString content) {
} else {
stream.setString(&content);
}
setupCodec();
stream.seek(0);
other.clear();
lines = centry = 0;
#if QT_VERSION_MAJOR <= 5
if (!codec.isEmpty())
stream.setCodec(codec.toLatin1().data());
#endif
while (!stream.atEnd()) {
other.push_back(QString());
src = str = parseLine(stream.readLine());

View File

@@ -284,6 +284,7 @@ private:
void updateIncludes();
QString parseLine(QString v);
void parse(QString content = QString());
void setupCodec();
int centry;
bool internal;

View File

@@ -132,7 +132,11 @@ bool ImageView::eventFilter(QObject * o, QEvent * e) {
void ImageView::adjustView() {
int nw = map.size().boundedTo(size()).width();
QSize ws = size();
#if QT_VERSION_MAJOR >= 5
ws *= devicePixelRatio();
#endif
int nw = map.size().boundedTo(ws).width();
item.setScale(1.);
if (nw > 0) {
qreal mp = map.width() / nw;

View File

@@ -9,9 +9,11 @@ endif()
set(APP_INFO "Editor for BlockView Blocks")
qad_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_blockview")
if (NOT DEFINED ANDROID_PLATFORM)
if (Qt5_FOUND)
import_version(${PROJECT_NAME}5 ${PROJECT_NAME})
import_deploy_properties(${PROJECT_NAME}5 ${PROJECT_NAME})
deploy_target(${PROJECT_NAME}5 DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release ADD_MANIFEST)
endif()
foreach (_qv_ IN ITEMS 5 6)
if (${LOCAL_FOUND${_qv_}})
import_version(${PROJECT_NAME}${_qv_} ${PROJECT_NAME})
import_deploy_properties(${PROJECT_NAME}${_qv_} ${PROJECT_NAME})
deploy_target(${PROJECT_NAME}${_qv_} DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release ADD_MANIFEST)
endif()
endforeach()
endif()

View File

@@ -12,11 +12,13 @@ if (PIP_FOUND)
set(APP_INFO "Small calculator ang grapher")
qad_application(${PROJECT_NAME} "Gui;Widgets" "qad_graphic;qad_piqt")
if (NOT DEFINED ANDROID_PLATFORM)
if (Qt5_FOUND)
import_version(${PROJECT_NAME}5 ${PROJECT_NAME})
import_deploy_properties(${PROJECT_NAME}5 ${PROJECT_NAME})
deploy_target(${PROJECT_NAME}5 DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release ADD_MANIFEST)
endif()
foreach (_qv_ IN ITEMS 5 6)
if (${LOCAL_FOUND${_qv_}})
import_version(${PROJECT_NAME}${_qv_} ${PROJECT_NAME})
import_deploy_properties(${PROJECT_NAME}${_qv_} ${PROJECT_NAME})
deploy_target(${PROJECT_NAME}${_qv_} DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release ADD_MANIFEST)
endif()
endforeach()
endif()
endif()