forked from qt-creator/qt-creator
TextEditor: modernize FunctionHintProposalWidget
Change-Id: I158d11c17b27e4a58a52f30607df72280ec539ea Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -100,32 +100,25 @@ struct FunctionHintProposalWidgetPrivate
|
|||||||
{
|
{
|
||||||
FunctionHintProposalWidgetPrivate();
|
FunctionHintProposalWidgetPrivate();
|
||||||
|
|
||||||
const QWidget *m_underlyingWidget;
|
const QWidget *m_underlyingWidget = nullptr;
|
||||||
CodeAssistant *m_assistant;
|
CodeAssistant *m_assistant = nullptr;
|
||||||
IFunctionHintProposalModel *m_model;
|
IFunctionHintProposalModel *m_model = nullptr;
|
||||||
QPointer<Utils::FakeToolTip> m_popupFrame;
|
QPointer<Utils::FakeToolTip> m_popupFrame;
|
||||||
QLabel *m_numberLabel;
|
QLabel *m_numberLabel = nullptr;
|
||||||
QLabel *m_hintLabel;
|
QLabel *m_hintLabel = nullptr;
|
||||||
QWidget *m_pager;
|
QWidget *m_pager = nullptr;
|
||||||
QRect m_displayRect;
|
QRect m_displayRect;
|
||||||
int m_currentHint;
|
int m_currentHint = -1;
|
||||||
int m_totalHints;
|
int m_totalHints = 0;
|
||||||
int m_currentArgument;
|
int m_currentArgument = -1;
|
||||||
bool m_escapePressed;
|
bool m_escapePressed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
FunctionHintProposalWidgetPrivate::FunctionHintProposalWidgetPrivate()
|
FunctionHintProposalWidgetPrivate::FunctionHintProposalWidgetPrivate()
|
||||||
: m_underlyingWidget(0)
|
: m_popupFrame(new Utils::FakeToolTip)
|
||||||
, m_assistant(0)
|
|
||||||
, m_model(0)
|
|
||||||
, m_popupFrame(new Utils::FakeToolTip)
|
|
||||||
, m_numberLabel(new QLabel)
|
, m_numberLabel(new QLabel)
|
||||||
, m_hintLabel(new QLabel)
|
, m_hintLabel(new QLabel)
|
||||||
, m_pager(new QWidget)
|
, m_pager(new QWidget)
|
||||||
, m_currentHint(-1)
|
|
||||||
, m_totalHints(0)
|
|
||||||
, m_currentArgument(-1)
|
|
||||||
, m_escapePressed(false)
|
|
||||||
{
|
{
|
||||||
m_hintLabel->setTextFormat(Qt::RichText);
|
m_hintLabel->setTextFormat(Qt::RichText);
|
||||||
}
|
}
|
||||||
@@ -136,24 +129,24 @@ FunctionHintProposalWidgetPrivate::FunctionHintProposalWidgetPrivate()
|
|||||||
FunctionHintProposalWidget::FunctionHintProposalWidget()
|
FunctionHintProposalWidget::FunctionHintProposalWidget()
|
||||||
: d(new FunctionHintProposalWidgetPrivate)
|
: d(new FunctionHintProposalWidgetPrivate)
|
||||||
{
|
{
|
||||||
QToolButton *downArrow = new QToolButton;
|
auto downArrow = new QToolButton;
|
||||||
downArrow->setArrowType(Qt::DownArrow);
|
downArrow->setArrowType(Qt::DownArrow);
|
||||||
downArrow->setFixedSize(16, 16);
|
downArrow->setFixedSize(16, 16);
|
||||||
downArrow->setAutoRaise(true);
|
downArrow->setAutoRaise(true);
|
||||||
|
|
||||||
QToolButton *upArrow = new QToolButton;
|
auto upArrow = new QToolButton;
|
||||||
upArrow->setArrowType(Qt::UpArrow);
|
upArrow->setArrowType(Qt::UpArrow);
|
||||||
upArrow->setFixedSize(16, 16);
|
upArrow->setFixedSize(16, 16);
|
||||||
upArrow->setAutoRaise(true);
|
upArrow->setAutoRaise(true);
|
||||||
|
|
||||||
QHBoxLayout *pagerLayout = new QHBoxLayout(d->m_pager);
|
auto pagerLayout = new QHBoxLayout(d->m_pager);
|
||||||
pagerLayout->setMargin(0);
|
pagerLayout->setMargin(0);
|
||||||
pagerLayout->setSpacing(0);
|
pagerLayout->setSpacing(0);
|
||||||
pagerLayout->addWidget(upArrow);
|
pagerLayout->addWidget(upArrow);
|
||||||
pagerLayout->addWidget(d->m_numberLabel);
|
pagerLayout->addWidget(d->m_numberLabel);
|
||||||
pagerLayout->addWidget(downArrow);
|
pagerLayout->addWidget(downArrow);
|
||||||
|
|
||||||
QHBoxLayout *popupLayout = new QHBoxLayout(d->m_popupFrame);
|
auto popupLayout = new QHBoxLayout(d->m_popupFrame);
|
||||||
popupLayout->setMargin(0);
|
popupLayout->setMargin(0);
|
||||||
popupLayout->setSpacing(0);
|
popupLayout->setSpacing(0);
|
||||||
popupLayout->addWidget(d->m_pager);
|
popupLayout->addWidget(d->m_pager);
|
||||||
|
@@ -38,7 +38,7 @@ class TEXTEDITOR_EXPORT FunctionHintProposalWidget : public IAssistProposalWidge
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FunctionHintProposalWidget();
|
FunctionHintProposalWidget();
|
||||||
~FunctionHintProposalWidget();
|
~FunctionHintProposalWidget() override;
|
||||||
|
|
||||||
void setAssistant(CodeAssistant *assistant) override;
|
void setAssistant(CodeAssistant *assistant) override;
|
||||||
void setReason(AssistReason reason) override;
|
void setReason(AssistReason reason) override;
|
||||||
|
Reference in New Issue
Block a user