improve whitespaces

This commit is contained in:
wmayer
2017-11-24 15:42:58 +01:00
parent 0f6d0221f1
commit 868d9cc6c2
10 changed files with 101 additions and 118 deletions

View File

@@ -144,16 +144,16 @@ PyMethodDef Application::Methods[] = {
"Open a macro, Inventor or VRML file"},
{"export", (PyCFunction) Application::sExport, 1,
"save scene to Inventor or VRML file"},
{ "activeDocument", (PyCFunction)Application::sActiveDocument, 1,
{"activeDocument", (PyCFunction) Application::sActiveDocument, 1,
"activeDocument() -> object or None\n\n"
"Return the active document or None if no one exists" },
"Return the active document or None if no one exists"},
{"setActiveDocument", (PyCFunction) Application::sSetActiveDocument,1,
"setActiveDocument(string or App.Document) -> None\n\n"
"Activate the specified document"},
{ "activeView", (PyCFunction)Application::sActiveView, 1,
{"activeView", (PyCFunction)Application::sActiveView, 1,
"activeView() -> object or None\n\n"
"Return the active view of the active document or None if no one exists" },
{ "getDocument", (PyCFunction)Application::sGetDocument, 1,
"Return the active view of the active document or None if no one exists"},
{"getDocument", (PyCFunction) Application::sGetDocument, 1,
"getDocument(string) -> object\n\n"
"Get a document by its name"},
{"doCommand", (PyCFunction) Application::sDoCommand, 1,
@@ -171,39 +171,39 @@ PyMethodDef Application::Methods[] = {
{"showPreferences", (PyCFunction) Application::sShowPreferences,1,
"showPreferences([string,int]) -> None\n\n"
"Shows the preferences window. If string and int are provided, the given page index in the given group is shown."},
{"createViewer", (PyCFunction) Application::sCreateViewer,1,
"createViewer([int]) -> View3DInventor/SplitView3DInventor\n\n"
"shows and returns a viewer. If the integer argument is given and > 1: -> splitViewer"},
{"createViewer", (PyCFunction) Application::sCreateViewer,1,
"createViewer([int]) -> View3DInventor/SplitView3DInventor\n\n"
"shows and returns a viewer. If the integer argument is given and > 1: -> splitViewer"},
{NULL, NULL, 0, NULL} /* Sentinel */
};
PyObject* Gui::Application::sActiveDocument(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
Document *pcDoc = Instance->activeDocument();
if (pcDoc) {
return pcDoc->getPyObject();
}
else {
Py_Return;
}
Document *pcDoc = Instance->activeDocument();
if (pcDoc) {
return pcDoc->getPyObject();
}
else {
Py_Return;
}
}
PyObject* Gui::Application::sActiveView(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
Document *pcDoc = Instance->activeDocument();
if (pcDoc) {
Gui::MDIView *pcView = pcDoc->getActiveView();
if (pcView)
// already incremented in getPyObject().
return pcView->getPyObject();
}
Document *pcDoc = Instance->activeDocument();
if (pcDoc) {
Gui::MDIView *pcView = pcDoc->getActiveView();
if (pcView)
// already incremented in getPyObject().
return pcView->getPyObject();
}
Py_Return;
}
@@ -278,8 +278,8 @@ PyObject* Application::sGetDocument(PyObject * /*self*/, PyObject *args,PyObject
PyObject* Application::sHide(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char *psFeatStr;
if (!PyArg_ParseTuple(args, "s;Name of the object to hide has to be given!",&psFeatStr)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s;Name of the object to hide has to be given!",&psFeatStr))
return NULL;
Document *pcDoc = Instance->activeDocument();
@@ -292,8 +292,8 @@ PyObject* Application::sHide(PyObject * /*self*/, PyObject *args,PyObject * /*kw
PyObject* Application::sShow(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char *psFeatStr;
if (!PyArg_ParseTuple(args, "s;Name of the object to show has to be given!",&psFeatStr)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s;Name of the object to show has to be given!",&psFeatStr))
return NULL;
Document *pcDoc = Instance->activeDocument();
@@ -554,8 +554,8 @@ PyObject* Application::sSendActiveView(PyObject * /*self*/, PyObject *args,PyObj
{
char *psCommandStr;
PyObject *suppress=Py_False;
if (!PyArg_ParseTuple(args, "s|O!",&psCommandStr,&PyBool_Type,&suppress)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s|O!",&psCommandStr,&PyBool_Type,&suppress))
return NULL;
const char* ppReturn=0;
if (!Instance->sendMsgToActiveView(psCommandStr,&ppReturn)) {
@@ -591,8 +591,8 @@ PyObject* Application::sGetMainWindow(PyObject * /*self*/, PyObject *args,PyObje
PyObject* Application::sUpdateGui(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
qApp->processEvents();
@@ -602,8 +602,8 @@ PyObject* Application::sUpdateGui(PyObject * /*self*/, PyObject *args,PyObject *
PyObject* Application::sUpdateLocale(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
Translator::instance()->refresh();
@@ -613,8 +613,8 @@ PyObject* Application::sUpdateLocale(PyObject * /*self*/, PyObject *args,PyObjec
PyObject* Application::sGetLocale(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
std::string locale = Translator::instance()->activeLanguage();
#if PY_MAJOR_VERSION >= 3
@@ -627,8 +627,8 @@ PyObject* Application::sGetLocale(PyObject * /*self*/, PyObject *args,PyObject *
PyObject* Application::sCreateDialog(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* fn = 0;
if (!PyArg_ParseTuple(args, "s", &fn)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s", &fn))
return NULL;
PyObject* pPyResource=0L;
try{
@@ -691,8 +691,8 @@ PyObject* Application::sAddPreferencePage(PyObject * /*self*/, PyObject *args,Py
PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* psKey;
if (!PyArg_ParseTuple(args, "s", &psKey)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s", &psKey))
return NULL;
// search for workbench handler from the dictionary
PyObject* pcWorkbench = PyDict_GetItemString(Instance->_pcWorkbenchDictionary, psKey);
@@ -733,8 +733,8 @@ PyObject* Application::sAddWorkbenchHandler(PyObject * /*self*/, PyObject *args,
{
PyObject* pcObject;
std::string item;
if (!PyArg_ParseTuple(args, "O", &pcObject)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "O", &pcObject))
return NULL;
try {
// get the class object 'Workbench' from the main module that is expected
@@ -790,8 +790,8 @@ PyObject* Application::sAddWorkbenchHandler(PyObject * /*self*/, PyObject *args,
PyObject* Application::sRemoveWorkbenchHandler(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* psKey;
if (!PyArg_ParseTuple(args, "s", &psKey)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s", &psKey))
return NULL;
PyObject* wb = PyDict_GetItemString(Instance->_pcWorkbenchDictionary,psKey);
if (!wb) {
@@ -810,8 +810,8 @@ PyObject* Application::sRemoveWorkbenchHandler(PyObject * /*self*/, PyObject *ar
PyObject* Application::sGetWorkbenchHandler(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* psKey;
if (!PyArg_ParseTuple(args, "s", &psKey)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s", &psKey))
return NULL;
// get the python workbench object from the dictionary
PyObject* pcWorkbench = PyDict_GetItemString(Instance->_pcWorkbenchDictionary, psKey);
@@ -826,8 +826,8 @@ PyObject* Application::sGetWorkbenchHandler(PyObject * /*self*/, PyObject *args,
PyObject* Application::sListWorkbenchHandlers(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Instance->_pcWorkbenchDictionary);
return Instance->_pcWorkbenchDictionary;
@@ -835,12 +835,12 @@ PyObject* Application::sListWorkbenchHandlers(PyObject * /*self*/, PyObject *arg
PyObject* Application::sActiveWorkbenchHandler(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
Workbench* actWb = WorkbenchManager::instance()->active();
if (!actWb) {
PyErr_SetString(PyExc_AssertionError, "No active workbench\n");
PyErr_SetString(PyExc_AssertionError, "No active workbench\n");
return NULL;
}
@@ -860,8 +860,8 @@ PyObject* Application::sActiveWorkbenchHandler(PyObject * /*self*/, PyObject *ar
PyObject* Application::sAddResPath(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* filePath;
if (!PyArg_ParseTuple(args, "et", "utf-8", &filePath)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "et", "utf-8", &filePath))
return NULL;
QString path = QString::fromUtf8(filePath);
PyMem_Free(filePath);
if (QDir::isRelativePath(path)) {
@@ -879,8 +879,8 @@ PyObject* Application::sAddResPath(PyObject * /*self*/, PyObject *args,PyObject
PyObject* Application::sAddLangPath(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* filePath;
if (!PyArg_ParseTuple(args, "et", "utf-8", &filePath)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "et", "utf-8", &filePath))
return NULL;
QString path = QString::fromUtf8(filePath);
PyMem_Free(filePath);
if (QDir::isRelativePath(path)) {
@@ -897,8 +897,8 @@ PyObject* Application::sAddLangPath(PyObject * /*self*/, PyObject *args,PyObject
PyObject* Application::sAddIconPath(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* filePath;
if (!PyArg_ParseTuple(args, "et", "utf-8", &filePath)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "et", "utf-8", &filePath))
return NULL;
QString path = QString::fromUtf8(filePath);
PyMem_Free(filePath);
if (QDir::isRelativePath(path)) {
@@ -916,8 +916,8 @@ PyObject* Application::sAddIcon(PyObject * /*self*/, PyObject *args,PyObject * /
{
char *iconName;
char *pixmap;
if (!PyArg_ParseTuple(args, "ss", &iconName,&pixmap)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "ss", &iconName,&pixmap))
return NULL;
QPixmap icon;
if (BitmapFactory().findPixmapInCache(iconName, icon)) {
@@ -954,8 +954,8 @@ PyObject* Application::sAddCommand(PyObject * /*self*/, PyObject *args,PyObject
char* pName;
char* pSource=0;
PyObject* pcCmdObj;
if (!PyArg_ParseTuple(args, "sO|s", &pName,&pcCmdObj,&pSource)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "sO|s", &pName,&pcCmdObj,&pSource))
return NULL;
// get the call stack to find the Python module name
//
@@ -1048,8 +1048,8 @@ PyObject* Application::sRunCommand(PyObject * /*self*/, PyObject *args,PyObject
PyObject* Application::sListCommands(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
std::vector <Command*> cmds = Application::Instance->commandManager().getAllCommands();
PyObject* pyList = PyList_New(cmds.size());
@@ -1110,8 +1110,8 @@ PyObject* Application::sDoCommandGui(PyObject * /*self*/, PyObject *args, PyObje
PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char *pstr=0;
if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "s", &pstr))
return NULL;
try {
Command::addModule(Command::Doc,pstr);
@@ -1127,8 +1127,8 @@ PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject *
PyObject* Application::sShowDownloads(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, ""))
return NULL;
Gui::Dialog::DownloadManager::getInstance();
Py_INCREF(Py_None);
@@ -1139,8 +1139,8 @@ PyObject* Application::sShowPreferences(PyObject * /*self*/, PyObject *args,PyOb
{
char *pstr=0;
int idx=0;
if (!PyArg_ParseTuple(args, "|si", &pstr, &idx)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!PyArg_ParseTuple(args, "|si", &pstr, &idx))
return NULL;
Gui::Dialog::DlgPreferencesImp cDlg(getMainWindow());
if (pstr)
cDlg.activateGroupPage(QString::fromUtf8(pstr),idx);

View File

@@ -827,9 +827,7 @@ void MacroCommand::load()
if ((*it)->GetASCII("Pixmap", "nix") != "nix")
macro->setPixmap ( (*it)->GetASCII( "Pixmap" ).c_str() );
macro->setAccel ( (*it)->GetASCII( "Accel",0 ).c_str() );
macro->systemMacro = (*it)->GetBool("System", false);
macro->systemMacro = (*it)->GetBool("System", false);
Application::Instance->commandManager().addCommand( macro );
}
}
@@ -852,7 +850,7 @@ void MacroCommand::save()
hMacro->SetASCII( "Statustip", macro->getStatusTip () );
hMacro->SetASCII( "Pixmap", macro->getPixmap () );
hMacro->SetASCII( "Accel", macro->getAccel () );
hMacro->SetBool( "System", macro->systemMacro );
hMacro->SetBool( "System", macro->systemMacro );
}
}
}

View File

@@ -65,14 +65,11 @@ DlgCustomActionsImp::DlgCustomActionsImp( QWidget* parent )
->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str());
QDir d(QString::fromUtf8(cMacroPath.c_str()), QLatin1String("*.FCMacro *.py"));
for (unsigned int i=0; i<d.count(); i++ )
actionMacros->insertItem(0,d[i],QVariant(false));
actionMacros->insertItem(0,d[i],QVariant(false));
QString systemMacroDirStr = QString::fromUtf8(App::GetApplication().getHomePath()) + QString::fromUtf8("Macro");
d = QDir(systemMacroDirStr, QLatin1String("*.FCMacro *.py"));
if (d.exists()) {
for (unsigned int i=0; i<d.count(); i++ ) {
actionMacros->insertItem(0,d[i],QVariant(true));

View File

@@ -28,7 +28,6 @@
# include <qapplication.h>
# include <qdir.h>
# include <qfileinfo.h>
# include <QGLWidget>
# include <QKeySequence>
# include <qmessagebox.h>
# include <qstatusbar.h>

View File

@@ -181,7 +181,7 @@ public:
/// Attach a view (get called by the MDIView constructor)
void attachView(Gui::BaseView* pcView, bool bPassiv=false);
/// Detach a view (get called by the MDIView destructor)
void detachView(Gui::BaseView* pcView, bool bPassiv=false);
void detachView(Gui::BaseView* pcView, bool bPassiv=false);
/// helper for selection
ViewProvider* getViewProviderByPathFromTail(SoPath * path) const;
/// call update on all attached views

View File

@@ -174,7 +174,7 @@ void Gui::SoFCDB::init()
qRegisterMetaType<Base::Quantity>("Base::Quantity");
qRegisterMetaType<QList<Base::Quantity> >("Base::QuantityList");
init_done = true;
assert(!storage);
storage = new SoGroup();
storage->ref();

View File

@@ -148,7 +148,6 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent,
// create the inventor widget and set the defaults
_viewer->setDocument(this->_pcDocument);
_viewer->setDocument(this->_pcDocument);
stack->addWidget(_viewer->getWidget());
// http://forum.freecadweb.org/viewtopic.php?f=3&t=6055&sid=150ed90cbefba50f1e2ad4b4e6684eba
// describes a minor error but trying to fix it leads to a major issue
@@ -223,6 +222,7 @@ View3DInventor::~View3DInventor()
void View3DInventor::deleteSelf()
{
_viewer->setSceneGraph(0);
_viewer->setDocument(0);
MDIView::deleteSelf();
}
@@ -371,32 +371,28 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else
_viewer->setCameraType(SoPerspectiveCamera::getClassTypeId());
}
else if (strcmp(Reason, "DimensionsVisible") == 0)
{
if (rGrp.GetBool("DimensionsVisible", true))
_viewer->turnAllDimensionsOn();
else
_viewer->turnAllDimensionsOff();
else if (strcmp(Reason, "DimensionsVisible") == 0) {
if (rGrp.GetBool("DimensionsVisible", true))
_viewer->turnAllDimensionsOn();
else
_viewer->turnAllDimensionsOff();
}
else if (strcmp(Reason, "Dimensions3dVisible") == 0)
{
if (rGrp.GetBool("Dimensions3dVisible", true))
_viewer->turn3dDimensionsOn();
else
_viewer->turn3dDimensionsOff();
else if (strcmp(Reason, "Dimensions3dVisible") == 0) {
if (rGrp.GetBool("Dimensions3dVisible", true))
_viewer->turn3dDimensionsOn();
else
_viewer->turn3dDimensionsOff();
}
else if (strcmp(Reason, "DimensionsDeltaVisible") == 0)
{
if (rGrp.GetBool("DimensionsDeltaVisible", true))
_viewer->turnDeltaDimensionsOn();
else
_viewer->turnDeltaDimensionsOff();
}
else if (strcmp(Reason, "PickRadius") == 0)
{
else if (strcmp(Reason, "DimensionsDeltaVisible") == 0) {
if (rGrp.GetBool("DimensionsDeltaVisible", true))
_viewer->turnDeltaDimensionsOn();
else
_viewer->turnDeltaDimensionsOff();
}
else if (strcmp(Reason, "PickRadius") == 0) {
_viewer->setPickRadius(rGrp.GetFloat("PickRadius", 5.0f));
}
else{
else {
unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL);
unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue)
unsigned long col3 = rGrp.GetUnsigned("BackgroundColor3",2880160255UL); // default color (blue/grey)
@@ -427,7 +423,7 @@ void View3DInventor::onUpdate(void)
#ifdef FC_LOGUPDATECHAIN
Base::Console().Log("Acti: Gui::View3DInventor::onUpdate()");
#endif
update();
update();
_viewer->redraw();
}

View File

@@ -214,8 +214,6 @@ public:
ViewerEventFilter() {}
~ViewerEventFilter() {}
bool eventFilter(QObject* obj, QEvent* event) {
#ifdef GESTURE_MESS
@@ -333,6 +331,7 @@ public:
// *************************************************************************
View3DInventorViewer::View3DInventorViewer(QWidget* parent, const QtGLWidget* sharewidget)
: Quarter::SoQTQuarterAdaptor(parent, sharewidget), editViewProvider(0), navigation(0),
renderType(Native), framebuffer(0), axisCross(0), axisGroup(0), editing(false), redirected(false),
@@ -1672,11 +1671,9 @@ void View3DInventorViewer::setSeekMode(SbBool on)
void View3DInventorViewer::printDimension()
{
SoCamera* cam = getSoRenderManager()->getCamera();
if (!cam) return; // no camera there
if (!cam) return; // no camera there
SoType t = getSoRenderManager()->getCamera()->getTypeId();
if (t.isDerivedFrom(SoOrthographicCamera::getClassTypeId())) {
const SbViewportRegion& vp = getSoRenderManager()->getViewportRegion();
const SbVec2s& size = vp.getWindowSize();
@@ -2017,7 +2014,6 @@ void View3DInventorViewer::setCameraType(SoType t)
void View3DInventorViewer::moveCameraTo(const SbRotation& rot, const SbVec3f& pos, int steps, int ms)
{
SoCamera* cam = this->getSoRenderManager()->getCamera();
if (cam == 0) return;
SbVec3f campos = cam->position.getValue();
@@ -2045,7 +2041,6 @@ void View3DInventorViewer::moveCameraTo(const SbRotation& rot, const SbVec3f& po
void View3DInventorViewer::animatedViewAll(int steps, int ms)
{
SoCamera* cam = this->getSoRenderManager()->getCamera();
if (!cam)
return;

View File

@@ -192,7 +192,7 @@ public:
/// display override mode
void setOverrideMode(const std::string &mode);
void updateOverrideMode(const std::string &mode);
std::string getOverrideMode() {return overrideMode;}
std::string getOverrideMode() const {return overrideMode;}
//@}
/** @name Making pictures */
@@ -340,7 +340,6 @@ public:
void setAxisCross(bool b);
bool hasAxisCross(void);
void setEnabledFPSCounter(bool b);
void setEnabledVBO(bool b);
bool isEnabledVBO() const;
@@ -394,7 +393,6 @@ private:
static void drawArrow(void);
void setCursorRepresentation(int mode);
private:
std::set<ViewProvider*> _ViewProviderSet;
std::map<SoSeparator*,ViewProvider*> _ViewProviderMap;

View File

@@ -3377,7 +3377,7 @@ void LinkSelection::select()
// ---------------------------------------------------------------
LinkLabel::LinkLabel (QWidget * parent) : QWidget(parent)
{
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(1);