Merge pull request #419 from f3nix/qt-keywords-1
Cosmetic change. Replace Qt keyword emit with Q_EMIT.
This commit is contained in:
commit
2a977c335a
|
@ -195,7 +195,7 @@ void TaskHeader::leaveEvent ( QEvent * /*event*/ )
|
|||
void TaskHeader::fold()
|
||||
{
|
||||
if (myExpandable) {
|
||||
emit activated();
|
||||
Q_EMIT activated();
|
||||
// Toggling the 'm_fold' member here may lead to inconsistencies with its ActionGroup.
|
||||
// Thus, the method setFold() was added and called from ActionGroup when required.
|
||||
#if 0
|
||||
|
@ -254,7 +254,7 @@ void TaskHeader::changeIcons()
|
|||
void TaskHeader::mouseReleaseEvent ( QMouseEvent * event )
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit activated();
|
||||
Q_EMIT activated();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ SignalThread::run(void)
|
|||
// just wait, and trigger every time we receive a signal
|
||||
this->waitcond.wait(&this->mutex);
|
||||
if (!this->isstopped) {
|
||||
emit triggerSignal();
|
||||
Q_EMIT triggerSignal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,193 +9,193 @@
|
|||
#include "iistaskpanelscheme.h"
|
||||
|
||||
iisIconLabel::iisIconLabel(const QIcon &icon, const QString &title, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
myPixmap(icon),
|
||||
myText(title),
|
||||
mySchemePointer(0),
|
||||
m_over(false),
|
||||
m_pressed(false),
|
||||
m_changeCursorOver(true),
|
||||
m_underlineOver(true)
|
||||
: QWidget(parent),
|
||||
myPixmap(icon),
|
||||
myText(title),
|
||||
mySchemePointer(0),
|
||||
m_over(false),
|
||||
m_pressed(false),
|
||||
m_changeCursorOver(true),
|
||||
m_underlineOver(true)
|
||||
{
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
|
||||
myFont.setWeight(0);
|
||||
myPen.setStyle(Qt::NoPen);
|
||||
myFont.setWeight(0);
|
||||
myPen.setStyle(Qt::NoPen);
|
||||
|
||||
myColor = myColorOver = myColorDisabled = QColor();
|
||||
myColor = myColorOver = myColorDisabled = QColor();
|
||||
}
|
||||
|
||||
iisIconLabel::~iisIconLabel()
|
||||
{
|
||||
//if (m_changeCursorOver)
|
||||
// QApplication::restoreOverrideCursor();
|
||||
//if (m_changeCursorOver)
|
||||
// QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void iisIconLabel::setSchemePointer(iisIconLabelScheme **pointer)
|
||||
{
|
||||
mySchemePointer = pointer;
|
||||
update();
|
||||
mySchemePointer = pointer;
|
||||
update();
|
||||
}
|
||||
|
||||
void iisIconLabel::setColors(const QColor &color, const QColor &colorOver, const QColor &colorOff)
|
||||
{
|
||||
myColor = color;
|
||||
myColorOver = colorOver;
|
||||
myColorDisabled = colorOff;
|
||||
update();
|
||||
myColor = color;
|
||||
myColorOver = colorOver;
|
||||
myColorDisabled = colorOff;
|
||||
update();
|
||||
}
|
||||
|
||||
void iisIconLabel::setFont(const QFont &font)
|
||||
{
|
||||
myFont = font;
|
||||
update();
|
||||
myFont = font;
|
||||
update();
|
||||
}
|
||||
|
||||
void iisIconLabel::setFocusPen(const QPen &pen)
|
||||
{
|
||||
myPen = pen;
|
||||
update();
|
||||
myPen = pen;
|
||||
update();
|
||||
}
|
||||
|
||||
QSize iisIconLabel::sizeHint() const
|
||||
{
|
||||
return minimumSize();
|
||||
return minimumSize();
|
||||
}
|
||||
|
||||
QSize iisIconLabel::minimumSizeHint() const
|
||||
{
|
||||
int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16;
|
||||
QPixmap px = myPixmap.pixmap(s,s,
|
||||
isEnabled() ? QIcon::Normal : QIcon::Disabled);
|
||||
int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16;
|
||||
QPixmap px = myPixmap.pixmap(s,s,
|
||||
isEnabled() ? QIcon::Normal : QIcon::Disabled);
|
||||
|
||||
int h = 4+px.height();
|
||||
int w = 8 + px.width();
|
||||
if (!myText.isEmpty()) {
|
||||
QFontMetrics fm(myFont);
|
||||
w += fm.width(myText);
|
||||
h = qMax(h, 4+fm.height());
|
||||
}
|
||||
int h = 4+px.height();
|
||||
int w = 8 + px.width();
|
||||
if (!myText.isEmpty()) {
|
||||
QFontMetrics fm(myFont);
|
||||
w += fm.width(myText);
|
||||
h = qMax(h, 4+fm.height());
|
||||
}
|
||||
|
||||
return QSize(w+2,h+2);
|
||||
return QSize(w+2,h+2);
|
||||
}
|
||||
|
||||
void iisIconLabel::paintEvent ( QPaintEvent * event )
|
||||
void iisIconLabel::paintEvent ( QPaintEvent * event )
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
|
||||
QRect textRect(rect().adjusted(0,0,-1,0));
|
||||
QRect textRect(rect().adjusted(0,0,-1,0));
|
||||
|
||||
int x = 2;
|
||||
int x = 2;
|
||||
|
||||
if (!myPixmap.isNull()) {
|
||||
int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16;
|
||||
QPixmap px = myPixmap.pixmap(s,s,
|
||||
isEnabled() ? QIcon::Normal : QIcon::Disabled);
|
||||
p.drawPixmap(x,0,px);
|
||||
x += px.width() + 4;
|
||||
}
|
||||
if (!myPixmap.isNull()) {
|
||||
int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16;
|
||||
QPixmap px = myPixmap.pixmap(s,s,
|
||||
isEnabled() ? QIcon::Normal : QIcon::Disabled);
|
||||
p.drawPixmap(x,0,px);
|
||||
x += px.width() + 4;
|
||||
}
|
||||
|
||||
if (!myText.isEmpty()) {
|
||||
QColor text = myColor, textOver = myColorOver, textOff = myColorDisabled;
|
||||
QFont fnt = myFont;
|
||||
QPen focusPen = myPen;
|
||||
bool underline = m_underlineOver/*, cursover = m_changeCursorOver*/;
|
||||
if (mySchemePointer && *mySchemePointer) {
|
||||
if (!text.isValid()) text = (*mySchemePointer)->text;
|
||||
if (!textOver.isValid()) textOver = (*mySchemePointer)->textOver;
|
||||
if (!textOff.isValid()) textOff = (*mySchemePointer)->textOff;
|
||||
if (!fnt.weight()) fnt = (*mySchemePointer)->font;
|
||||
if (focusPen.style() == Qt::NoPen) focusPen = (*mySchemePointer)->focusPen;
|
||||
underline = (*mySchemePointer)->underlineOver;
|
||||
//cursover = (*mySchemePointer)->cursorOver;
|
||||
}
|
||||
if (!myText.isEmpty()) {
|
||||
QColor text = myColor, textOver = myColorOver, textOff = myColorDisabled;
|
||||
QFont fnt = myFont;
|
||||
QPen focusPen = myPen;
|
||||
bool underline = m_underlineOver/*, cursover = m_changeCursorOver*/;
|
||||
if (mySchemePointer && *mySchemePointer) {
|
||||
if (!text.isValid()) text = (*mySchemePointer)->text;
|
||||
if (!textOver.isValid()) textOver = (*mySchemePointer)->textOver;
|
||||
if (!textOff.isValid()) textOff = (*mySchemePointer)->textOff;
|
||||
if (!fnt.weight()) fnt = (*mySchemePointer)->font;
|
||||
if (focusPen.style() == Qt::NoPen) focusPen = (*mySchemePointer)->focusPen;
|
||||
underline = (*mySchemePointer)->underlineOver;
|
||||
//cursover = (*mySchemePointer)->cursorOver;
|
||||
}
|
||||
|
||||
p.setPen(isEnabled() ? m_over ? textOver : text : textOff);
|
||||
p.setPen(isEnabled() ? m_over ? textOver : text : textOff);
|
||||
|
||||
if (isEnabled() && underline && m_over)
|
||||
fnt.setUnderline(true);
|
||||
p.setFont(fnt);
|
||||
if (isEnabled() && underline && m_over)
|
||||
fnt.setUnderline(true);
|
||||
p.setFont(fnt);
|
||||
|
||||
textRect.setLeft(x);
|
||||
QRect boundingRect;
|
||||
textRect.setLeft(x);
|
||||
QRect boundingRect;
|
||||
|
||||
QFontMetrics fm(fnt);
|
||||
QFontMetrics fm(fnt);
|
||||
#if QT_VERSION >= 0x040203
|
||||
QString txt(fm.elidedText(myText, Qt::ElideRight, textRect.width()));
|
||||
QString txt(fm.elidedText(myText, Qt::ElideRight, textRect.width()));
|
||||
#else
|
||||
QString txt = myText;
|
||||
QString txt = myText;
|
||||
#endif
|
||||
|
||||
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, txt, &boundingRect);
|
||||
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, txt, &boundingRect);
|
||||
|
||||
if (hasFocus()) {
|
||||
p.setPen(focusPen);
|
||||
p.drawRect(boundingRect.adjusted(-2,-1,0,0));
|
||||
}
|
||||
}
|
||||
if (hasFocus()) {
|
||||
p.setPen(focusPen);
|
||||
p.drawRect(boundingRect.adjusted(-2,-1,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void iisIconLabel::enterEvent ( QEvent * /*event*/ )
|
||||
{
|
||||
m_over = true;
|
||||
m_over = true;
|
||||
|
||||
//if (m_changeCursorOver)
|
||||
// QApplication::setOverrideCursor(Qt::PointingHandCursor);
|
||||
//if (m_changeCursorOver)
|
||||
// QApplication::setOverrideCursor(Qt::PointingHandCursor);
|
||||
|
||||
update();
|
||||
update();
|
||||
}
|
||||
|
||||
void iisIconLabel::leaveEvent ( QEvent * /*event*/ )
|
||||
{
|
||||
m_over = false;
|
||||
update();
|
||||
m_over = false;
|
||||
update();
|
||||
|
||||
//if (m_changeCursorOver)
|
||||
// QApplication::restoreOverrideCursor();
|
||||
//if (m_changeCursorOver)
|
||||
// QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void iisIconLabel::mousePressEvent ( QMouseEvent * event )
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_pressed = true;
|
||||
emit pressed();
|
||||
} else
|
||||
if (event->button() == Qt::RightButton)
|
||||
emit contextMenu();
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_pressed = true;
|
||||
Q_EMIT pressed();
|
||||
} else
|
||||
if (event->button() == Qt::RightButton)
|
||||
Q_EMIT contextMenu();
|
||||
|
||||
update();
|
||||
update();
|
||||
}
|
||||
|
||||
void iisIconLabel::mouseReleaseEvent ( QMouseEvent * event )
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_pressed = false;
|
||||
emit released();
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_pressed = false;
|
||||
Q_EMIT released();
|
||||
|
||||
if (rect().contains( event->pos() )) {
|
||||
emit clicked();
|
||||
emit activated();
|
||||
}
|
||||
}
|
||||
if (rect().contains( event->pos() )) {
|
||||
Q_EMIT clicked();
|
||||
Q_EMIT activated();
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
update();
|
||||
}
|
||||
|
||||
void iisIconLabel::keyPressEvent ( QKeyEvent * event )
|
||||
{
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Space:
|
||||
case Qt::Key_Return:
|
||||
emit activated();
|
||||
break;
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Space:
|
||||
case Qt::Key_Return:
|
||||
Q_EMIT activated();
|
||||
break;
|
||||
|
||||
default:;
|
||||
}
|
||||
default:;
|
||||
}
|
||||
|
||||
QWidget::keyPressEvent(event);
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,38 +16,38 @@
|
|||
#include "iisiconlabel.h"
|
||||
|
||||
iisTaskHeader::iisTaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent)
|
||||
: QFrame(parent),
|
||||
myExpandable(expandable),
|
||||
m_over(false),
|
||||
m_buttonOver(false),
|
||||
m_fold(true),
|
||||
m_opacity(0.1),
|
||||
myButton(0)
|
||||
: QFrame(parent),
|
||||
myExpandable(expandable),
|
||||
m_over(false),
|
||||
m_buttonOver(false),
|
||||
m_fold(true),
|
||||
m_opacity(0.1),
|
||||
myButton(0)
|
||||
{
|
||||
myTitle = new iisIconLabel(icon, title, this);
|
||||
myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
myTitle = new iisIconLabel(icon, title, this);
|
||||
myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
|
||||
connect(myTitle, SIGNAL(activated()), this, SLOT(fold()));
|
||||
connect(myTitle, SIGNAL(activated()), this, SLOT(fold()));
|
||||
|
||||
QHBoxLayout *hbl = new QHBoxLayout();
|
||||
hbl->setMargin(2);
|
||||
setLayout(hbl);
|
||||
QHBoxLayout *hbl = new QHBoxLayout();
|
||||
hbl->setMargin(2);
|
||||
setLayout(hbl);
|
||||
|
||||
hbl->addWidget(myTitle);
|
||||
hbl->addWidget(myTitle);
|
||||
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
||||
|
||||
setScheme(iisTaskPanelScheme::defaultScheme());
|
||||
myTitle->setSchemePointer(&myLabelScheme);
|
||||
setScheme(iisTaskPanelScheme::defaultScheme());
|
||||
myTitle->setSchemePointer(&myLabelScheme);
|
||||
|
||||
|
||||
if (myExpandable) {
|
||||
myButton = new QLabel(this);
|
||||
hbl->addWidget(myButton);
|
||||
myButton->installEventFilter(this);
|
||||
myButton->setFixedWidth(myScheme->headerButtonSize.width());
|
||||
changeIcons();
|
||||
}
|
||||
if (myExpandable) {
|
||||
myButton = new QLabel(this);
|
||||
hbl->addWidget(myButton);
|
||||
myButton->installEventFilter(this);
|
||||
myButton->setFixedWidth(myScheme->headerButtonSize.width());
|
||||
changeIcons();
|
||||
}
|
||||
}
|
||||
|
||||
iisTaskHeader::~iisTaskHeader()
|
||||
|
@ -57,145 +57,145 @@ iisTaskHeader::~iisTaskHeader()
|
|||
|
||||
bool iisTaskHeader::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
fold();
|
||||
return true;
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
fold();
|
||||
return true;
|
||||
|
||||
case QEvent::Enter:
|
||||
m_buttonOver = true;
|
||||
changeIcons();
|
||||
return true;
|
||||
case QEvent::Enter:
|
||||
m_buttonOver = true;
|
||||
changeIcons();
|
||||
return true;
|
||||
|
||||
case QEvent::Leave:
|
||||
m_buttonOver = false;
|
||||
changeIcons();
|
||||
return true;
|
||||
case QEvent::Leave:
|
||||
m_buttonOver = false;
|
||||
changeIcons();
|
||||
return true;
|
||||
|
||||
default:;
|
||||
}
|
||||
default:;
|
||||
}
|
||||
|
||||
return QFrame::eventFilter(obj, event);
|
||||
return QFrame::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void iisTaskHeader::setScheme(iisTaskPanelScheme *scheme)
|
||||
{
|
||||
if (scheme) {
|
||||
myScheme = scheme;
|
||||
myLabelScheme = &(scheme->headerLabelScheme);
|
||||
if (scheme) {
|
||||
myScheme = scheme;
|
||||
myLabelScheme = &(scheme->headerLabelScheme);
|
||||
|
||||
if (myExpandable) {
|
||||
setCursor(myLabelScheme->cursorOver ? Qt::PointingHandCursor : cursor());
|
||||
changeIcons();
|
||||
}
|
||||
if (myExpandable) {
|
||||
setCursor(myLabelScheme->cursorOver ? Qt::PointingHandCursor : cursor());
|
||||
changeIcons();
|
||||
}
|
||||
|
||||
setFixedHeight(scheme->headerSize);
|
||||
setFixedHeight(scheme->headerSize);
|
||||
|
||||
update();
|
||||
}
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void iisTaskHeader::paintEvent ( QPaintEvent * event )
|
||||
void iisTaskHeader::paintEvent ( QPaintEvent * event )
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
|
||||
#if QT_VERSION >= 0x040203
|
||||
if (myScheme->headerAnimation)
|
||||
p.setOpacity(m_opacity+0.7);
|
||||
if (myScheme->headerAnimation)
|
||||
p.setOpacity(m_opacity+0.7);
|
||||
#endif
|
||||
|
||||
p.setPen(myScheme->headerBorder);
|
||||
p.setBrush(myScheme->headerBackground);
|
||||
if (myScheme->headerBorder.style() == Qt::NoPen)
|
||||
p.drawRect(rect());
|
||||
else
|
||||
p.drawRect(rect().adjusted(0,0,-1,-1));
|
||||
p.setPen(myScheme->headerBorder);
|
||||
p.setBrush(myScheme->headerBackground);
|
||||
if (myScheme->headerBorder.style() == Qt::NoPen)
|
||||
p.drawRect(rect());
|
||||
else
|
||||
p.drawRect(rect().adjusted(0,0,-1,-1));
|
||||
}
|
||||
|
||||
void iisTaskHeader::animate()
|
||||
{
|
||||
if (!myScheme->headerAnimation)
|
||||
return;
|
||||
if (!myScheme->headerAnimation)
|
||||
return;
|
||||
|
||||
if (!isEnabled()) {
|
||||
m_opacity = 0.1;
|
||||
update();
|
||||
return;
|
||||
}
|
||||
if (!isEnabled()) {
|
||||
m_opacity = 0.1;
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_over) {
|
||||
if (m_opacity >= 0.3) {
|
||||
m_opacity = 0.3;
|
||||
return;
|
||||
}
|
||||
m_opacity += 0.05;
|
||||
} else {
|
||||
if (m_opacity <= 0.1) {
|
||||
m_opacity = 0.1;
|
||||
return;
|
||||
}
|
||||
m_opacity = qMax(0.1, m_opacity-0.05);
|
||||
}
|
||||
if (m_over) {
|
||||
if (m_opacity >= 0.3) {
|
||||
m_opacity = 0.3;
|
||||
return;
|
||||
}
|
||||
m_opacity += 0.05;
|
||||
} else {
|
||||
if (m_opacity <= 0.1) {
|
||||
m_opacity = 0.1;
|
||||
return;
|
||||
}
|
||||
m_opacity = qMax(0.1, m_opacity-0.05);
|
||||
}
|
||||
|
||||
QTimer::singleShot(100, this, SLOT(animate()));
|
||||
update();
|
||||
QTimer::singleShot(100, this, SLOT(animate()));
|
||||
update();
|
||||
}
|
||||
|
||||
void iisTaskHeader::enterEvent ( QEvent * /*event*/ )
|
||||
{
|
||||
m_over = true;
|
||||
m_over = true;
|
||||
|
||||
if (isEnabled())
|
||||
QTimer::singleShot(100, this, SLOT(animate()));
|
||||
if (isEnabled())
|
||||
QTimer::singleShot(100, this, SLOT(animate()));
|
||||
|
||||
update();
|
||||
update();
|
||||
}
|
||||
|
||||
void iisTaskHeader::leaveEvent ( QEvent * /*event*/ )
|
||||
{
|
||||
m_over = false;
|
||||
|
||||
if (isEnabled())
|
||||
QTimer::singleShot(100, this, SLOT(animate()));
|
||||
m_over = false;
|
||||
|
||||
update();
|
||||
if (isEnabled())
|
||||
QTimer::singleShot(100, this, SLOT(animate()));
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void iisTaskHeader::fold()
|
||||
{
|
||||
if (myExpandable) {
|
||||
emit activated();
|
||||
if (myExpandable) {
|
||||
Q_EMIT activated();
|
||||
|
||||
m_fold = !m_fold;
|
||||
changeIcons();
|
||||
}
|
||||
m_fold = !m_fold;
|
||||
changeIcons();
|
||||
}
|
||||
}
|
||||
|
||||
void iisTaskHeader::changeIcons()
|
||||
{
|
||||
if (!myButton)
|
||||
return;
|
||||
if (!myButton)
|
||||
return;
|
||||
|
||||
if (m_buttonOver)
|
||||
{
|
||||
if (m_fold)
|
||||
myButton->setPixmap(myScheme->headerButtonFoldOver.pixmap(myScheme->headerButtonSize));
|
||||
else
|
||||
myButton->setPixmap(myScheme->headerButtonUnfoldOver.pixmap(myScheme->headerButtonSize));
|
||||
} else
|
||||
{
|
||||
if (m_fold)
|
||||
myButton->setPixmap(myScheme->headerButtonFold.pixmap(myScheme->headerButtonSize));
|
||||
else
|
||||
myButton->setPixmap(myScheme->headerButtonUnfold.pixmap(myScheme->headerButtonSize));
|
||||
}
|
||||
if (m_buttonOver)
|
||||
{
|
||||
if (m_fold)
|
||||
myButton->setPixmap(myScheme->headerButtonFoldOver.pixmap(myScheme->headerButtonSize));
|
||||
else
|
||||
myButton->setPixmap(myScheme->headerButtonUnfoldOver.pixmap(myScheme->headerButtonSize));
|
||||
} else
|
||||
{
|
||||
if (m_fold)
|
||||
myButton->setPixmap(myScheme->headerButtonFold.pixmap(myScheme->headerButtonSize));
|
||||
else
|
||||
myButton->setPixmap(myScheme->headerButtonUnfold.pixmap(myScheme->headerButtonSize));
|
||||
}
|
||||
}
|
||||
|
||||
void iisTaskHeader::mouseReleaseEvent ( QMouseEvent * event )
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit activated();
|
||||
}
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
Q_EMIT activated();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
|
@ -19,29 +19,29 @@
|
|||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QApplication>
|
||||
|
@ -169,7 +169,7 @@ class ColorPickerItem : public QFrame
|
|||
|
||||
public:
|
||||
ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString::null,
|
||||
QWidget *parent = 0);
|
||||
QWidget *parent = 0);
|
||||
~ColorPickerItem();
|
||||
|
||||
QColor color() const;
|
||||
|
@ -205,7 +205,7 @@ class ColorPickerPopup : public QFrame
|
|||
|
||||
public:
|
||||
ColorPickerPopup(int width, bool withColorDialog,
|
||||
QWidget *parent = 0);
|
||||
QWidget *parent = 0);
|
||||
~ColorPickerPopup();
|
||||
|
||||
void insertColor(const QColor &col, const QString &text, int index);
|
||||
|
@ -217,7 +217,7 @@ public:
|
|||
|
||||
ColorPickerItem *find(const QColor &col) const;
|
||||
QColor color(int index) const;
|
||||
|
||||
|
||||
void setLastSel(const QColor & col);
|
||||
|
||||
signals:
|
||||
|
@ -268,7 +268,7 @@ private:
|
|||
\sa QFrame
|
||||
*/
|
||||
QtColorPicker::QtColorPicker(QWidget *parent,
|
||||
int cols, bool enableColorDialog)
|
||||
int cols, bool enableColorDialog)
|
||||
: QPushButton(parent), popup(0), withColorDialog(enableColorDialog)
|
||||
{
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
@ -288,7 +288,7 @@ QtColorPicker::QtColorPicker(QWidget *parent,
|
|||
// Create color grid popup and connect to it.
|
||||
popup = new ColorPickerPopup(cols, withColorDialog, this);
|
||||
connect(popup, SIGNAL(selected(const QColor &)),
|
||||
SLOT(setCurrentColor(const QColor &)));
|
||||
SLOT(setCurrentColor(const QColor &)));
|
||||
connect(popup, SIGNAL(hid()), SLOT(popupClosed()));
|
||||
|
||||
// Connect this push button's pressed() signal.
|
||||
|
@ -434,18 +434,18 @@ void QtColorPicker::setStandardColors()
|
|||
void QtColorPicker::setCurrentColor(const QColor &color)
|
||||
{
|
||||
if (color.isValid() && col == color) {
|
||||
emit colorSet(color);
|
||||
Q_EMIT colorSet(color);
|
||||
return;
|
||||
}
|
||||
if (col == color || !color.isValid())
|
||||
return;
|
||||
return;
|
||||
|
||||
ColorPickerItem *item = popup->find(color);
|
||||
if (!item) {
|
||||
insertColor(color, tr("Custom"));
|
||||
item = popup->find(color);
|
||||
insertColor(color, tr("Custom"));
|
||||
item = popup->find(color);
|
||||
}
|
||||
|
||||
|
||||
popup->setLastSel(color);
|
||||
|
||||
col = color;
|
||||
|
@ -457,8 +457,8 @@ void QtColorPicker::setCurrentColor(const QColor &color)
|
|||
repaint();
|
||||
|
||||
item->setSelected(true);
|
||||
emit colorChanged(color);
|
||||
emit colorSet(color);
|
||||
Q_EMIT colorChanged(color);
|
||||
Q_EMIT colorSet(color);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -471,9 +471,9 @@ void QtColorPicker::insertColor(const QColor &color, const QString &text, int in
|
|||
{
|
||||
popup->insertColor(color, text, index);
|
||||
if (!firstInserted) {
|
||||
col = color;
|
||||
setText(text);
|
||||
firstInserted = true;
|
||||
col = color;
|
||||
setText(text);
|
||||
firstInserted = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ bool QtColorPicker::colorDialogEnabled() const
|
|||
\code
|
||||
void Drawer::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() & RightButton) {
|
||||
if (e->button() & RightButton) {
|
||||
QColor color = QtColorPicker::getColor(mapToGlobal(e->pos()));
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ QColor QtColorPicker::getColor(const QPoint &point, bool allowCustomColors)
|
|||
Constructs the popup widget.
|
||||
*/
|
||||
ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
|
||||
QWidget *parent)
|
||||
QWidget *parent)
|
||||
: QFrame(parent, Qt::Popup)
|
||||
{
|
||||
setFrameStyle(QFrame::StyledPanel);
|
||||
|
@ -553,13 +553,13 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
|
|||
cols = width;
|
||||
|
||||
if (withColorDialog) {
|
||||
moreButton = new ColorPickerButton(this);
|
||||
moreButton->setFixedWidth(24);
|
||||
moreButton->setFixedHeight(21);
|
||||
moreButton->setFrameRect(QRect(2, 2, 20, 17));
|
||||
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
|
||||
moreButton = new ColorPickerButton(this);
|
||||
moreButton->setFixedWidth(24);
|
||||
moreButton->setFixedHeight(21);
|
||||
moreButton->setFrameRect(QRect(2, 2, 20, 17));
|
||||
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
|
||||
} else {
|
||||
moreButton = 0;
|
||||
moreButton = 0;
|
||||
}
|
||||
|
||||
eventLoop = 0;
|
||||
|
@ -586,8 +586,8 @@ ColorPickerPopup::~ColorPickerPopup()
|
|||
ColorPickerItem *ColorPickerPopup::find(const QColor &col) const
|
||||
{
|
||||
for (int i = 0; i < items.size(); ++i) {
|
||||
if (items.at(i) && items.at(i)->color() == col)
|
||||
return items.at(i);
|
||||
if (items.at(i) && items.at(i)->color() == col)
|
||||
return items.at(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -626,7 +626,7 @@ void ColorPickerPopup::insertColor(const QColor &col, const QString &text, int i
|
|||
connect(item, SIGNAL(selected()), SLOT(updateSelected()));
|
||||
|
||||
if (index == -1)
|
||||
index = items.count();
|
||||
index = items.count();
|
||||
|
||||
items.insert((unsigned int)index, item);
|
||||
regenerateGrid();
|
||||
|
@ -667,19 +667,19 @@ void ColorPickerPopup::updateSelected()
|
|||
QLayoutItem *layoutItem;
|
||||
int i = 0;
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem = reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
|
||||
if (litem != sender())
|
||||
litem->setSelected(false);
|
||||
}
|
||||
++i;
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem = reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
|
||||
if (litem != sender())
|
||||
litem->setSelected(false);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
if (sender() && sender()->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *item = (ColorPickerItem *)sender();
|
||||
lastSel = item->color();
|
||||
emit selected(item->color());
|
||||
ColorPickerItem *item = (ColorPickerItem *)sender();
|
||||
lastSel = item->color();
|
||||
Q_EMIT selected(item->color());
|
||||
}
|
||||
|
||||
hide();
|
||||
|
@ -691,7 +691,7 @@ void ColorPickerPopup::updateSelected()
|
|||
void ColorPickerPopup::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (!rect().contains(e->pos()))
|
||||
hide();
|
||||
hide();
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
@ -705,96 +705,96 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
|||
|
||||
bool foundFocus = false;
|
||||
for (int j = 0; !foundFocus && j < grid->rowCount(); ++j) {
|
||||
for (int i = 0; !foundFocus && i < grid->columnCount(); ++i) {
|
||||
if (widgetAt[j][i] && widgetAt[j][i]->hasFocus()) {
|
||||
curRow = j;
|
||||
curCol = i;
|
||||
foundFocus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; !foundFocus && i < grid->columnCount(); ++i) {
|
||||
if (widgetAt[j][i] && widgetAt[j][i]->hasFocus()) {
|
||||
curRow = j;
|
||||
curCol = i;
|
||||
foundFocus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (e->key()) {
|
||||
case Qt::Key_Left:
|
||||
if (curCol > 0) --curCol;
|
||||
else if (curRow > 0) { --curRow; curCol = grid->columnCount() - 1; }
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
if (curCol < grid->columnCount() - 1 && widgetAt[curRow][curCol + 1]) ++curCol;
|
||||
else if (curRow < grid->rowCount() - 1) { ++curRow; curCol = 0; }
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
if (curRow > 0) --curRow;
|
||||
else curCol = 0;
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
if (curRow < grid->rowCount() - 1) {
|
||||
QWidget *w = widgetAt[curRow + 1][curCol];
|
||||
if (w) {
|
||||
++curRow;
|
||||
} else for (int i = 1; i < grid->columnCount(); ++i) {
|
||||
if (!widgetAt[curRow + 1][i]) {
|
||||
curCol = i - 1;
|
||||
++curRow;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Space:
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Enter: {
|
||||
QWidget *w = widgetAt[curRow][curCol];
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w);
|
||||
wi->setSelected(true);
|
||||
case Qt::Key_Left:
|
||||
if (curCol > 0) --curCol;
|
||||
else if (curRow > 0) { --curRow; curCol = grid->columnCount() - 1; }
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
if (curCol < grid->columnCount() - 1 && widgetAt[curRow][curCol + 1]) ++curCol;
|
||||
else if (curRow < grid->rowCount() - 1) { ++curRow; curCol = 0; }
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
if (curRow > 0) --curRow;
|
||||
else curCol = 0;
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
if (curRow < grid->rowCount() - 1) {
|
||||
QWidget *w = widgetAt[curRow + 1][curCol];
|
||||
if (w) {
|
||||
++curRow;
|
||||
} else for (int i = 1; i < grid->columnCount(); ++i) {
|
||||
if (!widgetAt[curRow + 1][i]) {
|
||||
curCol = i - 1;
|
||||
++curRow;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Space:
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Enter: {
|
||||
QWidget *w = widgetAt[curRow][curCol];
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w);
|
||||
wi->setSelected(true);
|
||||
|
||||
QLayoutItem *layoutItem;
|
||||
QLayoutItem *layoutItem;
|
||||
int i = 0;
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem
|
||||
= reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
|
||||
if (litem != wi)
|
||||
litem->setSelected(false);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem
|
||||
= reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
|
||||
if (litem != wi)
|
||||
litem->setSelected(false);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
lastSel = wi->color();
|
||||
emit selected(wi->color());
|
||||
hide();
|
||||
} else if (w && w->inherits("QPushButton")) {
|
||||
ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w);
|
||||
wi->setSelected(true);
|
||||
lastSel = wi->color();
|
||||
Q_EMIT selected(wi->color());
|
||||
hide();
|
||||
} else if (w && w->inherits("QPushButton")) {
|
||||
ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w);
|
||||
wi->setSelected(true);
|
||||
|
||||
QLayoutItem *layoutItem;
|
||||
QLayoutItem *layoutItem;
|
||||
int i = 0;
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem
|
||||
= reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
|
||||
if (litem != wi)
|
||||
litem->setSelected(false);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem
|
||||
= reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
|
||||
if (litem != wi)
|
||||
litem->setSelected(false);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
lastSel = wi->color();
|
||||
emit selected(wi->color());
|
||||
hide();
|
||||
}
|
||||
}
|
||||
break;
|
||||
lastSel = wi->color();
|
||||
Q_EMIT selected(wi->color());
|
||||
hide();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Escape:
|
||||
hide();
|
||||
break;
|
||||
default:
|
||||
e->ignore();
|
||||
break;
|
||||
default:
|
||||
e->ignore();
|
||||
break;
|
||||
}
|
||||
|
||||
widgetAt[curRow][curCol]->setFocus();
|
||||
|
@ -806,12 +806,12 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
|||
void ColorPickerPopup::hideEvent(QHideEvent *e)
|
||||
{
|
||||
if (eventLoop) {
|
||||
eventLoop->exit();
|
||||
eventLoop->exit();
|
||||
}
|
||||
|
||||
setFocus();
|
||||
|
||||
emit hid();
|
||||
Q_EMIT hid();
|
||||
QFrame::hideEvent(e);
|
||||
}
|
||||
|
||||
|
@ -832,23 +832,23 @@ void ColorPickerPopup::showEvent(QShowEvent *)
|
|||
{
|
||||
bool foundSelected = false;
|
||||
for (int i = 0; i < grid->columnCount(); ++i) {
|
||||
for (int j = 0; j < grid->rowCount(); ++j) {
|
||||
QWidget *w = widgetAt[j][i];
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
if (((ColorPickerItem *)w)->isSelected()) {
|
||||
w->setFocus();
|
||||
foundSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < grid->rowCount(); ++j) {
|
||||
QWidget *w = widgetAt[j][i];
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
if (((ColorPickerItem *)w)->isSelected()) {
|
||||
w->setFocus();
|
||||
foundSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSelected) {
|
||||
if (items.count() == 0)
|
||||
setFocus();
|
||||
else
|
||||
widgetAt[0][0]->setFocus();
|
||||
if (items.count() == 0)
|
||||
setFocus();
|
||||
else
|
||||
widgetAt[0][0]->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -861,7 +861,7 @@ void ColorPickerPopup::regenerateGrid()
|
|||
|
||||
int columns = cols;
|
||||
if (columns == -1)
|
||||
columns = (int) ceil(sqrt((float) items.count()));
|
||||
columns = (int) ceil(sqrt((float) items.count()));
|
||||
|
||||
// When the number of columns grows, the number of rows will
|
||||
// fall. There's no way to shrink a grid, so we create a new
|
||||
|
@ -884,8 +884,8 @@ void ColorPickerPopup::regenerateGrid()
|
|||
}
|
||||
|
||||
if (moreButton) {
|
||||
grid->addWidget(moreButton, crow, ccol);
|
||||
widgetAt[crow][ccol] = moreButton;
|
||||
grid->addWidget(moreButton, crow, ccol);
|
||||
widgetAt[crow][ccol] = moreButton;
|
||||
}
|
||||
updateGeometry();
|
||||
}
|
||||
|
@ -901,12 +901,12 @@ void ColorPickerPopup::getColorFromDialog()
|
|||
//QRgb rgb = QColorDialog::getRgba(lastSel.rgba(), &ok, parentWidget());
|
||||
QColor col = QColorDialog::getColor(lastSel,parentWidget(),0,QColorDialog::ShowAlphaChannel);
|
||||
if (!col.isValid())
|
||||
return;
|
||||
return;
|
||||
|
||||
//QColor col = QColor::fromRgba(rgb);
|
||||
insertColor(col, tr("Custom"), -1);
|
||||
lastSel = col;
|
||||
emit selected(col);
|
||||
Q_EMIT selected(col);
|
||||
}
|
||||
|
||||
void ColorPickerPopup::setLastSel(const QColor & col) { lastSel = col; }
|
||||
|
@ -916,7 +916,7 @@ void ColorPickerPopup::setLastSel(const QColor & col) { lastSel = col; }
|
|||
whose name is set to \a text.
|
||||
*/
|
||||
ColorPickerItem::ColorPickerItem(const QColor &color, const QString &text,
|
||||
QWidget *parent)
|
||||
QWidget *parent)
|
||||
: QFrame(parent), c(color), t(text), sel(false)
|
||||
{
|
||||
setToolTip(t);
|
||||
|
@ -994,7 +994,7 @@ void ColorPickerItem::mouseMoveEvent(QMouseEvent *)
|
|||
void ColorPickerItem::mouseReleaseEvent(QMouseEvent *)
|
||||
{
|
||||
sel = true;
|
||||
emit selected();
|
||||
Q_EMIT selected();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1018,14 +1018,14 @@ void ColorPickerItem::paintEvent(QPaintEvent *)
|
|||
p.setPen( QPen( Qt::gray, 0, Qt::SolidLine ) );
|
||||
|
||||
if (sel)
|
||||
p.drawRect(1, 1, w - 3, h - 3);
|
||||
p.drawRect(1, 1, w - 3, h - 3);
|
||||
|
||||
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
|
||||
p.drawRect(3, 3, w - 7, h - 7);
|
||||
p.fillRect(QRect(4, 4, w - 8, h - 8), QBrush(c));
|
||||
|
||||
if (hasFocus())
|
||||
p.drawRect(0, 0, w - 1, h - 1);
|
||||
p.drawRect(0, 0, w - 1, h - 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1062,7 +1062,7 @@ void ColorPickerButton::mouseReleaseEvent(QMouseEvent *)
|
|||
{
|
||||
setFrameShadow(Raised);
|
||||
repaint();
|
||||
emit clicked();
|
||||
Q_EMIT clicked();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1071,15 +1071,15 @@ void ColorPickerButton::mouseReleaseEvent(QMouseEvent *)
|
|||
void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if (e->key() == Qt::Key_Up
|
||||
|| e->key() == Qt::Key_Down
|
||||
|| e->key() == Qt::Key_Left
|
||||
|| e->key() == Qt::Key_Right) {
|
||||
qApp->sendEvent(parent(), e);
|
||||
|| e->key() == Qt::Key_Down
|
||||
|| e->key() == Qt::Key_Left
|
||||
|| e->key() == Qt::Key_Right) {
|
||||
qApp->sendEvent(parent(), e);
|
||||
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
|
||||
setFrameShadow(Sunken);
|
||||
update();
|
||||
setFrameShadow(Sunken);
|
||||
update();
|
||||
} else {
|
||||
QFrame::keyPressEvent(e);
|
||||
QFrame::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1089,16 +1089,16 @@ void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
|||
void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
|
||||
{
|
||||
if (e->key() == Qt::Key_Up
|
||||
|| e->key() == Qt::Key_Down
|
||||
|| e->key() == Qt::Key_Left
|
||||
|| e->key() == Qt::Key_Right) {
|
||||
qApp->sendEvent(parent(), e);
|
||||
|| e->key() == Qt::Key_Down
|
||||
|| e->key() == Qt::Key_Left
|
||||
|| e->key() == Qt::Key_Right) {
|
||||
qApp->sendEvent(parent(), e);
|
||||
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
|
||||
setFrameShadow(Raised);
|
||||
repaint();
|
||||
emit clicked();
|
||||
setFrameShadow(Raised);
|
||||
repaint();
|
||||
Q_EMIT clicked();
|
||||
} else {
|
||||
QFrame::keyReleaseEvent(e);
|
||||
QFrame::keyReleaseEvent(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1144,8 +1144,8 @@ void ColorPickerButton::paintEvent(QPaintEvent *e)
|
|||
p.drawRect(r.center().x() + offset , r.center().y() + offset, 1, 1);
|
||||
p.drawRect(r.center().x() + offset + 4, r.center().y() + offset, 1, 1);
|
||||
if (hasFocus()) {
|
||||
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
|
||||
p.drawRect(0, 0, width() - 1, height() - 1);
|
||||
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
|
||||
p.drawRect(0, 0, width() - 1, height() - 1);
|
||||
}
|
||||
|
||||
p.end();
|
||||
|
|
|
@ -182,7 +182,7 @@ void FileChooser::chooseFile()
|
|||
|
||||
if (!fn.isEmpty()) {
|
||||
lineEdit->setText(fn);
|
||||
emit fileNameSelected(fn);
|
||||
Q_EMIT fileNameSelected(fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,9 +595,9 @@ QAbstractSpinBox::StepEnabled QuantitySpinBox::stepEnabled() const
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void QuantitySpinBox::stepBy(int steps)
|
||||
{
|
||||
|
||||
void QuantitySpinBox::stepBy(int steps)
|
||||
{
|
||||
double step = StepSize * steps;
|
||||
double val = Value + step;
|
||||
if (val > Maximum)
|
||||
|
@ -607,7 +607,7 @@ void QuantitySpinBox::stepBy(int steps)
|
|||
|
||||
lineEdit()->setText(QString::fromUtf8("%L1 %2").arg(val).arg(UnitStr));
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void QuantitySpinBox::setUnitText(QString str)
|
||||
{
|
||||
|
@ -792,9 +792,9 @@ public:
|
|||
UIntSpinBox::UIntSpinBox (QWidget* parent)
|
||||
: QSpinBox (parent)
|
||||
{
|
||||
d = new UIntSpinBoxPrivate;
|
||||
d = new UIntSpinBoxPrivate;
|
||||
d->mValidator = new UnsignedValidator(this->minimum(), this->maximum(), this);
|
||||
connect(this, SIGNAL(valueChanged(int)),
|
||||
connect(this, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(valueChange(int)));
|
||||
setRange(0, 99);
|
||||
setValue(0);
|
||||
|
@ -802,7 +802,7 @@ UIntSpinBox::UIntSpinBox (QWidget* parent)
|
|||
}
|
||||
|
||||
UIntSpinBox::~UIntSpinBox()
|
||||
{
|
||||
{
|
||||
delete d->mValidator;
|
||||
delete d; d = 0;
|
||||
}
|
||||
|
@ -1032,7 +1032,7 @@ void ColorButton::onChooseColor()
|
|||
if ( c.isValid() )
|
||||
{
|
||||
setColor( c );
|
||||
emit changed();
|
||||
Q_EMIT changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ void Wizard::setCurrentIndex(int index)
|
|||
textLabel->setText(stackWidget->currentWidget()->windowTitle());
|
||||
_backButton->setEnabled(index > 0);
|
||||
_nextButton->setEnabled(index < count()-1);
|
||||
emit currentIndexChanged(index);
|
||||
Q_EMIT currentIndexChanged(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ void Wizard::setPageTitle(QString const &newTitle)
|
|||
{
|
||||
stackWidget->currentWidget()->setWindowTitle(newTitle);
|
||||
textLabel->setText(newTitle);
|
||||
emit pageTitleChanged(newTitle);
|
||||
Q_EMIT pageTitleChanged(newTitle);
|
||||
}
|
||||
|
||||
WizardExtension::WizardExtension(Wizard *widget, QObject *parent)
|
||||
|
|
Loading…
Reference in New Issue
Block a user