##// END OF EJS Templates
In QML axisXTop didn't go top...
In QML axisXTop didn't go top It looked like the signal was connected to wrong slot. Probably copy&paste bug. Change-Id: Ie4887970891f3b902b71fb0b686c4adbbc1d48b1 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>

File last commit:

r2574:599370d0561c
r2576:dee90918a18a
Show More
brushtool.cpp
100 lines | 3.3 KiB | text/x-c | CppLexer
Jani Honkonen
Split piechartcustomization to different files
r844 /****************************************************************************
**
Miikka Heikkinen
More copyright year changes
r2433 ** Copyright (C) 2013 Digia Plc
Jani Honkonen
Split piechartcustomization to different files
r844 ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** This file is part of the Qt Enterprise Charts Add-on.
Jani Honkonen
Split piechartcustomization to different files
r844 **
** $QT_BEGIN_LICENSE$
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
Jani Honkonen
Split piechartcustomization to different files
r844 ** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
#include "brushtool.h"
#include <QPushButton>
#include <QFormLayout>
#include <QComboBox>
#include <QColorDialog>
BrushTool::BrushTool(QString title, QWidget *parent)
Jani Honkonen
coding style fixes for demos
r2099 : QWidget(parent)
Jani Honkonen
Split piechartcustomization to different files
r844 {
setWindowTitle(title);
setWindowFlags(Qt::Tool);
m_colorButton = new QPushButton();
m_styleCombo = new QComboBox();
Jani Honkonen
Fix deprecation errors from Qt5
r2241 m_styleCombo->addItem("Nobrush", (int) Qt::NoBrush);
m_styleCombo->addItem("Solidpattern", (int) Qt::SolidPattern);
m_styleCombo->addItem("Dense1pattern", (int) Qt::Dense1Pattern);
m_styleCombo->addItem("Dense2attern", (int) Qt::Dense2Pattern);
m_styleCombo->addItem("Dense3Pattern", (int) Qt::Dense3Pattern);
m_styleCombo->addItem("Dense4Pattern", (int) Qt::Dense4Pattern);
m_styleCombo->addItem("Dense5Pattern", (int) Qt::Dense5Pattern);
m_styleCombo->addItem("Dense6Pattern", (int) Qt::Dense6Pattern);
m_styleCombo->addItem("Dense7Pattern", (int) Qt::Dense7Pattern);
m_styleCombo->addItem("HorPattern", (int) Qt::HorPattern);
m_styleCombo->addItem("VerPattern", (int) Qt::VerPattern);
m_styleCombo->addItem("CrossPattern", (int) Qt::CrossPattern);
m_styleCombo->addItem("BDiagPattern", (int) Qt::BDiagPattern);
m_styleCombo->addItem("FDiagPattern", (int) Qt::FDiagPattern);
m_styleCombo->addItem("DiagCrossPattern", (int) Qt::DiagCrossPattern);
Jani Honkonen
Split piechartcustomization to different files
r844
QFormLayout *layout = new QFormLayout();
layout->addRow("Color", m_colorButton);
layout->addRow("Style", m_styleCombo);
setLayout(layout);
connect(m_colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog()));
connect(m_styleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStyle()));
}
void BrushTool::setBrush(QBrush brush)
{
m_brush = brush;
m_colorButton->setText(m_brush.color().name());
m_styleCombo->setCurrentIndex(m_brush.style()); // index matches the enum
}
QBrush BrushTool::brush() const
{
return m_brush;
}
QString BrushTool::name()
{
return name(m_brush);
}
QString BrushTool::name(const QBrush &brush)
{
return brush.color().name();
}
void BrushTool::showColorDialog()
{
QColorDialog dialog(m_brush.color());
dialog.show();
dialog.exec();
m_brush.setColor(dialog.selectedColor());
m_colorButton->setText(m_brush.color().name());
emit changed();
}
void BrushTool::updateStyle()
{
Qt::BrushStyle style = (Qt::BrushStyle) m_styleCombo->itemData(m_styleCombo->currentIndex()).toInt();
if (m_brush.style() != style) {
m_brush.setStyle(style);
emit changed();
}
}
#include "moc_brushtool.cpp"