Skip to content

Commit a78dd02

Browse files
committed
Save some screen space and reduce number of unnecessary borders
This slightly changes the window layout of the main window and its docks by a) removing or reducing the margins around some widgets and b) changing the style of some widgets to flat i.e. removing borders around them. Via these changes we save a little screen space which should especially help on smaller screens and hopefully also make the window layout easier to read by not having as many parallel border lines in some docks.
1 parent fb43e06 commit a78dd02

5 files changed

Lines changed: 57 additions & 76 deletions

File tree

src/EditDialog.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,25 @@ EditDialog::EditDialog(QWidget* parent)
3939
ui->buttonApply->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return));
4040
ui->buttonApply->setToolTip(ui->buttonApply->toolTip() + " [" + ui->buttonApply->shortcut().toString(QKeySequence::NativeText) + "]");
4141

42-
QHBoxLayout* hexLayout = new QHBoxLayout(ui->editorBinary);
42+
// Text editor
43+
sciEdit = new DockTextEdit(this);
44+
sciEdit->setWhatsThis(tr("The text editor modes let you edit plain text, as well as JSON or XML data with syntax highlighting, automatic formatting and validation before saving.\n\nErrors are indicated with a red squiggle underline.\n\nIn the Evaluation mode, entered SQLite expressions are evaluated and the result applied to the cell."));
45+
ui->editorStack->insertWidget(TextEditor, sciEdit);
46+
47+
// Binary editor
4348
hexEdit = new QHexEdit(this);
44-
hexLayout->addWidget(hexEdit);
4549
hexEdit->setOverwriteMode(false);
50+
hexEdit->setContextMenuPolicy(Qt::ActionsContextMenu);
51+
hexEdit->addAction(ui->actionPrint);
52+
hexEdit->addAction(ui->actionCopyHexAscii);
53+
ui->editorStack->insertWidget(HexEditor, hexEdit);
4654

47-
QHBoxLayout* sciLayout = new QHBoxLayout(ui->editorSci);
48-
sciEdit = new DockTextEdit(this);
49-
sciLayout->addWidget(sciEdit);
50-
51-
QHBoxLayout* imageLayout = new QHBoxLayout(ui->editorImage);
55+
// Image editor
5256
imageEdit = new ImageViewer(this);
53-
imageLayout->addWidget(imageEdit);
57+
imageEdit->setContextMenuPolicy(Qt::ActionsContextMenu);
58+
ui->editorStack->insertWidget(ImageEditor, imageEdit);
59+
60+
ui->editorStack->setCurrentIndex(0);
5461

5562
QShortcut* ins = new QShortcut(QKeySequence(Qt::Key_Insert), this);
5663
connect(ins, &QShortcut::activated, this, &EditDialog::toggleOverwriteMode);
@@ -64,10 +71,6 @@ EditDialog::EditDialog(QWidget* parent)
6471
QShortcut* shortcutPrint = new QShortcut(QKeySequence::Print, this, nullptr, nullptr, Qt::WidgetShortcut);
6572
connect(shortcutPrint, &QShortcut::activated, this, &EditDialog::openPrintDialog);
6673

67-
// Add actions to editors that have a context menu based on actions. This also activates the shortcuts.
68-
ui->editorBinary->addAction(ui->actionPrint);
69-
ui->editorBinary->addAction(ui->actionCopyHexAscii);
70-
7174
// Set up popup menus
7275
QMenu* popupImportFileMenu = new QMenu(this);
7376
popupImportFileMenu->addAction(ui->actionImportInMenu);

src/EditDialog.ui

Lines changed: 23 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@
1717
<string>This area displays information about the data present in this database cell</string>
1818
</property>
1919
<layout class="QVBoxLayout" name="verticalLayout_5">
20+
<property name="spacing">
21+
<number>0</number>
22+
</property>
2023
<property name="leftMargin">
2124
<number>2</number>
2225
</property>
2326
<property name="topMargin">
24-
<number>2</number>
27+
<number>0</number>
2528
</property>
2629
<property name="rightMargin">
2730
<number>2</number>
2831
</property>
2932
<property name="bottomMargin">
30-
<number>2</number>
33+
<number>0</number>
3134
</property>
3235
<item>
3336
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -137,6 +140,15 @@
137140
</item>
138141
<item>
139142
<widget class="QToolBar" name="editCellToolbar">
143+
<property name="movable">
144+
<bool>false</bool>
145+
</property>
146+
<property name="iconSize">
147+
<size>
148+
<width>16</width>
149+
<height>16</height>
150+
</size>
151+
</property>
140152
<addaction name="actionWordWrap"/>
141153
<addaction name="actionIndent"/>
142154
<addaction name="actionImport"/>
@@ -154,57 +166,17 @@
154166
<property name="currentIndex">
155167
<number>0</number>
156168
</property>
157-
<widget class="QWidget" name="editorSci">
158-
<property name="whatsThis">
159-
<string>The text editor modes let you edit plain text, as well as JSON or XML data with syntax highlighting, automatic formatting and validation before saving.
160-
161-
Errors are indicated with a red squiggle underline.
162-
163-
In the Evaluation mode, entered SQLite expressions are evaluated and the result applied to the cell.</string>
169+
<widget class="QTextEdit" name="qtEdit">
170+
<property name="font">
171+
<font>
172+
<family>Monospace</family>
173+
</font>
164174
</property>
165-
</widget>
166-
<widget class="QWidget" name="rtlVerticalLayout">
167-
<layout class="QVBoxLayout" name="verticalLayout_3">
168-
<property name="spacing">
169-
<number>0</number>
170-
</property>
171-
<property name="leftMargin">
172-
<number>0</number>
173-
</property>
174-
<property name="topMargin">
175-
<number>0</number>
176-
</property>
177-
<property name="rightMargin">
178-
<number>0</number>
179-
</property>
180-
<property name="bottomMargin">
181-
<number>0</number>
182-
</property>
183-
<item>
184-
<widget class="QTextEdit" name="qtEdit">
185-
<property name="font">
186-
<font>
187-
<family>Monospace</family>
188-
</font>
189-
</property>
190-
<property name="whatsThis">
191-
<string>This Qt editor is used for right-to-left scripts, which are not supported by the default Text editor. The presence of right-to-left characters is detected and this editor mode is automatically selected.</string>
192-
</property>
193-
<property name="acceptRichText">
194-
<bool>false</bool>
195-
</property>
196-
</widget>
197-
</item>
198-
</layout>
199-
</widget>
200-
<widget class="QWidget" name="editorBinary">
201-
<property name="contextMenuPolicy">
202-
<enum>Qt::ActionsContextMenu</enum>
175+
<property name="whatsThis">
176+
<string>This Qt editor is used for right-to-left scripts, which are not supported by the default Text editor. The presence of right-to-left characters is detected and this editor mode is automatically selected.</string>
203177
</property>
204-
</widget>
205-
<widget class="QWidget" name="editorImage">
206-
<property name="contextMenuPolicy">
207-
<enum>Qt::ActionsContextMenu</enum>
178+
<property name="acceptRichText">
179+
<bool>false</bool>
208180
</property>
209181
</widget>
210182
</widget>

src/MainWindow.ui

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ You can drag SQL statements from an object row and drop them into other applicat
181181
<rect>
182182
<x>0</x>
183183
<y>0</y>
184-
<width>676</width>
184+
<width>673</width>
185185
<height>544</height>
186186
</rect>
187187
</property>
@@ -906,13 +906,13 @@ You can drag SQL statements from an object row and drop them into other applicat
906906
<number>2</number>
907907
</property>
908908
<property name="topMargin">
909-
<number>2</number>
909+
<number>0</number>
910910
</property>
911911
<property name="rightMargin">
912912
<number>2</number>
913913
</property>
914914
<property name="bottomMargin">
915-
<number>2</number>
915+
<number>0</number>
916916
</property>
917917
<item>
918918
<layout class="QHBoxLayout" name="horizontalLayout_3">
@@ -1003,7 +1003,7 @@ You can drag SQL statements from an object row and drop them into other applicat
10031003
<pointsize>8</pointsize>
10041004
</font>
10051005
</property>
1006-
<property name="readOnly">
1006+
<property name="readOnly" stdset="0">
10071007
<bool>true</bool>
10081008
</property>
10091009
</widget>
@@ -1014,7 +1014,7 @@ You can drag SQL statements from an object row and drop them into other applicat
10141014
<pointsize>8</pointsize>
10151015
</font>
10161016
</property>
1017-
<property name="readOnly">
1017+
<property name="readOnly" stdset="0">
10181018
<bool>true</bool>
10191019
</property>
10201020
</widget>
@@ -1061,13 +1061,13 @@ You can drag SQL statements from an object row and drop them into other applicat
10611061
<number>2</number>
10621062
</property>
10631063
<property name="topMargin">
1064-
<number>2</number>
1064+
<number>0</number>
10651065
</property>
10661066
<property name="rightMargin">
10671067
<number>2</number>
10681068
</property>
10691069
<property name="bottomMargin">
1070-
<number>2</number>
1070+
<number>0</number>
10711071
</property>
10721072
<item>
10731073
<widget class="QTreeView" name="treeSchemaDock">
@@ -1080,6 +1080,12 @@ You can drag multiple object names from the Name column and drop them into the S
10801080
You can drag SQL statements from the Schema column and drop them into the SQL editor or into other applications.
10811081
</string>
10821082
</property>
1083+
<property name="frameShape">
1084+
<enum>QFrame::NoFrame</enum>
1085+
</property>
1086+
<property name="frameShadow">
1087+
<enum>QFrame::Plain</enum>
1088+
</property>
10831089
<property name="dragEnabled">
10841090
<bool>true</bool>
10851091
</property>
@@ -2282,7 +2288,7 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
22822288
<customwidgets>
22832289
<customwidget>
22842290
<class>SqlTextEdit</class>
2285-
<extends>QTextEdit</extends>
2291+
<extends>QWidget</extends>
22862292
<header>sqltextedit.h</header>
22872293
<container>1</container>
22882294
</customwidget>

src/PlotDock.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
<number>2</number>
1919
</property>
2020
<property name="topMargin">
21-
<number>2</number>
21+
<number>0</number>
2222
</property>
2323
<property name="rightMargin">
2424
<number>2</number>
2525
</property>
2626
<property name="bottomMargin">
27-
<number>2</number>
27+
<number>0</number>
2828
</property>
2929
<item>
3030
<widget class="QSplitter" name="splitterForPlot">

src/RemoteDock.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
<number>2</number>
1919
</property>
2020
<property name="topMargin">
21-
<number>2</number>
21+
<number>0</number>
2222
</property>
2323
<property name="rightMargin">
2424
<number>2</number>
2525
</property>
2626
<property name="bottomMargin">
27-
<number>2</number>
27+
<number>0</number>
2828
</property>
2929
<item>
3030
<widget class="QStackedWidget" name="stack">
@@ -196,7 +196,7 @@
196196
<x>0</x>
197197
<y>0</y>
198198
<width>520</width>
199-
<height>315</height>
199+
<height>319</height>
200200
</rect>
201201
</property>
202202
<layout class="QVBoxLayout" name="verticalLayout_8">

0 commit comments

Comments
 (0)