Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.2 KB
Raw Blame
/* This file is part of the KDE libraries
   SPDX-FileCopyrightText: 2026 Arkady Flury <[email protected]>

   SPDX-License-Identifier: LGPL-2.0-only
*/

#include "KoSwapBgFgColours.h"
#include <QPainter>
#include <QEvent>



KoSwapBgFgColours::KoSwapBgFgColours(KisCanvasResourceProvider *canvasResourceProvider,
                                     const KoColorDisplayRendererInterface *displayRenderer,
                                     QWidget *parent, QWidget *dialogParent)
    : KoDualColorButton(canvasResourceProvider, displayRenderer, parent, dialogParent)
{
    foregroundRect = QRect( 0, 7, 14, 14);
    backgroundRect = QRect( 7, 14, 14, 14);
}


void KoSwapBgFgColours::paint_icons(QPainter &painter)
{
    painter.drawPixmap( 15, 1, arrowBitmap );
}

void KoSwapBgFgColours::mousePressEvent( QMouseEvent *event )
{
    Q_UNUSED(event);
    swapColours();
}

void KoSwapBgFgColours::mouseReleaseEvent( QMouseEvent *event )
{
    Q_UNUSED(event);
}

bool KoSwapBgFgColours::event(QEvent *event)
{
    if (event->type() == QEvent::ToolTip) {
        this->setToolTip(i18n("Swap foreground and background colors"));
    }
    return QWidget::event(event);
}

void KoSwapBgFgColours::mouseMoveEvent( QMouseEvent *event )
{
    Q_UNUSED(event);
}