[SOLVED] remove the space in between the buttons
-
in the form designer, i have a textEdit and 3 buttons with a vertical spacer beside the buttons and a layout to a grid. the space in between the buttons is about 13 pixels. how to remove the space in between the buttons. i have tried this->layout()->setSpacing(0); but that does not work.
-
try set spacing to layout which contains buttons.
-
[quote author="Eus" date="1314341521"]I guess maxim meant that you create new layout with your buttons inside and sort the spacing in there, not to try setting spacing on the button itself.[/quote]
Eus, i don't understand what you are saying. are you saying to set spacing in the form designer. I can't find any spacing settings in there
-
Lukas Geyer, no properties for setSpacing in ui->nameOfTheLayoutContainingTheButtons->setSpacing(0);. layout()->setspacing does not work.
here is my ui code
@<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<widget class="QDockWidget" name="dockWidget">
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<widget class="QPlainTextEdit" name="plainTextEdit"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>72</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
@ -
-
lol
try using "this":http://translate.google.com
:Dlukas gave you an example, you don't have "nameOfTheLayoutContainingTheButtons". He is just pointing out to you that you should use that method on the layout which CONTAINS YOUR BUTTONS.
-
none of those layouts work. i have tried them before. the problem is that the textEdit horizontal width is a lot greater in width when i try these layout. it just does not work for me.
but i solved the problem. i should have had ui->dockWidgetContents instead of ui->dockWidget. this topic is solved. thank you everyone for the quick replies.