[TD]CI clang warnings
This commit is contained in:
@@ -196,7 +196,7 @@ MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent)
|
||||
|
||||
// indentation
|
||||
|
||||
f_indent_dec->setShortcut(QKeySequence(QString::fromUtf8("CTRL+,")));
|
||||
f_indent_dec->setShortcut(QKeySequence(QString::fromUtf8("CTRL+, ")));
|
||||
f_indent_inc->setShortcut(QKeySequence(QString::fromUtf8("CTRL+.")));
|
||||
|
||||
connect(f_indent_inc, SIGNAL(clicked()), this, SLOT(increaseIndentation()));
|
||||
@@ -223,7 +223,7 @@ MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent)
|
||||
|
||||
// images
|
||||
connect(f_image, SIGNAL(clicked()), this, SLOT(insertImage()));
|
||||
|
||||
|
||||
//set initial font size when editing existing text
|
||||
if (!textIn.isEmpty()) {
|
||||
//insert existing text with cursor at beginning
|
||||
@@ -253,7 +253,7 @@ MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent)
|
||||
|
||||
f_fontsize->setCurrentIndex(f_fontsize->findText(getDefFontSize()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ void MRichTextEdit::textSource() {
|
||||
QPlainTextEdit *pte = new QPlainTextEdit(dialog);
|
||||
pte->setPlainText( f_textedit->toHtml() );
|
||||
QGridLayout *gl = new QGridLayout(dialog);
|
||||
gl->addWidget(pte,0,0,1,1);
|
||||
gl->addWidget(pte, 0,0, 1,1);
|
||||
dialog->setWindowTitle(tr("Document source"));
|
||||
dialog->setMinimumWidth (400);
|
||||
dialog->setMinimumHeight(600);
|
||||
@@ -350,10 +350,10 @@ void MRichTextEdit::textStrikeout() {
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
}
|
||||
|
||||
void MRichTextEdit::textSize(const QString &p) {
|
||||
void MRichTextEdit::textSize(const QString &pointsAsString) {
|
||||
// qDebug() << "MRTE::textSize(" << p << ")";
|
||||
qreal pointSize = p.toFloat();
|
||||
if (p.toFloat() > 0) {
|
||||
qreal pointSize = pointsAsString.toFloat();
|
||||
if (pointsAsString.toFloat() > 0) {
|
||||
QTextCharFormat fmt;
|
||||
fmt.setFontPointSize(pointSize);
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
@@ -440,7 +440,7 @@ void MRichTextEdit::textStyle(int index) {
|
||||
void MRichTextEdit::textFgColor() {
|
||||
QColor col;
|
||||
if (Gui::DialogOptions::dontUseNativeColorDialog()){
|
||||
col = QColorDialog::getColor(f_textedit->textColor(),this, QLatin1String(""), QColorDialog::DontUseNativeDialog);
|
||||
col = QColorDialog::getColor(f_textedit->textColor(), this, QLatin1String(""), QColorDialog::DontUseNativeDialog);
|
||||
} else {
|
||||
col = QColorDialog::getColor(f_textedit->textColor(), this);
|
||||
}
|
||||
@@ -462,7 +462,7 @@ void MRichTextEdit::textFgColor() {
|
||||
void MRichTextEdit::textBgColor() {
|
||||
QColor col;
|
||||
if (Gui::DialogOptions::dontUseNativeColorDialog()){
|
||||
col = QColorDialog::getColor(f_textedit->textBackgroundColor(),this, QLatin1String(""), QColorDialog::DontUseNativeDialog);
|
||||
col = QColorDialog::getColor(f_textedit->textBackgroundColor(), this, QLatin1String(""), QColorDialog::DontUseNativeDialog);
|
||||
} else {
|
||||
col = QColorDialog::getColor(f_textedit->textBackgroundColor(), this);
|
||||
}
|
||||
@@ -539,8 +539,8 @@ void MRichTextEdit::slotCursorPositionChanged() {
|
||||
|
||||
QTextList *l = f_textedit->textCursor().currentList();
|
||||
|
||||
if (m_lastBlockList &&
|
||||
(l == m_lastBlockList ||
|
||||
if (m_lastBlockList &&
|
||||
(l == m_lastBlockList ||
|
||||
(l && m_lastBlockList && l->format().style() == m_lastBlockList->format().style()) ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -563,24 +563,24 @@ void MRichTextEdit::slotCursorPositionChanged() {
|
||||
}
|
||||
}
|
||||
|
||||
void MRichTextEdit::fontChanged(const QFont &f) {
|
||||
void MRichTextEdit::fontChanged(const QFont &font) {
|
||||
// qDebug() << "MRTE::fontChanged()";
|
||||
//TODO: change this to real font selector
|
||||
f_fontsize->setCurrentIndex(f_fontsize->findText(QString::number(f.pointSize())));
|
||||
f_bold->setChecked(f.bold());
|
||||
f_italic->setChecked(f.italic());
|
||||
f_underline->setChecked(f.underline());
|
||||
f_strikeout->setChecked(f.strikeOut());
|
||||
if (f.pointSize() == m_fontsize_h1) {
|
||||
f_fontsize->setCurrentIndex(f_fontsize->findText(QString::number(font.pointSize())));
|
||||
f_bold->setChecked(font.bold());
|
||||
f_italic->setChecked(font.italic());
|
||||
f_underline->setChecked(font.underline());
|
||||
f_strikeout->setChecked(font.strikeOut());
|
||||
if (font.pointSize() == m_fontsize_h1) {
|
||||
f_paragraph->setCurrentIndex(ParagraphHeading1);
|
||||
} else if (f.pointSize() == m_fontsize_h2) {
|
||||
} else if (font.pointSize() == m_fontsize_h2) {
|
||||
f_paragraph->setCurrentIndex(ParagraphHeading2);
|
||||
} else if (f.pointSize() == m_fontsize_h3) {
|
||||
} else if (font.pointSize() == m_fontsize_h3) {
|
||||
f_paragraph->setCurrentIndex(ParagraphHeading3);
|
||||
} else if (f.pointSize() == m_fontsize_h4) {
|
||||
} else if (font.pointSize() == m_fontsize_h4) {
|
||||
f_paragraph->setCurrentIndex(ParagraphHeading4);
|
||||
} else {
|
||||
if (f.fixedPitch() && f.family() == QString::fromUtf8("Monospace")) {
|
||||
if (font.fixedPitch() && font.family() == QString::fromUtf8("Monospace")) {
|
||||
f_paragraph->setCurrentIndex(ParagraphMonospace);
|
||||
} else {
|
||||
f_paragraph->setCurrentIndex(ParagraphStandard);
|
||||
@@ -604,25 +604,25 @@ void MRichTextEdit::fontChanged(const QFont &f) {
|
||||
}
|
||||
}
|
||||
|
||||
void MRichTextEdit::fgColorChanged(const QColor &c) {
|
||||
QSize iconSize(16,16);
|
||||
void MRichTextEdit::fgColorChanged(const QColor &color) {
|
||||
QSize iconSize(16, 16);
|
||||
QIcon fgIcon = f_fgcolor->icon();
|
||||
QPixmap fgPix = fgIcon.pixmap(iconSize,QIcon::Mode::Normal, QIcon::State::On);
|
||||
QPixmap fgPix = fgIcon.pixmap(iconSize, QIcon::Mode::Normal, QIcon::State::On);
|
||||
QPixmap filler(iconSize);
|
||||
if (c.isValid() ) {
|
||||
filler.fill(c);
|
||||
if (color.isValid() ) {
|
||||
filler.fill(color);
|
||||
filler.setMask(fgPix.createMaskFromColor(Qt::transparent, Qt::MaskInColor) );
|
||||
f_fgcolor->setIcon(filler);
|
||||
}
|
||||
}
|
||||
|
||||
void MRichTextEdit::bgColorChanged(const QColor &c) {
|
||||
QSize iconSize(16,16);
|
||||
void MRichTextEdit::bgColorChanged(const QColor &color) {
|
||||
QSize iconSize(16, 16);
|
||||
QIcon bgIcon = f_bgcolor->icon();
|
||||
QPixmap bgPix = bgIcon.pixmap(iconSize,QIcon::Mode::Normal, QIcon::State::On);
|
||||
QPixmap bgPix = bgIcon.pixmap(iconSize, QIcon::Mode::Normal, QIcon::State::On);
|
||||
QPixmap filler(iconSize);
|
||||
if (c.isValid() ) {
|
||||
filler.fill(c);
|
||||
if (color.isValid() ) {
|
||||
filler.fill(color);
|
||||
filler.setMask(bgPix.createMaskFromColor(Qt::transparent, Qt::MaskOutColor) );
|
||||
f_bgcolor->setIcon(filler);
|
||||
}
|
||||
@@ -701,22 +701,22 @@ void MRichTextEdit::insertImage() {
|
||||
tr("JPEG (*.jpg);; GIF (*.gif);; PNG (*.png);; BMP (*.bmp);; All (*)"));
|
||||
QImage image = QImageReader(file).read();
|
||||
|
||||
f_textedit->dropImage(image,
|
||||
f_textedit->dropImage(image,
|
||||
QFileInfo(file).suffix().toUpper());
|
||||
}
|
||||
|
||||
void MRichTextEdit::onSave(void)
|
||||
void MRichTextEdit::onSave()
|
||||
{
|
||||
QString result = toHtml();
|
||||
Q_EMIT saveText(result);
|
||||
}
|
||||
|
||||
void MRichTextEdit::onExit(void)
|
||||
void MRichTextEdit::onExit()
|
||||
{
|
||||
Q_EMIT editorFinished();
|
||||
}
|
||||
|
||||
void MRichTextEdit::onSelectionChanged(void)
|
||||
void MRichTextEdit::onSelectionChanged()
|
||||
{
|
||||
// qDebug() << "MRTE::onSelectionChanged()";
|
||||
if (hasMultipleSizes()) {
|
||||
@@ -732,7 +732,7 @@ void MRichTextEdit::onSelectionChanged(void)
|
||||
}
|
||||
|
||||
//does selection have multiple sizes?
|
||||
bool MRichTextEdit::hasMultipleSizes(void)
|
||||
bool MRichTextEdit::hasMultipleSizes()
|
||||
{
|
||||
// qDebug() << "MRTE::hasMultipleSizes()";
|
||||
bool result = false;
|
||||
@@ -747,7 +747,7 @@ bool MRichTextEdit::hasMultipleSizes(void)
|
||||
cursor.setPosition(currPos);
|
||||
QTextCharFormat fmt = cursor.charFormat();
|
||||
double currSize = fmt.fontPointSize();
|
||||
QString asQS = QString::number(currSize,'f',2);
|
||||
QString asQS = QString::number(currSize, 'f', 2);
|
||||
foundSizes.push_back(asQS);
|
||||
auto ret = countMap.insert(std::pair<QString, int>(asQS, 1));
|
||||
if (!ret.second) { //already have this size
|
||||
@@ -758,19 +758,19 @@ bool MRichTextEdit::hasMultipleSizes(void)
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void MRichTextEdit::setDefFontSize(int fs)
|
||||
void MRichTextEdit::setDefFontSize(int fontSize)
|
||||
{
|
||||
// Base::Console().Message("MRTE::setDefFontSize(%d)\n", fs);
|
||||
m_defFontSize = fs;
|
||||
m_fontsize_h1 = fs + 8;
|
||||
m_fontsize_h2 = fs + 6;
|
||||
m_fontsize_h3 = fs + 4;
|
||||
m_fontsize_h4 = fs + 2;
|
||||
m_defFontSize = fontSize;
|
||||
m_fontsize_h1 = fontSize + 8;
|
||||
m_fontsize_h2 = fontSize + 6;
|
||||
m_fontsize_h3 = fontSize + 4;
|
||||
m_fontsize_h4 = fontSize + 2;
|
||||
|
||||
QString newSize = QString::number(fs);
|
||||
QString newSize = QString::number(fontSize);
|
||||
f_fontsize->findText(newSize);
|
||||
int idx = f_fontsize->findText(newSize);
|
||||
if (idx > -1) {
|
||||
@@ -781,7 +781,7 @@ void MRichTextEdit::setDefFontSize(int fs)
|
||||
textSize(newSize);
|
||||
}
|
||||
|
||||
int MRichTextEdit::getDefFontSizeNum(void)
|
||||
int MRichTextEdit::getDefFontSizeNum()
|
||||
{
|
||||
// Base::Console().Message("MRTE::getDefFontSizeNum()\n");
|
||||
double fontSize = TechDraw::Preferences::dimFontSizeMM();
|
||||
@@ -789,12 +789,12 @@ int MRichTextEdit::getDefFontSizeNum(void)
|
||||
//this conversion is only approximate. the factor changes for different fonts.
|
||||
// double mmToPts = 2.83; //theoretical value
|
||||
double mmToPts = 2.00; //practical value. seems to be reasonable for common fonts.
|
||||
|
||||
|
||||
int ptsSize = round(fontSize * mmToPts);
|
||||
return ptsSize;
|
||||
}
|
||||
|
||||
QString MRichTextEdit::getDefFontSize(void)
|
||||
QString MRichTextEdit::getDefFontSize()
|
||||
{
|
||||
// Base::Console().Message("MRTE::getDefFontSize()\n");
|
||||
QString result = QString::number(getDefFontSizeNum());
|
||||
@@ -802,12 +802,12 @@ QString MRichTextEdit::getDefFontSize(void)
|
||||
}
|
||||
|
||||
//not used.
|
||||
void MRichTextEdit::setDefFont(QString f)
|
||||
void MRichTextEdit::setDefFont(QString fontName)
|
||||
{
|
||||
m_defFont = f;
|
||||
m_defFont = fontName;
|
||||
}
|
||||
|
||||
QFont MRichTextEdit::getDefFont(void)
|
||||
QFont MRichTextEdit::getDefFont()
|
||||
{
|
||||
QString family = Base::Tools::fromStdString(Preferences::labelFont());
|
||||
m_defFont = family;
|
||||
@@ -818,12 +818,12 @@ QFont MRichTextEdit::getDefFont(void)
|
||||
|
||||
// add a new fontSize to the list
|
||||
// this seems like massive overkill for integer point<->mm conversion factor
|
||||
// if the conversion factor is float, will generate non-standard sizes
|
||||
void MRichTextEdit::addFontSize(QString fs)
|
||||
// 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 = fs.toInt();
|
||||
int fsVal = fontSize.toInt();
|
||||
int size = f_fontsize->count();
|
||||
bool added = false;
|
||||
for (int i = 0; i < size; i++) {
|
||||
@@ -839,13 +839,13 @@ void MRichTextEdit::addFontSize(QString fs)
|
||||
newList << item;
|
||||
added = true;
|
||||
} else { //item > fs, add both
|
||||
newList << fs;
|
||||
newList << item;
|
||||
newList << fontSize;
|
||||
newList << item;
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
if (!added) { //bigger than all choices, add to end of list
|
||||
newList << fs;
|
||||
newList << fontSize;
|
||||
}
|
||||
f_fontsize->clear();
|
||||
f_fontsize->addItems(newList);
|
||||
|
||||
Reference in New Issue
Block a user