15 #ifndef QGSFONTBUTTON_H
16 #define QGSFONTBUTTON_H
22 #include <QToolButton>
48 Q_PROPERTY(
Mode mode READ mode WRITE setMode )
49 Q_PROPERTY( QString dialogTitle READ dialogTitle WRITE setDialogTitle )
50 Q_PROPERTY( QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY changed )
51 Q_PROPERTY(
QgsTextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY changed )
71 QSize minimumSizeHint()
const override;
72 QSize sizeHint()
const override;
87 void setMode( Mode mode );
93 void setDialogTitle(
const QString &title );
99 QString dialogTitle()
const;
141 QFont currentFont()
const;
180 void setCurrentFont(
const QFont &font );
187 void setColor(
const QColor &color );
226 bool event( QEvent *e )
override;
227 void changeEvent( QEvent *e )
override;
228 void showEvent( QShowEvent *e )
override;
229 void resizeEvent( QResizeEvent *event )
override;
232 void mousePressEvent( QMouseEvent *e )
override;
234 void mouseMoveEvent( QMouseEvent *e )
override;
237 void dragEnterEvent( QDragEnterEvent *e )
override;
240 void dragLeaveEvent( QDragLeaveEvent *e )
override;
243 void dropEvent( QDropEvent *e )
override;
245 void wheelEvent( QWheelEvent *event )
override;
249 void showSettingsDialog();
256 void addRecentColor(
const QColor &color );
262 Mode mMode = ModeTextRenderer;
264 QString mDialogTitle;
271 QPoint mDragStartPosition;
273 QMenu *mMenu =
nullptr;
275 QPointer< QgsVectorLayer > mLayer;
288 bool formatFromMimeData(
const QMimeData *mimeData,
QgsTextFormat &resultFormat )
const;
298 bool fontFromMimeData(
const QMimeData *mimeData, QFont &resultFont )
const;
309 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor,
bool &hasAlpha );
314 QPixmap createColorIcon(
const QColor &color )
const;
319 QPixmap createDragIcon( QSize size = QSize( 50, 50 ),
const QgsTextFormat *tempFormat =
nullptr,
const QFont *tempFont =
nullptr )
const;
325 void updatePreview(
const QColor &color = QColor(),
QgsTextFormat *tempFormat =
nullptr, QFont *tempFont =
nullptr );
328 #endif // QGSFONTBUTTON_H