Merge pull request #19921 from mosfet80/QT_CLEAN
REMOVE old QT<= 5.14 code
This commit is contained in:
@@ -173,10 +173,10 @@ void TaskFemConstraint::createDeleteAction(QListWidget* parentList)
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
deleteAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
deleteAction->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
|
||||
parentList->addAction(deleteAction);
|
||||
parentList->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/QtTools.h>
|
||||
#include <Base/Quantity.h>
|
||||
#include <Gui/MetaTypes.h>
|
||||
|
||||
|
||||
@@ -199,16 +199,6 @@ void DlgDisplayPropertiesImp::setupFilters()
|
||||
|
||||
void DlgDisplayPropertiesImp::setupConnections()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
connect(d->ui.changeMode,
|
||||
qOverload<const QString&>(&QComboBox::activated),
|
||||
this,
|
||||
&DlgDisplayPropertiesImp::onChangeModeActivated);
|
||||
connect(d->ui.changePlot,
|
||||
qOverload<const QString&>(&QComboBox::activated),
|
||||
this,
|
||||
&DlgDisplayPropertiesImp::onChangePlotActivated);
|
||||
#else
|
||||
connect(d->ui.changeMode,
|
||||
&QComboBox::textActivated,
|
||||
this,
|
||||
@@ -217,7 +207,6 @@ void DlgDisplayPropertiesImp::setupConnections()
|
||||
&QComboBox::textActivated,
|
||||
this,
|
||||
&DlgDisplayPropertiesImp::onChangePlotActivated);
|
||||
#endif
|
||||
connect(d->ui.spinTransparency,
|
||||
qOverload<int>(&QSpinBox::valueChanged),
|
||||
this,
|
||||
|
||||
@@ -134,17 +134,12 @@ QString MeasurePosition::getResultString()
|
||||
QString unit = QString::fromStdString(Position.getUnit().getString());
|
||||
int precision = 2;
|
||||
QString text;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
QTextStream(&text) << "X: " << QString::number(value.x, 'f', precision) << " " << unit << endl
|
||||
<< "Y: " << QString::number(value.y, 'f', precision) << " " << unit << endl
|
||||
<< "Z: " << QString::number(value.z, 'f', precision) << " " << unit;
|
||||
#else
|
||||
|
||||
QTextStream(&text) << "X: " << QString::number(value.x, 'f', precision) << " " << unit
|
||||
<< Qt::endl
|
||||
<< "Y: " << QString::number(value.y, 'f', precision) << " " << unit
|
||||
<< Qt::endl
|
||||
<< "Z: " << QString::number(value.z, 'f', precision) << " " << unit;
|
||||
#endif
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,13 +53,8 @@ DlgSmoothing::DlgSmoothing(QWidget* parent)
|
||||
|
||||
connect(ui->checkBoxSelection, &QCheckBox::toggled,
|
||||
this, &DlgSmoothing::onCheckBoxSelectionToggled);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(bg, qOverload<int>(&QButtonGroup::buttonClicked),
|
||||
this, &DlgSmoothing::methodClicked);
|
||||
#else
|
||||
connect(bg, qOverload<int>(&QButtonGroup::idClicked),
|
||||
this, &DlgSmoothing::methodClicked);
|
||||
#endif
|
||||
|
||||
ui->labelLambda->setText(QString::fromUtf8("\xce\xbb"));
|
||||
ui->labelMu->setText(QString::fromUtf8("\xce\xbc"));
|
||||
|
||||
@@ -215,11 +215,7 @@ bool AbstractPrimitive::hasValidPrimitive() const
|
||||
|
||||
void AbstractPrimitive::connectSignalMapper(QSignalMapper* mapper)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(mapper, qOverload<QObject*>(&QSignalMapper::mapped), this, &AbstractPrimitive::changeValue);
|
||||
#else
|
||||
connect(mapper, &QSignalMapper::mappedObject, this, &AbstractPrimitive::changeValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace PartGui {
|
||||
|
||||
@@ -122,13 +122,8 @@ ShapeBuilderWidget::ShapeBuilderWidget(QWidget* parent)
|
||||
this, &ShapeBuilderWidget::onSelectButtonClicked);
|
||||
connect(d->ui.createButton, &QPushButton::clicked,
|
||||
this, &ShapeBuilderWidget::onCreateButtonClicked);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(&d->bg, qOverload<int>(&QButtonGroup::buttonClicked),
|
||||
this, &ShapeBuilderWidget::switchMode);
|
||||
#else
|
||||
connect(&d->bg, &QButtonGroup::idClicked,
|
||||
this, &ShapeBuilderWidget::switchMode);
|
||||
#endif
|
||||
|
||||
d->gate = new ShapeSelection();
|
||||
Gui::Selection().addSelectionGate(d->gate);
|
||||
|
||||
@@ -89,10 +89,10 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean* BooleanView, Q
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
action->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
|
||||
ui->listWidgetBodies->addAction(action);
|
||||
connect(action, &QAction::triggered, this, &TaskBooleanParameters::onBodyDeleted);
|
||||
ui->listWidgetBodies->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
@@ -292,10 +292,8 @@ void TaskDressUpParameters::createAddAllEdgesAction(QListWidget* parentList)
|
||||
|
||||
addAllEdgesAction = new QAction(tr("Add all edges"), this);
|
||||
addAllEdgesAction->setShortcut(QKeySequence(QStringLiteral("Ctrl+Shift+A")));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
addAllEdgesAction->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
parentList->addAction(addAllEdgesAction);
|
||||
addAllEdgesAction->setStatusTip(tr("Adds all edges to the list box (active only when in add selection mode)."));
|
||||
parentList->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
@@ -311,10 +309,8 @@ void TaskDressUpParameters::createDeleteAction(QListWidget* parentList)
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
deleteAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
deleteAction->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
parentList->addAction(deleteAction);
|
||||
parentList->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
}
|
||||
|
||||
@@ -179,10 +179,8 @@ void TaskExtrudeParameters::setupDialog()
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
unselectShapeFaceAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
unselectShapeFaceAction->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
|
||||
ui->listWidgetReferences->addAction(unselectShapeFaceAction);
|
||||
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
@@ -77,10 +77,8 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft* LoftView, bool /*newObj
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
ui->listWidgetReferences->addAction(remove);
|
||||
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
connect(remove, &QAction::triggered, this, &TaskLoftParameters::onDeleteSection);
|
||||
|
||||
@@ -92,10 +92,11 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe* PipeView, bool /*newObj
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
|
||||
ui->listWidgetReferences->addAction(remove);
|
||||
connect(remove, &QAction::triggered, this, &TaskPipeParameters::onDeleteEdge);
|
||||
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
@@ -615,10 +616,10 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView,
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
|
||||
ui->listWidgetReferences->addAction(remove);
|
||||
connect(remove, &QAction::triggered, this, &TaskPipeOrientation::onDeleteItem);
|
||||
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
@@ -908,10 +909,10 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
|
||||
ui->listWidgetReferences->addAction(remove);
|
||||
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
connect(remove, &QAction::triggered, this, &TaskPipeScaling::onDeleteSection);
|
||||
|
||||
@@ -134,10 +134,8 @@ void TaskShapeBinder::setupContextMenu()
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
ui->listWidgetReferences->addAction(remove);
|
||||
connect(remove, &QAction::triggered, this, &TaskShapeBinder::deleteItem);
|
||||
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
@@ -131,11 +131,7 @@ void TaskTransformedParameters::setupUI()
|
||||
ui->buttonGroupMode->setId(ui->radioTransformToolShapes, static_cast<int>(Mode::TransformToolShapes));
|
||||
|
||||
connect(ui->buttonGroupMode,
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
qOverload<int>(&QButtonGroup::buttonClicked),
|
||||
#else
|
||||
&QButtonGroup::idClicked,
|
||||
#endif
|
||||
this,
|
||||
&TaskTransformedParameters::onModeChanged);
|
||||
|
||||
|
||||
@@ -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