Added setting for fixed width vs normal font in the data tables
This commit is contained in:
@@ -48,6 +48,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
ui->cbLoadConnections->setChecked(settings.value("Main/SaveRestoreConnections", false).toBool());
|
||||
|
||||
ui->spinFontSize->setValue(settings.value("Main/FontSize", ui->cbDisplayHex->font().pointSize()).toUInt());
|
||||
ui->cbFontFixedWidth->setChecked(settings.value("Main/FontFixedWidth", false).toBool());
|
||||
|
||||
bool secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
||||
bool clockMode = settings.value("Main/TimeClock", false).toBool();
|
||||
@@ -132,6 +133,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
connect(ui->cbHexGraphInfo, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbIgnoreDBCColors, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->spinMaximumFrames, SIGNAL(valueChanged(int)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbFontFixedWidth, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
|
||||
installEventFilter(this);
|
||||
}
|
||||
@@ -199,6 +201,7 @@ void MainSettingsDialog::updateSettings()
|
||||
settings.setValue("Main/FilterLabeling", ui->cbFilterLabeling->isChecked());
|
||||
settings.setValue("Main/IgnoreDBCColors", ui->cbIgnoreDBCColors->isChecked());
|
||||
settings.setValue("Main/MaximumFrames", ui->spinMaximumFrames->value());
|
||||
settings.setValue("Main/FontFixedWidth", ui->cbFontFixedWidth->isChecked());
|
||||
|
||||
settings.sync();
|
||||
emit updatedSettings();
|
||||
|
||||
+7
-1
@@ -57,12 +57,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
verticalHeader->setSectionResizeMode(QHeaderView::Fixed);
|
||||
QSettings settings;
|
||||
int fontSize = settings.value("Main/FontSize", 9).toUInt();
|
||||
QFont sysFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); //get default font
|
||||
QFont sysFont;
|
||||
if(settings.value("Main/FontFixedWidth", false).toBool())
|
||||
sysFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); //get default fixed width font
|
||||
else
|
||||
sysFont = QFont(); //get default font
|
||||
sysFont.setPointSize(fontSize);
|
||||
verticalHeader->setDefaultSectionSize(sysFont.pixelSize());
|
||||
verticalHeader->setFont(QFont());
|
||||
ui->canFramesView->setFont(sysFont);
|
||||
|
||||
QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader();
|
||||
HorzHdr->setFont(QFont());
|
||||
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
|
||||
connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int)));
|
||||
|
||||
|
||||
@@ -21,8 +21,23 @@ SignalViewerWindow::SignalViewerWindow(const QVector<CANFrame> *frames, QWidget
|
||||
ui->tableViewer->setHorizontalHeaderLabels(headers);
|
||||
ui->tableViewer->setColumnWidth(0, 100);
|
||||
ui->tableViewer->setColumnWidth(1, 150);
|
||||
|
||||
QSettings settings;
|
||||
QFont sysFont;
|
||||
int fontSize = settings.value("Main/FontSize", 9).toUInt();
|
||||
if(settings.value("Main/FontFixedWidth", false).toBool())
|
||||
sysFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); //get default fixed width font
|
||||
else
|
||||
sysFont = QFont(); //get default font
|
||||
sysFont.setPointSize(fontSize);
|
||||
ui->tableViewer->setFont(sysFont);
|
||||
|
||||
QHeaderView *HorzHdr = ui->tableViewer->horizontalHeader();
|
||||
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
|
||||
HorzHdr->setFont(QFont());
|
||||
|
||||
QHeaderView *verticalHeader = ui->tableViewer->verticalHeader();
|
||||
verticalHeader->setFont(QFont());
|
||||
|
||||
dbcHandler = DBCHandler::getReference();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>965</width>
|
||||
<height>678</height>
|
||||
<height>713</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -191,9 +191,23 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Font Size</string>
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbFontFixedWidth">
|
||||
<property name="text">
|
||||
<string>Use fixed-width font in tables</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinFontSize">
|
||||
<property name="minimum">
|
||||
|
||||
Reference in New Issue
Block a user