git-svn-id: svn://db.shs.com.ru/libs@337 a8b55f48-bf90-11e4-a774-851b48703e85
|
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 641 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 731 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 813 B |
|
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 1.8 KiB |
@@ -44,7 +44,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
|||||||
lbl_help[1]->setIcon(QIcon(":/icons/f1.png"));
|
lbl_help[1]->setIcon(QIcon(":/icons/f1.png"));
|
||||||
lbl_help[1]->setText(trUtf8("Press F1 for details"));
|
lbl_help[1]->setText(trUtf8("Press F1 for details"));
|
||||||
completer = new QTreeWidget();
|
completer = new QTreeWidget();
|
||||||
completer->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
completer->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
completer->setFocusPolicy(Qt::NoFocus);
|
completer->setFocusPolicy(Qt::NoFocus);
|
||||||
completer->setColumnCount(2);
|
completer->setColumnCount(2);
|
||||||
completer->setRootIsDecorated(false);
|
completer->setRootIsDecorated(false);
|
||||||
@@ -59,7 +59,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
|||||||
(QHeaderView::ResizeToContents);
|
(QHeaderView::ResizeToContents);
|
||||||
completer->header()->setStretchLastSection(true);
|
completer->header()->setStretchLastSection(true);
|
||||||
//completer->setColumnWidth(0, 180);
|
//completer->setColumnWidth(0, 180);
|
||||||
completer->resize(500, 200);
|
//completer->resize(500, 200);
|
||||||
textCode = new QPlainTextEdit();
|
textCode = new QPlainTextEdit();
|
||||||
textLines = new QPlainTextEdit();
|
textLines = new QPlainTextEdit();
|
||||||
textCode->setFrameShadow(QFrame::Plain);
|
textCode->setFrameShadow(QFrame::Plain);
|
||||||
@@ -794,11 +794,20 @@ void QCodeEdit::raiseHelp(QTextCursor tc, int arg) {
|
|||||||
}
|
}
|
||||||
es_cursor.cursor = tc;
|
es_cursor.cursor = tc;
|
||||||
applyExtraSelection();
|
applyExtraSelection();
|
||||||
tc.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, st.size());
|
//tc.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
||||||
lbl_help[0]->setFont(font());
|
lbl_help[0]->setFont(font());
|
||||||
|
qApp->processEvents();
|
||||||
widget_help->resize(widget_help->sizeHint());
|
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->show();
|
||||||
|
widget_help->raise();
|
||||||
cursor_scope = scope.first;
|
cursor_scope = scope.first;
|
||||||
cursor_scope << scope.second;
|
cursor_scope << scope.second;
|
||||||
//qDebug() << "tooltip" << st;
|
//qDebug() << "tooltip" << st;
|
||||||
@@ -961,7 +970,15 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
|
|||||||
completer->setCurrentItem(completer->topLevelItem(1));
|
completer->setCurrentItem(completer->topLevelItem(1));
|
||||||
if (completer->isHidden())
|
if (completer->isHidden())
|
||||||
completer->move(textCode->mapToGlobal(textCode->cursorRect().bottomRight()));
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ PathEdit::PathEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRig
|
|||||||
butt_select->setIcon(QIcon(":/icons/document-open.png"));
|
butt_select->setIcon(QIcon(":/icons/document-open.png"));
|
||||||
butt_select->setToolTip(tr("Choose") + " ...");
|
butt_select->setToolTip(tr("Choose") + " ...");
|
||||||
lay.setContentsMargins(0, 0, 0, 0);
|
lay.setContentsMargins(0, 0, 0, 0);
|
||||||
lay.setSpacing(2);
|
//lay.setSpacing(2);
|
||||||
lay.addWidget(line);
|
lay.addWidget(line);
|
||||||
lay.addWidget(butt_select);
|
lay.addWidget(butt_select);
|
||||||
connect(line, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged()));
|
connect(line, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged()));
|
||||||
|
|||||||