diff --git a/qad/icons/code-error.png b/qad/icons/code-error.png index 5b4c488..a76314c 100644 Binary files a/qad/icons/code-error.png and b/qad/icons/code-error.png differ diff --git a/qad/icons/code-parents.png b/qad/icons/code-parents.png index 7c14d40..a4247e1 100644 Binary files a/qad/icons/code-parents.png and b/qad/icons/code-parents.png differ diff --git a/qad/icons/code-struct.png b/qad/icons/code-struct.png index 61544a8..425b7b9 100644 Binary files a/qad/icons/code-struct.png and b/qad/icons/code-struct.png differ diff --git a/qad/icons/code-union.png b/qad/icons/code-union.png index 2f4567a..337f0de 100644 Binary files a/qad/icons/code-union.png and b/qad/icons/code-union.png differ diff --git a/qad/icons/code-variable.png b/qad/icons/code-variable.png index d202a74..3c768e6 100644 Binary files a/qad/icons/code-variable.png and b/qad/icons/code-variable.png differ diff --git a/qad/icons/code-word.png b/qad/icons/code-word.png index e61f08f..3f6725a 100644 Binary files a/qad/icons/code-word.png and b/qad/icons/code-word.png differ diff --git a/qad/widgets/qcodeedit.cpp b/qad/widgets/qcodeedit.cpp index 1659b36..c54fa22 100644 --- a/qad/widgets/qcodeedit.cpp +++ b/qad/widgets/qcodeedit.cpp @@ -44,7 +44,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) { lbl_help[1]->setIcon(QIcon(":/icons/f1.png")); lbl_help[1]->setText(trUtf8("Press F1 for details")); completer = new QTreeWidget(); - completer->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint); + completer->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); completer->setFocusPolicy(Qt::NoFocus); completer->setColumnCount(2); completer->setRootIsDecorated(false); @@ -59,7 +59,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) { (QHeaderView::ResizeToContents); completer->header()->setStretchLastSection(true); //completer->setColumnWidth(0, 180); - completer->resize(500, 200); + //completer->resize(500, 200); textCode = new QPlainTextEdit(); textLines = new QPlainTextEdit(); textCode->setFrameShadow(QFrame::Plain); @@ -794,11 +794,20 @@ void QCodeEdit::raiseHelp(QTextCursor tc, int arg) { } es_cursor.cursor = tc; applyExtraSelection(); - tc.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, st.size()); + //tc.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor); lbl_help[0]->setFont(font()); + qApp->processEvents(); widget_help->resize(widget_help->sizeHint()); - widget_help->move(textCode->viewport()->mapToGlobal(textCode->cursorRect(tc).topLeft()/* - QPoint(0, widget_help->height() + 8)*/)); + qApp->processEvents(); + QRect whr = textCode->cursorRect(tc); + whr.setWidth(textCode->fontMetrics().width(st)); + QPoint whp; + whp.setX(whr.left() - whr.width() - (widget_help->width() - whr.width()) / 2); + whp.setY(whr.top() - widget_help->height() - (fontHeight() / 3)); + //qDebug() << whr << whp << widget_help->width() << ", " << st; + widget_help->move(textCode->viewport()->mapToGlobal(whp)); widget_help->show(); + widget_help->raise(); cursor_scope = scope.first; cursor_scope << scope.second; //qDebug() << "tooltip" << st; @@ -961,7 +970,15 @@ void QCodeEdit::invokeAutoCompletition(bool force) { completer->setCurrentItem(completer->topLevelItem(1)); if (completer->isHidden()) completer->move(textCode->mapToGlobal(textCode->cursorRect().bottomRight())); - completer->setVisible(completer->topLevelItemCount() > 0); + if (completer->topLevelItemCount() > 0) { + completer->setVisible(true); + //qApp->processEvents(); + int sz = completer->verticalScrollBar()->width(); + for (int i = 0; i < completer->header()->count(); ++i) + sz += qMax(sz, ((QAbstractItemView*)completer)->sizeHintForColumn(i)); + completer->resize(sz, fontHeight() * 16); + } else + completer->hide(); } diff --git a/qad/widgets/qvariantedit.cpp b/qad/widgets/qvariantedit.cpp index 9150f9a..6408901 100644 --- a/qad/widgets/qvariantedit.cpp +++ b/qad/widgets/qvariantedit.cpp @@ -111,7 +111,7 @@ PathEdit::PathEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRig butt_select->setIcon(QIcon(":/icons/document-open.png")); butt_select->setToolTip(tr("Choose") + " ..."); lay.setContentsMargins(0, 0, 0, 0); - lay.setSpacing(2); + //lay.setSpacing(2); lay.addWidget(line); lay.addWidget(butt_select); connect(line, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged()));