mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 14:29:54 +08:00

Support attachments to internal note file. - Add/Delete/Clear/Sort; - Support custom attachment folder for each notebook (read-only); - Support renaming attachment;
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#ifndef VBUTTONWITHWIDGET_H
|
|
#define VBUTTONWITHWIDGET_H
|
|
|
|
#include <QPushButton>
|
|
#include <QString>
|
|
#include <QIcon>
|
|
#include <QWidgetAction>
|
|
|
|
class VButtonWidgetAction : public QWidgetAction
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
VButtonWidgetAction(QWidget *p_widget, QWidget *p_parent)
|
|
: QWidgetAction(p_parent), m_widget(p_widget)
|
|
{
|
|
}
|
|
|
|
QWidget *createWidget(QWidget *p_parent)
|
|
{
|
|
m_widget->setParent(p_parent);
|
|
return m_widget;
|
|
}
|
|
|
|
private:
|
|
QWidget *m_widget;
|
|
};
|
|
|
|
// A QPushButton with popup widget.
|
|
class VButtonWithWidget : public QPushButton
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
VButtonWithWidget(QWidget *p_widget,
|
|
QWidget *p_parent = Q_NULLPTR);
|
|
|
|
VButtonWithWidget(const QString &p_text,
|
|
QWidget *p_widget,
|
|
QWidget *p_parent = Q_NULLPTR);
|
|
|
|
VButtonWithWidget(const QIcon &p_icon,
|
|
const QString &p_text,
|
|
QWidget *p_widget,
|
|
QWidget *p_parent = Q_NULLPTR);
|
|
|
|
QWidget *getPopupWidget() const;
|
|
|
|
// Show the popup widget.
|
|
void showPopupWidget();
|
|
|
|
signals:
|
|
// Emit when popup widget is about to show.
|
|
void popupWidgetAboutToShow(QWidget *p_widget);
|
|
|
|
private:
|
|
void init();
|
|
|
|
QWidget *m_popupWidget;
|
|
};
|
|
|
|
#endif // VBUTTONWITHWIDGET_H
|