سؤال

QDockWidget is giving left margin of 4px to the widget i add to the dockwidget. I tried

theToolbarDock->setStyleSheet("margin: 0px; border:0px");
theToolbarDock->setContentsMargins(0,0,0,0);

and

theToolbarDock->layout()->setContentsMargins(0,0,0,0);

But in vain. It still persist with 4px left margin i have to remove from the QDockWidget. the dock widget is in RightDockWidgetArea

هل كانت مفيدة؟

المحلول

This worked for me:

QMainWindow::separator {
    width: 10px;
    height: 0px;
    margin: -10px;
    padding: 0px;
}

Let me know if it's what you need.

نصائح أخرى

setContentsMargins is applicable to the layout only.. not the widget.

Try setting it on the layout your dockwidget instead.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top