REMOVE old QT<= 5.14 code
Ubuntu 22.04 use qt 1.15.3. In the code is still used qt code <5.10. A cleanup was done by removing qT code version used in ubuntu 18.04.
This commit is contained in:
@@ -57,9 +57,6 @@ using DU = DrawUtil;
|
||||
LineGenerator::LineGenerator()
|
||||
{
|
||||
reloadDescriptions();
|
||||
// m_elementDefs = loadElements();
|
||||
// m_lineDefs = getLineDefinitions();
|
||||
// m_lineDescs = getLineDescriptions();
|
||||
}
|
||||
|
||||
void LineGenerator::reloadDescriptions()
|
||||
@@ -73,8 +70,6 @@ void LineGenerator::reloadDescriptions()
|
||||
//! we prefer to use the ISO Line Number if available.
|
||||
QPen LineGenerator::getBestPen(size_t isoNumber, Qt::PenStyle qtStyle, double width)
|
||||
{
|
||||
// Base::Console().Message("DLG::getBestPen((%d, %d, %.3f)\n",
|
||||
// isoNumber, qtStyle, width);
|
||||
// TODO: use TechDraw::LineFormat::InvalidLine here
|
||||
if (isoNumber > 0 &&
|
||||
isoNumber < m_lineDefs.size()) {
|
||||
@@ -160,11 +155,7 @@ QPen LineGenerator::getLinePen(size_t lineNumber, double nominalLineWidth)
|
||||
dashPattern.push_back(static_cast< double >(m_elementDefs[entry]) / proportionalAdjust);
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
QVector<double> qDashPattern = QVector<double>::fromStdVector(dashPattern);
|
||||
#else
|
||||
QVector<double> qDashPattern(dashPattern.begin(), dashPattern.end());
|
||||
#endif
|
||||
|
||||
linePen.setDashPattern(qDashPattern);
|
||||
linePen.setWidthF(nominalLineWidth);
|
||||
@@ -175,8 +166,6 @@ QPen LineGenerator::getLinePen(size_t lineNumber, double nominalLineWidth)
|
||||
//! convert Qt line style to closest ISO line number
|
||||
int LineGenerator::fromQtStyle(Qt::PenStyle style)
|
||||
{
|
||||
// Base::Console().Message("DLG::fromQtStyle(%d)\n", style);
|
||||
|
||||
// the 4 standard Qt::PenStyles and ISO128 equivalents
|
||||
int dashed = 2;
|
||||
int dotted = 7;
|
||||
@@ -221,7 +210,6 @@ int LineGenerator::fromQtStyle(Qt::PenStyle style)
|
||||
//! ANSI Y14.2 standards file
|
||||
std::map<std::string, int> LineGenerator::loadElements()
|
||||
{
|
||||
// Base::Console().Message("DLG::loadElements()\n");
|
||||
std::map<std::string, int> result;
|
||||
// open file, for each record, parse element name and length, then insert into
|
||||
// the output map.
|
||||
@@ -252,7 +240,6 @@ std::map<std::string, int> LineGenerator::loadElements()
|
||||
//! load the line definition file into memory
|
||||
std::vector< std::vector<std::string> > LineGenerator::getLineDefinitions()
|
||||
{
|
||||
// Base::Console().Message("DLG::loadLineDefinitions()\n");
|
||||
std::vector< std::vector<std::string> > lineDefs;
|
||||
std::string record;
|
||||
Base::FileInfo fi(Preferences::currentLineDefFile());
|
||||
|
||||
@@ -199,7 +199,6 @@ void QGSPage::addChildrenToPage()
|
||||
matchSceneRectToTemplate();
|
||||
}
|
||||
|
||||
// viewAll();
|
||||
}
|
||||
|
||||
//********** template related routines *********
|
||||
@@ -251,7 +250,6 @@ QPointF QGSPage::getTemplateCenter()
|
||||
|
||||
void QGSPage::matchSceneRectToTemplate()
|
||||
{
|
||||
// Base::Console().Message("QGSP::matchSceneRectToTemplate()\n");
|
||||
App::DocumentObject* obj = m_vpPage->getDrawPage()->Template.getValue();
|
||||
auto pageTemplate(dynamic_cast<TechDraw::DrawTemplate*>(obj));
|
||||
if (pageTemplate) {
|
||||
@@ -264,7 +262,6 @@ void QGSPage::matchSceneRectToTemplate()
|
||||
|
||||
void QGSPage::setPageTemplate(TechDraw::DrawTemplate* templateFeat)
|
||||
{
|
||||
// Base::Console().Message("QGSP::setPageTemplate()\n");
|
||||
removeTemplate();
|
||||
|
||||
if (templateFeat->isDerivedFrom<TechDraw::DrawParametricTemplate>()) {
|
||||
@@ -869,7 +866,6 @@ bool QGSPage::hasQView(App::DocumentObject* obj)
|
||||
|
||||
void QGSPage::refreshViews()
|
||||
{
|
||||
// Base::Console().Message("QGSP::refreshViews()\n");
|
||||
QList<QGraphicsItem*> list = items();
|
||||
QList<QGraphicsItem*> qgiv;
|
||||
//find only QGIV's
|
||||
@@ -1197,16 +1193,10 @@ void QGSPage::postProcessXml(QTemporaryFile& temporaryFile, QString fileName, QS
|
||||
QStringLiteral("stroke: none;"));
|
||||
|
||||
// Scale the template group correctly
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
templateGroup.setAttribute(
|
||||
QStringLiteral("transform"),
|
||||
QString().sprintf("scale(%f, %f)", Rez::guiX(1.0), Rez::guiX(1.0)));
|
||||
#else
|
||||
templateGroup.setAttribute(QStringLiteral("transform"),
|
||||
QStringLiteral("scale(%1, %2)")
|
||||
.arg(Rez::guiX(1.0), 0, 'f')
|
||||
.arg(Rez::guiX(1.0), 0, 'f'));
|
||||
#endif
|
||||
|
||||
// Finally, transfer all template document child nodes under the template group
|
||||
while (!templateDocElem.firstChild().isNull()) {
|
||||
|
||||
@@ -233,7 +233,6 @@ void QGVPage::initNavigationStyle()
|
||||
|
||||
void QGVPage::setNavigationStyle(std::string navParm)
|
||||
{
|
||||
// Base::Console().Message("QGVP::setNavigationStyle(%s)\n", navParm.c_str());
|
||||
if (m_navStyle) {
|
||||
delete m_navStyle;
|
||||
}
|
||||
@@ -309,15 +308,10 @@ void QGVPage::deactivateHandler()
|
||||
|
||||
void QGVPage::startBalloonPlacing(DrawView* parent)
|
||||
{
|
||||
// Base::Console().Message("QGVP::startBalloonPlacing(%s)\n", parent->getNameInDocument());
|
||||
balloonPlacing = true;
|
||||
m_balloonParent = parent;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
activateCursor(
|
||||
QCursor(balloonCursor->pixmap(Qt::ReturnByValue), balloonHotspot.x(), balloonHotspot.y()));
|
||||
#else
|
||||
activateCursor(QCursor(*balloonCursor->pixmap(), balloonHotspot.x(), balloonHotspot.y()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void QGVPage::cancelBalloonPlacing()
|
||||
@@ -339,7 +333,6 @@ void QGVPage::drawBackground(QPainter* painter, const QRectF&)
|
||||
}
|
||||
|
||||
if (!m_vpPage->getDrawPage()) {
|
||||
// Base::Console().Message("QGVP::drawBackground - no Page Feature!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -697,7 +690,7 @@ static QCursor createCursor(QBitmap &bitmap, QBitmap &mask, int hotX, int hotY,
|
||||
#else
|
||||
Q_UNUSED(dpr)
|
||||
#endif
|
||||
#if defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(6,6,0) && QT_VERSION >= QT_VERSION_CHECK(5,13,0)
|
||||
#if defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(6,6,0)
|
||||
if (qGuiApp->platformName() == QLatin1String("wayland")) {
|
||||
QImage img = bitmap.toImage();
|
||||
img.convertTo(QImage::Format_ARGB32);
|
||||
|
||||
@@ -158,11 +158,7 @@ void TaskCenterLine::setUiConnect()
|
||||
connect(ui->qsbHorizShift, qOverload<double>(&QuantitySpinBox::valueChanged), this, &TaskCenterLine::onShiftHorizChanged);
|
||||
connect(ui->qsbExtend, qOverload<double>(&QuantitySpinBox::valueChanged), this, &TaskCenterLine::onExtendChanged);
|
||||
connect(ui->qsbRotate, qOverload<double>(&QuantitySpinBox::valueChanged), this, &TaskCenterLine::onRotationChanged);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(ui->bgOrientation, qOverload<int>(&QButtonGroup::buttonClicked), this, &TaskCenterLine::onOrientationChanged);
|
||||
#else
|
||||
connect(ui->bgOrientation, &QButtonGroup::idClicked, this, &TaskCenterLine::onOrientationChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TaskCenterLine::setUiPrimary()
|
||||
@@ -449,7 +445,6 @@ void TaskCenterLine::createCenterLine()
|
||||
|
||||
void TaskCenterLine::updateOrientation()
|
||||
{
|
||||
// Base::Console().Message("TCL::updateOrientation()\n");
|
||||
if (!m_cl) {
|
||||
return;
|
||||
}
|
||||
@@ -613,7 +608,6 @@ TaskDlgCenterLine::~TaskDlgCenterLine()
|
||||
|
||||
void TaskDlgCenterLine::update()
|
||||
{
|
||||
// widget->updateTask();
|
||||
}
|
||||
|
||||
void TaskDlgCenterLine::modifyStandardButtons(QDialogButtonBox* box)
|
||||
|
||||
@@ -112,13 +112,9 @@ void TaskProjGroup::connectWidgets()
|
||||
connect(ui->sbScaleDen, qOverload<int>(&QSpinBox::valueChanged), this, &TaskProjGroup::scaleManuallyChanged);
|
||||
|
||||
// Slot for Projection Type (layout)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(ui->projection, qOverload<const QString&>(&QComboBox::currentIndexChanged), this, &TaskProjGroup::projectionTypeChanged);
|
||||
#else
|
||||
connect(ui->projection, qOverload<int>(&QComboBox::currentIndexChanged), this, [this](int index) {
|
||||
projectionTypeChanged(ui->projection->itemText(index));
|
||||
});
|
||||
#endif
|
||||
|
||||
// Spacing
|
||||
connect(ui->cbAutoDistribute, &QPushButton::clicked, this, &TaskProjGroup::AutoDistributeClicked);
|
||||
|
||||
@@ -63,12 +63,7 @@ using namespace TechDraw;
|
||||
MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
m_lastBlockList = nullptr;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||
f_textedit->setTabStopWidth(40);
|
||||
#else
|
||||
f_textedit->setTabStopDistance(40);
|
||||
#endif
|
||||
// setDefFontSize(getDefFontSizeNum());
|
||||
setDefFontSize(TechDrawGui::PreferencesGui::labelFontSizePX());
|
||||
m_defFont = getDefFont().family();
|
||||
f_textedit->setFont(getDefFont());
|
||||
@@ -204,15 +199,10 @@ MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent)
|
||||
for(int size: sizes) {
|
||||
f_fontsize->addItem(QString::number(size));
|
||||
}
|
||||
//TODO: void QComboBox::setEditText(const QString &text) to " " when multiple select
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(f_fontsize, qOverload<const QString&>(&QComboBox::currentIndexChanged),
|
||||
this, &MRichTextEdit::textSize);
|
||||
#else
|
||||
|
||||
connect(f_fontsize, qOverload<int>(&QComboBox::currentIndexChanged), this, [this](int index) {
|
||||
textSize(f_fontsize->itemText(index));
|
||||
});
|
||||
#endif
|
||||
|
||||
// text foreground color
|
||||
|
||||
@@ -282,9 +272,6 @@ void MRichTextEdit::textRemoveFormat() {
|
||||
fmt.setFontStrikeOut (false);
|
||||
fmt.setFontItalic (false);
|
||||
fmt.setFontPointSize (m_defFontSize);
|
||||
// fmt.setFontFamily ("Helvetica");
|
||||
// fmt.setFontStyleHint (QFont::SansSerif);
|
||||
// fmt.setFontFixedPitch (true);
|
||||
|
||||
f_bold ->setChecked(false);
|
||||
f_underline ->setChecked(false);
|
||||
@@ -292,9 +279,6 @@ void MRichTextEdit::textRemoveFormat() {
|
||||
f_strikeout ->setChecked(false);
|
||||
f_fontsize ->setCurrentIndex(f_fontsize->findText(getDefFontSize()));
|
||||
|
||||
// QTextBlockFormat bfmt = cursor.blockFormat();
|
||||
// bfmt->setIndent(0);
|
||||
|
||||
fmt.clearBackground();
|
||||
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
@@ -428,11 +412,7 @@ void MRichTextEdit::textStyle(int index) {
|
||||
}
|
||||
if (index == ParagraphMonospace) {
|
||||
fmt = cursor.charFormat();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,13,0)
|
||||
fmt.setFontFamily(QString::fromUtf8("Monospace"));
|
||||
#else
|
||||
fmt.setFontFamilies(QStringList() << QString::fromUtf8("Monospace"));
|
||||
#endif
|
||||
fmt.setFontStyleHint(QFont::Monospace);
|
||||
fmt.setFontFixedPitch(true);
|
||||
}
|
||||
@@ -530,7 +510,6 @@ void MRichTextEdit::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
|
||||
}
|
||||
|
||||
void MRichTextEdit::slotCursorPositionChanged() {
|
||||
// qDebug() << "MRTE::slotCursorPositionChanged()";
|
||||
//why do we change text style when selecting text?
|
||||
QTextCursor cursor = f_textedit->textCursor();
|
||||
if (cursor.hasSelection()) { //let selection logic handle this
|
||||
@@ -569,7 +548,6 @@ void MRichTextEdit::slotCursorPositionChanged() {
|
||||
}
|
||||
|
||||
void MRichTextEdit::fontChanged(const QFont &font) {
|
||||
// qDebug() << "MRTE::fontChanged()";
|
||||
//TODO: change this to real font selector
|
||||
f_fontsize->setCurrentIndex(f_fontsize->findText(QString::number(font.pointSize())));
|
||||
f_bold->setChecked(font.bold());
|
||||
@@ -634,14 +612,7 @@ void MRichTextEdit::bgColorChanged(const QColor &color) {
|
||||
}
|
||||
|
||||
void MRichTextEdit::slotCurrentCharFormatChanged(const QTextCharFormat &format) {
|
||||
// qDebug() << "MRTE::slotCurrentCharFormatChanged()";
|
||||
Q_UNUSED(format);
|
||||
//again, why do we do all this just because the cursor moved?
|
||||
//can it be this simple???
|
||||
// fontChanged(format.font());
|
||||
// bgColorChanged((format.background().isOpaque()) ? format.background().color() : QColor());
|
||||
// fgColorChanged((format.foreground().isOpaque()) ? format.foreground().color() : QColor());
|
||||
// f_link->setChecked(format.isAnchor());
|
||||
}
|
||||
|
||||
void MRichTextEdit::slotClipboardDataChanged() {
|
||||
@@ -723,7 +694,6 @@ void MRichTextEdit::onExit()
|
||||
|
||||
void MRichTextEdit::onSelectionChanged()
|
||||
{
|
||||
// qDebug() << "MRTE::onSelectionChanged()";
|
||||
if (hasMultipleSizes()) {
|
||||
f_fontsize->setEditText(QString());
|
||||
f_fontsize->setCurrentIndex(-1);
|
||||
@@ -739,7 +709,6 @@ void MRichTextEdit::onSelectionChanged()
|
||||
//does selection have multiple sizes?
|
||||
bool MRichTextEdit::hasMultipleSizes()
|
||||
{
|
||||
// qDebug() << "MRTE::hasMultipleSizes()";
|
||||
QTextCursor cursor = f_textedit->textCursor();
|
||||
if (cursor.hasSelection()) {
|
||||
int begin = cursor.selectionStart();
|
||||
@@ -767,7 +736,6 @@ bool MRichTextEdit::hasMultipleSizes()
|
||||
|
||||
void MRichTextEdit::setDefFontSize(int fontSize)
|
||||
{
|
||||
// Base::Console().Message("MRTE::setDefFontSize(%d)\n", fs);
|
||||
m_defFontSize = fontSize;
|
||||
m_fontsize_h1 = fontSize + 8;
|
||||
m_fontsize_h2 = fontSize + 6;
|
||||
@@ -787,7 +755,6 @@ void MRichTextEdit::setDefFontSize(int fontSize)
|
||||
|
||||
int MRichTextEdit::getDefFontSizeNum()
|
||||
{
|
||||
// Base::Console().Message("MRTE::getDefFontSizeNum()\n");
|
||||
double fontSize = TechDraw::Preferences::dimFontSizeMM();
|
||||
|
||||
//this conversion is only approximate. the factor changes for different fonts.
|
||||
@@ -799,7 +766,6 @@ int MRichTextEdit::getDefFontSizeNum()
|
||||
|
||||
QString MRichTextEdit::getDefFontSize()
|
||||
{
|
||||
// Base::Console().Message("MRTE::getDefFontSize()\n");
|
||||
return QString::number(getDefFontSizeNum());
|
||||
}
|
||||
|
||||
@@ -823,7 +789,6 @@ QFont MRichTextEdit::getDefFont()
|
||||
// if the conversion factor is float, will generate non-standard sizes
|
||||
void MRichTextEdit::addFontSize(QString fontSize)
|
||||
{
|
||||
// Base::Console().Message("MRTE::addFontSize(%s)\n", qPrintable(fs));
|
||||
QStringList newList;
|
||||
int fsVal = fontSize.toInt();
|
||||
int size = f_fontsize->count();
|
||||
|
||||
Reference in New Issue
Block a user