Exemple #1
0
void VCWidget::resetForegroundColor()
{
    m_hasCustomForegroundColor = false;
    m_foregroundColor = Qt::black;
    setDocModified();
    emit foregroundColorChanged(m_foregroundColor);
}
void FontSetupPage::openForegroundColorDialog()
{
    QColorDialog *dialog = createColorDialog(INIMANAGER()->foregroundColor());

    connect(dialog, SIGNAL(colorSelected(QColor)), this, SLOT(foregroundColorChanged(QColor)));
    dialog->open();
}
void BusyIndicator::setForegroundColor( const QColor& color )
{
    if ( m_foregroundColor == color )
        return;
    m_foregroundColor = color;
    updateSpinner();
    emit foregroundColorChanged();
}
void FontSetupPage::colorGroupChecked(const bool checked)
{
    if (!checked) {
        foregroundColorChanged(INIMANAGER()->defaulForegroundColor());
        backgroudColorChanged(INIMANAGER()->defaulBackgroundColor());
        customBackgroudColorChanged(INIMANAGER()->defaulCustomBackgroundColor());
        currentLineFgColorChanged(INIMANAGER()->defaultCurrentLineFgColor());
        currentLineBgColorChanged(INIMANAGER()->defaultCurrentLineBgColor());
    } else {
        foregroundColorChanged(static_cast<LogViewer*>(m_plainTextEdit)->forgroundColor());
        backgroudColorChanged(static_cast<LogViewer*>(m_plainTextEdit)->backgroundColor());
        customBackgroudColorChanged(static_cast<LogViewer*>(m_plainTextEdit)->customBackgroundColor());
        currentLineFgColorChanged(static_cast<LogViewer*>(m_plainTextEdit)->currentLineFgColor());
        currentLineBgColorChanged(static_cast<LogViewer*>(m_plainTextEdit)->currentLineBgColor());
    }

    m_customColorEnabled = checked;
}
Exemple #5
0
void VCWidget::setForegroundColor(QColor foregroundColor)
{
    if (m_foregroundColor == foregroundColor)
        return;

    m_foregroundColor = foregroundColor;
    m_hasCustomForegroundColor = true;
    setDocModified();
    emit foregroundColorChanged(foregroundColor);
}
Exemple #6
0
void Text::setForegroundColor()
{
    QColor new_foreground;
    if (m_style.style & TextStyle::Inverse) {
        new_foreground = m_style.background;
    } else {
        new_foreground = m_style.foreground;
    }
    if (new_foreground != m_foregroundColor) {
        m_foregroundColor = new_foreground;
        emit foregroundColorChanged();
    }
}
Exemple #7
0
void ToolSettings::setForegroundColor(const QColor& color)
{
	if(color != d->color) {
		d->color = color;

		d->currentSettings()->setForeground(color);

		if(d->colorDialog->isVisible())
			d->colorDialog->setColor(color);

		emit foregroundColorChanged(color);
	}
}
void ToolSettings::swapForegroundBackground()
{
	QColor oldForeground = _foreground;
	_foreground = _background;
	_background = oldForeground;

	_currenttool->setForeground(_foreground);
	_currenttool->setBackground(_background);
	_toolprops[_currentQuickslot].setForegroundColor(_foreground);
	_toolprops[_currentQuickslot].setBackgroundColor(_background);
	updateToolSlot(_currentQuickslot, false);

	emit foregroundColorChanged(_foreground);
	emit backgroundColorChanged(_background);
}
void ToolSettings::setForegroundColor(const QColor& color)
{
	if(color != _foreground) {
		_foreground = color;

		_currenttool->setForeground(color);
		_toolprops[_currentQuickslot].setForegroundColor(color);
		updateToolSlot(_currentQuickslot, false);

		if(_fgdialog->isVisible())
			_fgdialog->setColor(color);

		emit foregroundColorChanged(color);
	}
}
Exemple #10
0
void kpDualColorButton::setColor (int which, const kpColor &color)
{
    Q_ASSERT (which == 0 || which == 1);

    if (m_color [which] == color)
        return;

    m_oldColor [which] = m_color [which];
    m_color [which] = color;
    update ();

    if (which == 0)
        emit foregroundColorChanged (color);
    else
        emit backgroundColorChanged (color);
}
// protected virtual [base QWidget]
void kpTransparentColorCell::mouseReleaseEvent (QMouseEvent *e)
{
    if (rect ().contains (e->pos ()))
    {
        if (e->button () == Qt::LeftButton)
        {
            emit transparentColorSelected (0);
            emit foregroundColorChanged (kpColor::Transparent);
        }
        else if (e->button () == Qt::RightButton)
        {
            emit transparentColorSelected (1);
            emit backgroundColorChanged (kpColor::Transparent);
        }
    }
}
 void WhiteBoardColorChooser::setColor(ColorLayer layer, const QColor& color)
 {
     switch (layer)
     {
     case ForegroundColor:
         setForegroundColor(color);
         emit foregroundColorChanged(color);
         break;
     case BackgroundColor:
         setBackgroundColor(color);
         emit backgroundColorChanged(color);
         break;
     default:
         Q_ASSERT(false);
         return;
     }
 }
Exemple #13
0
// protected virtual [base QWidget]
void kpDualColorButton::mouseReleaseEvent (QMouseEvent *e)
{
    m_dragStartPoint = KP_INVALID_POINT;

    if (swapPixmapRect ().contains (e->pos ()) &&
        m_color [0] != m_color [1])
    {
    #if DEBUG_KP_DUAL_COLOR_BUTTON && 1
        qCDebug(kpLogWidgets) << "kpDualColorButton::mouseReleaseEvent() swap colors:";
    #endif
        m_oldColor [0] = m_color [0];
        m_oldColor [1] = m_color [1];

        kpColor temp = m_color [0];
        m_color [0] = m_color [1];
        m_color [1] = temp;

        update ();

        emit colorsSwapped (m_color [0], m_color [1]);
        emit foregroundColorChanged (m_color [0]);
        emit backgroundColorChanged (m_color [1]);
    }
}
ToolSettings::ToolSettings(QWidget *parent)
	: QDockWidget(parent), _currentQuickslot(0), _eraserOverride(0)
{
	// Initialize tool slots
	_toolprops.reserve(QUICK_SLOTS);
	for(int i=0;i<QUICK_SLOTS;++i)
		_toolprops.append(tools::ToolsetProperties());

	// Initialize UI
	QWidget *w = new QWidget(this);
	setWidget(w);

	auto *layout = new QVBoxLayout(w);
	layout->setMargin(3);

	auto *hlayout = new QHBoxLayout;
	hlayout->setContentsMargins(3, 3, 3, 0);
	layout->addLayout(hlayout);

	// Create quick toolchange slot buttons
	QButtonGroup *quickbuttons = new QButtonGroup(this);
	quickbuttons->setExclusive(true);
	for(int i=0;i<QUICK_SLOTS;++i) {
		auto *b = new widgets::ToolSlotButton(w);

		b->setCheckable(true);
		b->setText(QString::number(i+1));
		b->setMinimumSize(32, 32);
		b->setAutoRaise(true);

		hlayout->addWidget(b);
		quickbuttons->addButton(b, i);
		_quickslot[i] = b;
	}

	connect(quickbuttons, SIGNAL(buttonClicked(int)), this, SLOT(setToolSlot(int)));

	hlayout->addSpacerItem(new QSpacerItem(10, 1, QSizePolicy::Expanding));

	// Create foreground/background color changing widget
	_fgbgcolor = new widgets::DualColorButton(w);
	_fgbgcolor->setMinimumSize(32,32);
	hlayout->addWidget(_fgbgcolor);

	connect(_fgbgcolor, &widgets::DualColorButton::foregroundChanged, [this](const QColor &c){
		_currenttool->setForeground(c);
		_toolprops[_currentQuickslot].setForegroundColor(c);
		updateToolSlot(_currentQuickslot, false);
		emit foregroundColorChanged(c);
	});
	connect(_fgbgcolor, &widgets::DualColorButton::backgroundChanged, [this](const QColor &c){
		_currenttool->setBackground(c);
		_toolprops[_currentQuickslot].setBackgroundColor(c);
		updateToolSlot(_currentQuickslot, false);
		emit backgroundColorChanged(c);
	});

	// Create a widget stack
	_widgets = new QStackedWidget(this);
	layout->addWidget(_widgets, 1);

	_pensettings = new tools::PenSettings("pen", tr("Pen"));
	_widgets->addWidget(_pensettings->createUi(this));

	_brushsettings = new tools::BrushSettings("brush", tr("Brush"));
	_widgets->addWidget(_brushsettings->createUi(this));
	_currenttool = _brushsettings;

	_erasersettings = new tools::EraserSettings("eraser", tr("Eraser"));
	_widgets->addWidget(_erasersettings->createUi(this));

	_pickersettings = new tools::ColorPickerSettings("picker", tr("Color picker"));
	_widgets->addWidget(_pickersettings->createUi(this));

	_linesettings = new tools::SimpleSettings("line", tr("Line"), icon::fromTheme("draw-line"), tools::SimpleSettings::Line, true);
	_widgets->addWidget(_linesettings->createUi(this));

	_rectsettings = new tools::SimpleSettings("rectangle", tr("Rectangle"), icon::fromTheme("draw-rectangle"), tools::SimpleSettings::Rectangle, false);
	_widgets->addWidget(_rectsettings->createUi(this));

	_ellipsesettings = new tools::SimpleSettings("ellipse", tr("Ellipse"), icon::fromTheme("draw-ellipse"), tools::SimpleSettings::Ellipse, true);
	_widgets->addWidget(_ellipsesettings->createUi(this));

	_fillsettings = new tools::FillSettings("fill", tr("Flood fill"));
	_widgets->addWidget(_fillsettings->createUi(this));

	_textsettings = new tools::AnnotationSettings("annotation", tr("Annotation"));
	_widgets->addWidget(_textsettings->createUi(this));

	_selectionsettings = new tools::SelectionSettings("selection", tr("Selection"));
	_widgets->addWidget(_selectionsettings->createUi(this));

	_lasersettings = new tools::LaserPointerSettings("laser", tr("Laser pointer"));
	_widgets->addWidget(_lasersettings->createUi(this));

	connect(_pickersettings, SIGNAL(colorSelected(QColor)), _fgbgcolor, SLOT(setForeground(QColor)));

	// Create color changer dialogs
	auto dlg_fgcolor = new Color_Dialog(this);
	dlg_fgcolor->setAlphaEnabled(false);
	dlg_fgcolor->setWindowTitle(tr("Foreground color"));
	connect(dlg_fgcolor, SIGNAL(colorSelected(QColor)), this, SLOT(setForegroundColor(QColor)));
	connect(_fgbgcolor, SIGNAL(foregroundClicked(QColor)), dlg_fgcolor, SLOT(showColor(QColor)));

	auto dlg_bgcolor = new Color_Dialog(this);
	dlg_bgcolor->setWindowTitle(tr("Background color"));
	dlg_bgcolor->setAlphaEnabled(false);
	connect(dlg_bgcolor, SIGNAL(colorSelected(QColor)), this, SLOT(setBackgroundColor(QColor)));
	connect(_fgbgcolor, SIGNAL(backgroundClicked(QColor)), dlg_bgcolor, SLOT(showColor(QColor)));
}