# include
#endif
@@ -231,6 +232,8 @@ void ElementView::keyPressEvent(QKeyEvent * event)
// ----------------------------------------------------------------------------
+/* TRANSLATOR SketcherGui::TaskSketcherElements */
+
TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0)
, sketchView(sketchView)
@@ -244,6 +247,18 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
ui->setupUi(proxy);
+#ifdef Q_OS_MAC
+ QString cmdKey = QString::fromUtf8("\xe2\x8c\x98"); // U+2318
+#else
+ // translate the text (it's offered by Qt's translation files)
+ // but avoid being picked up by lupdate
+ const char* ctrlKey = "Ctrl";
+ QString cmdKey = QShortcut::tr(ctrlKey);
+#endif
+ QString zKey = QString::fromLatin1("Z");
+ ui->Explanation->setText(tr(""%1": multiple selection
"
+ ""%2": switch to next valid type
")
+ .arg(cmdKey).arg(zKey));
ui->listWidgetElements->setSelectionMode(QAbstractItemView::ExtendedSelection);
ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers);
ui->listWidgetElements->setMouseTracking(true);
diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.ui b/src/Mod/Sketcher/Gui/TaskSketcherElements.ui
index 394068927..0a78b25b2 100644
--- a/src/Mod/Sketcher/Gui/TaskSketcherElements.ui
+++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.ui
@@ -91,7 +91,7 @@
-
- <html><head/><body><p>"Ctrl": multiple selection</p><p>"Z": switch to next valid type</p></body></html>
+ <html><head/><body><p>"Ctrl": multiple selection</p><p>"Z": switch to next valid type</p></body></html>
diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
index c3d16c369..4a3d4ec8e 100644
--- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
+++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
@@ -1283,6 +1283,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
else if (Constr->Type == Angle) {
Base::Vector3d p0(0.,0.,0.);
+ double factor = 0.5;
if (Constr->Second != Constraint::GeoUndef) { // line to line angle
Base::Vector3d dir1, dir2;
if(Constr->Third == Constraint::GeoUndef) { //angle between two lines
@@ -1310,7 +1311,11 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
double c2 = dir2.y*pnt2.x - dir2.x*pnt2.y;
double x = (dir1.x*c2 - dir2.x*c1)/det;
double y = (dir1.y*c2 - dir2.y*c1)/det;
+ // intersection point
p0 = Base::Vector3d(x,y,0);
+
+ Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0;
+ factor = factor * Base::sgn((dir1+dir2) * vec);
}
} else {//angle-via-point
Base::Vector3d p = getSketchObject()->getSolvedSketch().getPoint(Constr->Third, Constr->ThirdPos);
@@ -1319,6 +1324,9 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
dir1.RotateZ(-M_PI/2);//convert to vector of tangency by rotating
dir2 = getSketchObject()->getSolvedSketch().calculateNormalAtPoint(Constr->Second, p.x, p.y);
dir2.RotateZ(-M_PI/2);
+
+ Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0;
+ factor = factor * Base::sgn((dir1+dir2) * vec);
}
} else if (Constr->First != Constraint::GeoUndef) { // line/arc angle
@@ -1338,7 +1346,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
return;
Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0;
- Constr->LabelDistance = vec.Length()/2;
+ Constr->LabelDistance = factor * vec.Length();
}
// delete the cloned objects
@@ -4090,7 +4098,7 @@ Restart:
}
startangle = atan2(dir1.y,dir1.x);
- range = atan2(-dir1.y*dir2.x+dir1.x*dir2.y,
+ range = atan2(dir1.x*dir2.y-dir1.y*dir2.x,
dir1.x*dir2.x+dir1.y*dir2.y);
endangle = startangle + range;
diff --git a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp
index b2b4d781b..d40584f9e 100644
--- a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp
+++ b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp
@@ -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
@@ -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(layoutItem->widget());
- if (litem != sender())
- litem->setSelected(false);
- }
- ++i;
+ QWidget *w = layoutItem->widget();
+ if (w && w->inherits("ColorPickerItem")) {
+ ColorPickerItem *litem = reinterpret_cast(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(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(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(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(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(w);
- wi->setSelected(true);
+ lastSel = wi->color();
+ Q_EMIT selected(wi->color());
+ hide();
+ } else if (w && w->inherits("QPushButton")) {
+ ColorPickerItem *wi = reinterpret_cast(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(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(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();
diff --git a/src/Tools/plugins/widget/customwidgets.cpp b/src/Tools/plugins/widget/customwidgets.cpp
index d96b9fb9c..51f70a6df 100644
--- a/src/Tools/plugins/widget/customwidgets.cpp
+++ b/src/Tools/plugins/widget/customwidgets.cpp
@@ -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();
}
}
diff --git a/src/Tools/plugins/widget/wizard.cpp b/src/Tools/plugins/widget/wizard.cpp
index 7d788baf6..6aae3ac0a 100644
--- a/src/Tools/plugins/widget/wizard.cpp
+++ b/src/Tools/plugins/widget/wizard.cpp
@@ -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)