15 #ifndef QGSFONTBUTTON_H
16 #define QGSFONTBUTTON_H
22 #include <QToolButton>
50 Q_PROPERTY(
Mode mode READ mode WRITE setMode )
51 Q_PROPERTY( QString dialogTitle READ dialogTitle WRITE setDialogTitle )
52 Q_PROPERTY( QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY changed )
53 Q_PROPERTY(
QgsTextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY changed )
73 QSize minimumSizeHint()
const override;
74 QSize sizeHint()
const override;
89 void setMode( Mode mode );
95 void setDialogTitle(
const QString &title );
101 QString dialogTitle()
const;
143 QFont currentFont()
const;
223 void setToNullFormat();
230 void setCurrentFont(
const QFont &font );
237 void setColor(
const QColor &color );
276 bool event( QEvent *e )
override;
277 void changeEvent( QEvent *e )
override;
278 void showEvent( QShowEvent *e )
override;
279 void resizeEvent( QResizeEvent *event )
override;
282 void mousePressEvent( QMouseEvent *e )
override;
284 void mouseMoveEvent( QMouseEvent *e )
override;
287 void dragEnterEvent( QDragEnterEvent *e )
override;
290 void dragLeaveEvent( QDragLeaveEvent *e )
override;
293 void dropEvent( QDropEvent *e )
override;
295 void wheelEvent( QWheelEvent *event )
override;
299 void showSettingsDialog();
306 void addRecentColor(
const QColor &color );
312 Mode mMode = ModeTextRenderer;
314 QString mDialogTitle;
321 QPoint mDragStartPosition;
323 QMenu *mMenu =
nullptr;
325 QPointer< QgsVectorLayer > mLayer;
331 bool mShowNoFormat =
false;
332 QString mNullFormatString;
333 QPointer< QAction > mNullFormatAction;
334 QPointer< QgsTextFormatPanelWidget > mActivePanel;
343 bool formatFromMimeData(
const QMimeData *mimeData,
QgsTextFormat &resultFormat )
const;
353 bool fontFromMimeData(
const QMimeData *mimeData, QFont &resultFont )
const;
364 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor,
bool &hasAlpha );
369 QPixmap createColorIcon(
const QColor &color )
const;
374 QPixmap createDragIcon( QSize size = QSize( 50, 50 ),
const QgsTextFormat *tempFormat =
nullptr,
const QFont *tempFont =
nullptr )
const;
380 void updatePreview(
const QColor &color = QColor(),
QgsTextFormat *tempFormat =
nullptr, QFont *tempFont =
nullptr );
383 #endif // QGSFONTBUTTON_H