File indexing completed on 2024-04-28 04:31:54

0001 /*
0002  * Copyright (C) 2003-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 /** @file
0012  * This file defines an overlay to be used on top of a QLabel to allow the
0013  * selection of a pixel point to be used as a color to be ignored.
0014  */
0015 
0016 #ifndef AlphaSelect_H
0017 #define AlphaSelect_H
0018 
0019 // Qt includes
0020 #include <QPoint>
0021 
0022 // Application includes
0023 #include "ScaledPixmapLabel.h"
0024 
0025 // Forward declaration of Qt classes
0026 class QMouseEvent;
0027 
0028 /**
0029  * This class defines a widget based on a ScaledPixmapLabel that will allow
0030  * user selection of a point on the widget to define a color to be ignored for
0031  * import.
0032  */
0033 class AlphaSelect : public ScaledPixmapLabel
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     /**
0039      * Constructor to initialise the class from the parent ScaledPixmapLabel
0040      * used in the ImportImageDlg ui file. This class becomes a child of
0041      * the parent and initialises it with the parents QPixmap.
0042      *
0043      * @param parent is a pointer to the parent ScaledPixmapLabel
0044      */
0045     explicit AlphaSelect(ScaledPixmapLabel *parent);
0046 
0047 signals:
0048     /**
0049      * This signal is emmitted when the user clicks the mouse button and includes
0050      * the QPoint of the clicked position relative to the origin of the
0051      * widget.
0052      */
0053     void clicked(QPoint);
0054 
0055 protected:
0056     /**
0057      * This overrides the base class method to determine where the user clicked
0058      * the mouse. If the cursor is within the image preview the clicked
0059      * signal will be emmitted.
0060      *
0061      * @param event is a pointer to the QMouseEvent
0062      */
0063     virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
0064 };
0065 
0066 #endif // AlphaSelect_H