fix some warnings
This commit is contained in:
@@ -11,10 +11,9 @@ CLineEdit::CLineEdit(QWidget * parent): QLineEdit(parent) {
|
||||
cw->installEventFilter(this);
|
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));
|
||||
int is = fontHeight();
|
||||
int m0, m1, m2, m3;
|
||||
getTextMargins(&m0, &m1, &m2, &m3);
|
||||
setTextMargins(m0, m1, m2 + (is * 1.2), m3);
|
||||
//connect(cw, SIGNAL(mouseReleaseEvent(QMouseEvent * )), this, SLOT(clearMouseRelease(QMouseEvent * )));
|
||||
QMargins m = textMargins();
|
||||
m.setRight(m.right() + (is * 1.2));
|
||||
setTextMargins(m);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,17 +70,16 @@ void EvalSpinBox::resizeIcons() {
|
||||
QStyleOptionFrame so;
|
||||
so.initFrom(lineEdit());
|
||||
QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &so, lineEdit());
|
||||
int m0, m1, m2, m3;
|
||||
lineEdit()->getTextMargins(&m0, &m1, &m2, &m3);
|
||||
//label->setGeometry(m0 + r.x() + 2, m1 + r.y() + (r.height() - fontMetrics().height() + 1) / 2, lineEdit()->width() - 2*tm - (is * 1.2) * ((status->isVisible() ? 1 : 0) + (cw->isVisible() ? 1 : 0)), lineEdit()->height() - 2*tm);
|
||||
QMargins m = lineEdit()->textMargins();
|
||||
int lwh = label->sizeHint().width();
|
||||
label->setGeometry(lineEdit()->width() - m0 - lwh + r.x() - 2,
|
||||
m1 + r.y() + (r.height() - fontMetrics().height() + 1) / 2,
|
||||
label->setGeometry(lineEdit()->width() - m.left() - lwh + r.x() - 2,
|
||||
m.top() + r.y() + (r.height() - fontMetrics().height() + 1) / 2,
|
||||
lwh,// - 2*tm - (is * 1.2) * ((status->isVisible() ? 1 : 0) + (cw->isVisible() ? 1 : 0)),
|
||||
lineEdit()->height() - 2*tm);
|
||||
status->setGeometry(lineEdit()->width() - (is + tm) * (cw->isVisible() ? 2 : 1), tm, is, is);
|
||||
cw->setGeometry(lineEdit()->width() - (is + tm) * 1, tm, is, is);
|
||||
lineEdit()->setTextMargins(m0, m1, (is * 1.2) * ((status->isVisible() ? 1 : 0) + (cw->isVisible() ? 1 : 0)), m3);
|
||||
m.setRight((is * 1.2) * ((status->isVisible() ? 1 : 0) + (cw->isVisible() ? 1 : 0)));
|
||||
lineEdit()->setTextMargins(m);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,11 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
ui->textCode->setCursorWidth(qMax<int>(qRound(fontHeight() / 10.), 1));
|
||||
ui->textLines->viewport()->setAutoFillBackground(false);
|
||||
ui->textLines->viewport()->setCursor(Qt::ArrowCursor);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
ui->textLines->setFixedWidth(ui->textLines->fontMetrics().horizontalAdvance(" "));
|
||||
#else
|
||||
ui->textLines->setFixedWidth(ui->textLines->fontMetrics().width(" "));
|
||||
#endif
|
||||
|
||||
QAction * a = new QAction(this); ui->textCode->addAction(a);
|
||||
a->setShortcut(QKeySequence("Shift+Tab"));
|
||||
@@ -689,7 +693,7 @@ void QCodeEdit::searchAll() {
|
||||
QString st = ui->comboSearch->currentText();
|
||||
es_search_list.clear();
|
||||
if (!st.isEmpty() && !ui->widgetSearch->isHidden()) {
|
||||
QTextDocument::FindFlags ff = 0;
|
||||
QTextDocument::FindFlags ff = QTextDocument::FindFlags();
|
||||
if (ui->buttonSearchCase->isChecked()) ff |= QTextDocument::FindCaseSensitively;
|
||||
if (ui->buttonSearchWord->isChecked()) ff |= QTextDocument::FindWholeWords;
|
||||
QTextCursor tc(ui->textCode->document()->begin());
|
||||
@@ -1021,11 +1025,23 @@ void QCodeEdit::setText(const QString & t) {
|
||||
void QCodeEdit::updateLines() {
|
||||
if (timer > 0) killTimer(timer);
|
||||
timer = startTimer(500);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
ui->textCode->setTabStopDistance(ui->textCode->fontMetrics().horizontalAdvance(" "));
|
||||
# else
|
||||
ui->textCode->setTabStopDistance(ui->textCode->fontMetrics().width(" "));
|
||||
# endif
|
||||
#else
|
||||
ui->textCode->setTabStopWidth(ui->textCode->fontMetrics().width(" "));
|
||||
#endif
|
||||
int lc = ui->textCode->document()->lineCount();
|
||||
if (prev_lc == lc) return;
|
||||
prev_lc = lc;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
ui->textLines->setFixedWidth(ui->textLines->fontMetrics().horizontalAdvance(QString(" %1").arg(lc)));
|
||||
#else
|
||||
ui->textLines->setFixedWidth(ui->textLines->fontMetrics().width(QString(" %1").arg(lc)));
|
||||
#endif
|
||||
ui->textLines->clear();
|
||||
for (int i = 1; i <= lc; ++i)
|
||||
ui->textLines->appendPlainText(QString("%1").arg(i));
|
||||
@@ -1100,7 +1116,11 @@ void QCodeEdit::raiseHelp(QTextCursor tc, int arg) {
|
||||
widget_help->resize(widget_help->sizeHint());
|
||||
qApp->processEvents();
|
||||
QRect whr = ui->textCode->cursorRect(tc);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
whr.setWidth(ui->textCode->fontMetrics().horizontalAdvance(st));
|
||||
#else
|
||||
whr.setWidth(ui->textCode->fontMetrics().width(st));
|
||||
#endif
|
||||
QPoint whp;
|
||||
whp.setX(whr.left() - whr.width() - (widget_help->width() - whr.width()) / 2);
|
||||
whp.setY(whr.top() - widget_help->height() - (fontHeight() / 3));
|
||||
@@ -1254,7 +1274,7 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
|
||||
gi->setTextAlignment(0, Qt::AlignCenter);
|
||||
gi->setTextAlignment(1, Qt::AlignCenter);
|
||||
gi->setFont(0, bf);
|
||||
gi->setBackgroundColor(0, Qt::lightGray);
|
||||
gi->setBackground(0, Qt::lightGray);
|
||||
gi->setFlags(Qt::ItemIsEnabled);
|
||||
completer->addTopLevelItem(gi);
|
||||
gi->setFirstColumnSpanned(true);
|
||||
|
||||
@@ -612,7 +612,6 @@ int QPIEvaluator::parse(const QString & string, int offset) {
|
||||
QChar cc;
|
||||
QPIEvaluatorTypes::Element ce;
|
||||
QPIEvaluatorTypes::Function cfunc;
|
||||
QPIEvaluatorTypes::Operation coper;
|
||||
QString sbrackets, carg;
|
||||
QVector<int> args, atmp;
|
||||
QVector<QPIEvaluatorTypes::Operation> opers;
|
||||
@@ -956,7 +955,7 @@ inline void QPIEvaluator::execFunction(const QPIEvaluatorTypes::Instruction & ci
|
||||
tmpvars[oi].value = value(ci.operators[0]) * complexd(rad2deg_qpie, 0.);
|
||||
break;
|
||||
case QPIEvaluatorTypes::bfRandom:
|
||||
tmp = static_cast<double>(qrand()) / RAND_MAX;
|
||||
tmp = static_cast<double>(rand()) / RAND_MAX;
|
||||
stmp = value(ci.operators[1]) - value(ci.operators[0]);
|
||||
tmpvars[oi].value = value(ci.operators[0]) + tmp * stmp;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user