git-svn-id: svn://db.shs.com.ru/libs@127 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -22,12 +22,22 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
es_line.format.setBackground(QColor(240, 245, 240));
|
||||
es_line.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
es_cursor.format.setBackground(QColor(220, 255, 200));
|
||||
lbl_help = new IconedLabel();
|
||||
lbl_help->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
||||
lbl_help->setFocusPolicy(Qt::NoFocus);
|
||||
lbl_help->setFrameShadow(QFrame::Sunken);
|
||||
lbl_help->setFrameShape(QFrame::StyledPanel);
|
||||
lbl_help->setDirection(IconedLabel::RightToLeft);
|
||||
widget_help = new QFrame();
|
||||
widget_help->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
||||
widget_help->setFocusPolicy(Qt::NoFocus);
|
||||
widget_help->setFrameShadow(QFrame::Sunken);
|
||||
widget_help->setFrameShape(QFrame::StyledPanel);
|
||||
widget_help->setLayout(new QBoxLayout(QBoxLayout::TopToBottom));
|
||||
widget_help->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
lbl_help[i] = new IconedLabel();
|
||||
lbl_help[i]->setFrameShadow(QFrame::Plain);
|
||||
lbl_help[i]->setFrameShape(QFrame::NoFrame);
|
||||
lbl_help[i]->setDirection(IconedLabel::RightToLeft);
|
||||
widget_help->layout()->addWidget(lbl_help[i]);
|
||||
}
|
||||
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->setFocusPolicy(Qt::NoFocus);
|
||||
@@ -107,7 +117,9 @@ QCodeEdit::~QCodeEdit() {
|
||||
delete textCode;
|
||||
delete textLines;
|
||||
delete completer;
|
||||
delete lbl_help;
|
||||
//for (int i = 0; i < 2; ++i)
|
||||
// delete lbl_help[i];
|
||||
delete widget_help;
|
||||
}
|
||||
|
||||
|
||||
@@ -706,8 +718,8 @@ void QCodeEdit::raiseHelp(QTextCursor tc, int arg) {
|
||||
}
|
||||
//qDebug() << s.second << st;
|
||||
ACClass acc = ac_classes.value(i.first);
|
||||
lbl_help->setIcon(acc.icon);
|
||||
lbl_help->setText(QString("<html><body>[%1] %2 %3</html></body>").arg(acc.name, s.first, selectArg(s.second, arg)));
|
||||
lbl_help[0]->setIcon(acc.icon);
|
||||
lbl_help[0]->setText(QString("<html><body>[%1] %2 %3</html></body>").arg(acc.name, s.first, selectArg(s.second, arg)));
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
@@ -720,10 +732,10 @@ void QCodeEdit::raiseHelp(QTextCursor tc, int arg) {
|
||||
es_cursor.cursor = tc;
|
||||
applyExtraSelection();
|
||||
tc.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, st.size());
|
||||
lbl_help->setFont(font());
|
||||
lbl_help->resize(lbl_help->sizeHint());
|
||||
lbl_help->move(textCode->mapToGlobal(textCode->cursorRect(tc).topLeft() - QPoint(0, lbl_help->height() + 8)));
|
||||
lbl_help->show();
|
||||
lbl_help[0]->setFont(font());
|
||||
widget_help->resize(widget_help->sizeHint());
|
||||
widget_help->move(textCode->mapToGlobal(textCode->cursorRect(tc).topLeft() - QPoint(0, widget_help->height() + 8)));
|
||||
widget_help->show();
|
||||
cursor_scope = scope.first;
|
||||
cursor_scope << scope.second;
|
||||
//qDebug() << "tooltip" << st;
|
||||
@@ -731,7 +743,7 @@ void QCodeEdit::raiseHelp(QTextCursor tc, int arg) {
|
||||
|
||||
|
||||
void QCodeEdit::hideHelp() {
|
||||
lbl_help->hide();
|
||||
widget_help->hide();
|
||||
es_cursor.cursor = QTextCursor();
|
||||
cursor_scope.clear();
|
||||
applyExtraSelection();
|
||||
|
||||
Reference in New Issue
Block a user