fix some warnings
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user