Sketcher: costraint creation mode uses toolbar icons

This commit is contained in:
AjinkyaDahale 2017-02-23 04:12:27 +05:30 committed by wmayer
parent 6be9a9bc53
commit fc08fa1c09

View File

@ -26,6 +26,7 @@
# include <cfloat>
# include <QMessageBox>
# include <Precision.hxx>
# include <QPainter>
#endif
#include <Base/Tools.h>
@ -841,6 +842,45 @@ protected:
{ return isCreateGeoActive(getActiveGuiDocument()); }
};
/* XPM */
static const char *cursor_genericconstraint[]={
"32 32 3 1",
" c None",
". c #FFFFFF",
"+ c #FF0000",
" . ",
" . ",
" . ",
" . ",
" . ",
" ",
"..... ..... ",
" ",
" . ",
" . ",
" . ",
" . ",
" . ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",};
class DrawSketchHandlerGenConstraint: public DrawSketchHandler
{
public:
@ -862,7 +902,15 @@ public:
Gui::Selection().rmvSelectionGate();
Gui::Selection().addSelectionGate(selFilterGate);
setCursor(QPixmap(constraintCursor), 7, 7);
// Constrait icon size in px
int iconSize = 16;
QPixmap cursorPixmap(cursor_genericconstraint),
icon = Gui::BitmapFactory().pixmap(cmd->sPixmap).scaledToWidth(iconSize);
QPainter cursorPainter;
cursorPainter.begin(&cursorPixmap);
cursorPainter.drawPixmap(16, 16, icon);
cursorPainter.end();
setCursor(cursorPixmap, 7, 7);
}
virtual void mouseMove(Base::Vector2d /*onSketchPos*/) {}
@ -995,46 +1043,6 @@ protected:
}
};
/* XPM */
static const char *cursor_genericconstraint[]={
"32 32 3 1",
" c None",
". c #FFFFFF",
"+ c #FF0000",
" . ",
" . ",
" . ",
" . ",
" . ",
" ",
"..... ..... ",
" ",
" . ",
" . ",
" . ",
" . ",
" . ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",};
void CmdSketcherConstraint::activated(int /*iMsg*/)
{
ActivateHandler(getActiveGuiDocument(),