Skip to content

Commit 7110661

Browse files
committed
Resize table widget
1 parent e7128f0 commit 7110661

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/mainwindow.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
#include "ui_mainwindow.h"
44

5+
#include <QDebug>
56
#include <QModbusTcpServer>
67
#include <QUrl>
7-
#include <QDebug>
88

9-
MainWindow::MainWindow(QWidget *parent) :
10-
QMainWindow(parent),
11-
_pUi(new Ui::MainWindow)
9+
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), _pUi(new Ui::MainWindow)
1210
{
1311
_pUi->setupUi(this);
1412

@@ -65,10 +63,10 @@ MainWindow::MainWindow(QWidget *parent) :
6563
/** Setup registerView **/
6664
_pUi->tblRegData->setModel(_pRegisterDataModel);
6765
_pUi->tblRegData->verticalHeader()->show();
68-
_pUi->tblRegData->horizontalHeader()->show(); // Not sure yet (show or not to show?)
66+
_pUi->tblRegData->horizontalHeader()->show();
6967

7068
/* Don't stretch columns, resize to contents */
71-
_pUi->tblRegData->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
69+
_pUi->tblRegData->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
7270

7371
QList<uint> registerList = QList<uint>() << 0 << 1 << 2 << 3 << 4;
7472
_pSlaveData->setRegisterState(registerList, true);

src/mainwindow.ui

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>700</width>
9+
<width>1021</width>
1010
<height>628</height>
1111
</rect>
1212
</property>
@@ -28,7 +28,7 @@
2828
<item>
2929
<widget class="QRadioButton" name="optErrorOnce">
3030
<property name="layoutDirection">
31-
<enum>Qt::LeftToRight</enum>
31+
<enum>Qt::LayoutDirection::LeftToRight</enum>
3232
</property>
3333
<property name="text">
3434
<string>Once</string>
@@ -97,7 +97,7 @@
9797
<item row="0" column="0">
9898
<widget class="Line" name="line">
9999
<property name="orientation">
100-
<enum>Qt::Horizontal</enum>
100+
<enum>Qt::Orientation::Horizontal</enum>
101101
</property>
102102
</widget>
103103
</item>
@@ -125,7 +125,7 @@
125125
<item row="3" column="1">
126126
<spacer name="verticalSpacer">
127127
<property name="orientation">
128-
<enum>Qt::Vertical</enum>
128+
<enum>Qt::Orientation::Vertical</enum>
129129
</property>
130130
<property name="sizeHint" stdset="0">
131131
<size>
@@ -185,7 +185,7 @@
185185
<item row="1" column="3">
186186
<spacer name="horizontalSpacer">
187187
<property name="orientation">
188-
<enum>Qt::Horizontal</enum>
188+
<enum>Qt::Orientation::Horizontal</enum>
189189
</property>
190190
<property name="sizeHint" stdset="0">
191191
<size>
@@ -231,7 +231,7 @@
231231
<item row="1" column="0">
232232
<widget class="Line" name="line_2">
233233
<property name="orientation">
234-
<enum>Qt::Horizontal</enum>
234+
<enum>Qt::Orientation::Horizontal</enum>
235235
</property>
236236
</widget>
237237
</item>

0 commit comments

Comments
 (0)