RedPanda-CPP/RedPandaIDE/widgets/functiontooltipwidget.h

63 lines
1.5 KiB
C
Raw Normal View History

2021-09-22 17:43:21 +08:00
#ifndef FUNCTIONTOOLTIPWIDGET_H
#define FUNCTIONTOOLTIPWIDGET_H
#include <QLabel>
#include <QToolButton>
#include <QWidget>
struct FunctionInfo {
QString name;
QString fullname;
QStringList params;
QStringList nonameParams;
QString returnType;
};
using PFunctionInfo = std::shared_ptr<FunctionInfo>;
2021-09-25 21:34:10 +08:00
class FunctionTooltipWidget : public QFrame
2021-09-22 17:43:21 +08:00
{
Q_OBJECT
public:
explicit FunctionTooltipWidget(QWidget *parent = nullptr);
void addTip(const QString& name, const QString& fullName,
const QString& returnType, const QString& args,
const QString& noNameArgs);
void clearTips();
2021-09-24 22:49:36 +08:00
int tipCount();
2021-09-22 17:43:21 +08:00
int paramPos() const;
void setParamPos(int newParamPos);
2021-09-24 11:41:14 +08:00
void nextTip();
void previousTip();
void updateTip();
2021-09-25 08:41:11 +08:00
void guessFunction(int commas);
2021-09-24 11:41:14 +08:00
int paramIndex() const;
void setParamIndex(int newParamIndex);
const QString &functionFullName() const;
void setFunctioFullName(const QString &newFunctioFullName);
2021-09-22 17:43:21 +08:00
signals:
private:
QStringList splitArgs(QString args);
2021-09-22 17:43:21 +08:00
private:
QLabel* mInfoLabel;
QLabel* mTotalLabel;
QToolButton* mUpButton;
QToolButton* mDownButton;
int mParamPos;
2021-09-24 11:41:14 +08:00
int mInfoIndex;
int mParamIndex;
QString mFunctioFullName;
2021-09-22 17:43:21 +08:00
QList<PFunctionInfo> mInfos;
2021-09-24 11:41:14 +08:00
// QWidget interface
protected:
void closeEvent(QCloseEvent *event) override;
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;
2021-09-22 17:43:21 +08:00
};
#endif // FUNCTIONTOOLTIPWIDGET_H