git-svn-id: svn://db.shs.com.ru/libs@337 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-11-30 21:49:44 +00:00
parent 5e99c5144d
commit 5319da69aa
8 changed files with 23 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 731 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -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<int>(sz, ((QAbstractItemView*)completer)->sizeHintForColumn(i));
completer->resize(sz, fontHeight() * 16);
} else
completer->hide();
}

View File

@@ -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()));