File indexing completed on 2024-05-05 08:41:06
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 implements 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 // Class include 0017 #include "AlphaSelect.h" 0018 0019 // Qt includes 0020 #include <QMouseEvent> 0021 0022 AlphaSelect::AlphaSelect(ScaledPixmapLabel *parent) 0023 : ScaledPixmapLabel(parent) 0024 { 0025 resize(parent->size()); 0026 setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 0027 setPixmap(*(parent->pixmap())); 0028 setCursor(QCursor(Qt::CrossCursor)); 0029 } 0030 0031 void AlphaSelect::mouseReleaseEvent(QMouseEvent *event) 0032 { 0033 if (pixmapRect().contains(event->pos())) { 0034 emit clicked(event->pos()); 0035 } 0036 } 0037 0038 #include "moc_AlphaSelect.cpp"