save/restore collapsed state
git-svn-id: svn://db.shs.com.ru/libs@16 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -665,6 +665,13 @@ bool KX_Pult::calculateExpression(int i, QVector<int> trace) {
|
||||
trace << i;
|
||||
QTreeWidgetItem * ti = ui->treeK->topLevelItem(i);
|
||||
QString expr = ti->text(2);
|
||||
if (expr.isEmpty() || expr == "0" || expr == "0,00000000" || expr == "0.00000000") {
|
||||
markNormal(ti);
|
||||
calculated << i;
|
||||
K[i] = 0.;
|
||||
ti->setText(3, "0");
|
||||
return true;
|
||||
}
|
||||
//ti->setToolTip(2, QString());
|
||||
if (!eval.check(expr)) {
|
||||
markError(ti, eval.error());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cmake .
|
||||
make install $@
|
||||
#cmake .
|
||||
#make install $@
|
||||
for d in 'qad_widgets' 'qad_utils' 'qad_graphic' 'qad_sql_table' 'qad_application' 'qad_blockview' 'touch_widgets'; do
|
||||
cd $d
|
||||
qmake
|
||||
|
||||
@@ -1044,10 +1044,10 @@ void Graphic::setRectToLines() {
|
||||
line_x_min.is_auto = line_x_max.is_auto = line_y_min.is_auto = line_y_max.is_auto = true;
|
||||
//qDebug() << "set to lines" << selrect;
|
||||
line_x_min.is_reset = line_x_max.is_reset = line_y_min.is_reset = line_y_max.is_reset = isFit;
|
||||
line_x_min.setValue(selrect.left());
|
||||
line_x_max.setValue(selrect.right());
|
||||
line_y_min.setValue(selrect.bottom());
|
||||
line_y_max.setValue(selrect.top());
|
||||
if (!line_x_min.hasFocus()) line_x_min.setValue(selrect.left());
|
||||
if (!line_x_max.hasFocus()) line_x_max.setValue(selrect.right());
|
||||
if (!line_y_min.hasFocus()) line_y_min.setValue(selrect.bottom());
|
||||
if (!line_y_max.hasFocus()) line_y_max.setValue(selrect.top());
|
||||
if (!isFit) {
|
||||
line_x_min.setDefaultText(QString::number(grect.left()).toUpper());
|
||||
line_x_max.setDefaultText(QString::number(grect.right()).toUpper());
|
||||
|
||||
@@ -320,7 +320,7 @@ protected:
|
||||
void setCurrentAction(GraphicAction action);
|
||||
void findGraphicsRect(double start_x = 0., double end_x = 0., double start_y = 0., double end_y = 0.);
|
||||
void tick(int index, bool slide = true, bool update = true);
|
||||
void repaintCanvas(bool force = false) {if (tm.elapsed() < min_repaint_int && !force) return; tm.restart(); canvas->repaint();}
|
||||
void repaintCanvas(bool force = false) {if (tm.elapsed() < min_repaint_int && !force) return; tm.restart(); canvas->update();}
|
||||
void drawGraphics();
|
||||
void drawGrid();
|
||||
void drawGuides();
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
prev_lc = auto_comp_pl = -1;
|
||||
textCode = textLines = 0;
|
||||
timer = 0;
|
||||
_ignore_focus_out = false;
|
||||
es_line.format.setBackground(QColor(240, 245, 240));
|
||||
es_line.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
@@ -52,6 +54,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
textLines->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
textLines->viewport()->setAutoFillBackground(false);
|
||||
textLines->viewport()->setCursor(Qt::ArrowCursor);
|
||||
textLines->viewport()->installEventFilter(this);
|
||||
textLines->setFixedWidth(textLines->fontMetrics().width(" "));
|
||||
setLayout(new QBoxLayout(QBoxLayout::BottomToTop));
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -164,6 +167,20 @@ QChar QCodeEdit::pairChar(QChar c) {
|
||||
|
||||
|
||||
bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
if (textLines) {
|
||||
if (o == textLines->viewport()) {
|
||||
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonRelease ||
|
||||
e->type() == QEvent::MouseMove || e->type() == QEvent::MouseButtonDblClick) {
|
||||
const_cast<QPoint&>(((QMouseEvent*)e)->pos()) = QPoint(0, ((QMouseEvent*)e)->pos().y());
|
||||
QApplication::sendEvent(textCode->viewport(), e);
|
||||
return true;
|
||||
}
|
||||
if (e->type() == QEvent::Wheel) {
|
||||
QApplication::sendEvent(textCode->viewport(), e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (o == &completer) {
|
||||
//qDebug() << o << e;
|
||||
if (e->type() == QEvent::WindowActivate)
|
||||
@@ -171,6 +188,7 @@ bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
//qDebug() << e;
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
if (textCode) {
|
||||
if (o == textCode->viewport()) {
|
||||
if (e->type() == QEvent::MouseButtonPress)
|
||||
completer.hide();
|
||||
@@ -288,10 +306,19 @@ bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::timerEvent(QTimerEvent * ) {
|
||||
parse();
|
||||
emit parseRequest();
|
||||
killTimer(timer);
|
||||
timer = 0;
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::applyExtraSelection() {
|
||||
textCode->setExtraSelections(QList<QTextEdit::ExtraSelection>() << es_line << es_selected << es_custom);
|
||||
}
|
||||
@@ -563,6 +590,8 @@ void QCodeEdit::autoIndent() {
|
||||
|
||||
|
||||
void QCodeEdit::updateLines() {
|
||||
if (timer > 0) killTimer(timer);
|
||||
timer = startTimer(500);
|
||||
textCode->setTabStopWidth(textCode->fontMetrics().width(" "));
|
||||
int lc = textCode->document()->lineCount();
|
||||
if (prev_lc == lc) return;
|
||||
|
||||
@@ -49,6 +49,7 @@ protected:
|
||||
typedef QList<ACPair> ACList;
|
||||
|
||||
virtual ACList autoCompletitionList(const QStringList & scope, const QString & written) const {return ACList();}
|
||||
virtual void parse() {}
|
||||
ACList wordsCompletitionList(const QString & written) const;
|
||||
static int skipRange(const QString & s, int pos, QChar oc, QChar cc, QChar sc = QChar());
|
||||
static int skipCWord(const QString & s, int pos);
|
||||
@@ -69,10 +70,11 @@ private:
|
||||
QTextEdit::ExtraSelection es_line;
|
||||
QList<QTextEdit::ExtraSelection> es_selected, es_custom;
|
||||
QMap<int, ACClass> ac_classes;
|
||||
int prev_lc, auto_comp_pl;
|
||||
int prev_lc, auto_comp_pl, timer;
|
||||
bool spaces_, _ignore_focus_out;
|
||||
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void timerEvent(QTimerEvent * );
|
||||
void applyExtraSelection();
|
||||
void nextCompletition();
|
||||
void previousCompletition();
|
||||
@@ -101,6 +103,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void textChanged();
|
||||
void parseRequest();
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user