fix some warnings
This commit is contained in:
@@ -16,7 +16,7 @@ BlockEditor::BlockEditor(QWidget *parent) : QWidget(parent), ui(new Ui::BlockEdi
|
||||
ui->setupUi(this);
|
||||
src_title = windowTitle();
|
||||
connect(ui->blockView->scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
|
||||
block.setFlags(0);
|
||||
block.setFlags(QGraphicsItem::GraphicsItemFlags());
|
||||
ui->blockView->addItem(&block);
|
||||
ui->blockView->viewport()->installEventFilter(this);
|
||||
DrawTools * drawtools = new DrawTools(ui->blockView);
|
||||
|
||||
@@ -12,7 +12,7 @@ g_main(this), g_selection(this) {
|
||||
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
||||
g_main.setData(1002, true);
|
||||
g_selection.setData(1007, true);
|
||||
g_selection.setAcceptedMouseButtons(0);
|
||||
g_selection.setAcceptedMouseButtons(Qt::MouseButtons());
|
||||
g_selection.setZValue(10.);
|
||||
g_selection.hide();
|
||||
g_selection.setData(1003, true);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef BLOCKITEM_H
|
||||
#define BLOCKITEM_H
|
||||
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include "blockitempin.h"
|
||||
#include "qad_blockview_export.h"
|
||||
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
void setSelectionRect(const QRectF & r);
|
||||
|
||||
QPropertyAnimation anim_thick, anim_sel;
|
||||
QTime t_sel;
|
||||
QElapsedTimer t_sel;
|
||||
|
||||
signals:
|
||||
void blockHoverEnter(BlockItem * b);
|
||||
|
||||
@@ -524,7 +524,7 @@ void DrawTools::alignClicked() {
|
||||
if (b != sb)
|
||||
b->setChecked(false);
|
||||
sb->setChecked(true);
|
||||
align = 0;
|
||||
align = Qt::Alignment();
|
||||
QString als = sb->objectName().right(2).toLower();
|
||||
if (als[0] == 't') align |= Qt::AlignTop;
|
||||
if (als[0] == 'c') align |= Qt::AlignVCenter;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
const double deg2rad_qpie = atan(1.) / 45.;
|
||||
const double rad2deg_qpie = 45. / atan(1.);
|
||||
|
||||
__GraphicRegistrator__ __graphic_registrator__;
|
||||
|
||||
@@ -58,7 +58,7 @@ protected:
|
||||
|
||||
private:
|
||||
void configTree();
|
||||
void setItemBackColor(QTreeWidgetItem * i, const QColor & c) {i->setBackgroundColor(0, c); i->setBackgroundColor(1, c);}
|
||||
void setItemBackColor(QTreeWidgetItem * i, const QColor & c) {i->setBackground(0, c); i->setBackground(1, c);}
|
||||
void setItemForeColor(QTreeWidgetItem * i, const QColor & c) {i->setForeground(0, c); i->setForeground(1, c);}
|
||||
void rebuild();
|
||||
void refresh();
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QElapsedTimer>
|
||||
#include "qpiconfig.h"
|
||||
#include "qad_sql_table_export.h"
|
||||
|
||||
@@ -311,7 +312,7 @@ private:
|
||||
QVector<int> column_indexes;
|
||||
QStringList wait_rels;
|
||||
QMenu popup_menu, popup_col, popup_filter;
|
||||
QTime tm;
|
||||
QElapsedTimer tm;
|
||||
QActionGroup filters_group;
|
||||
QAction * action_del;
|
||||
QList<QAction*> add_actions;
|
||||
|
||||
@@ -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